* Extended script command 'set' to return the variable reference (topic:190602).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12871 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
e25af12edf
commit
57cfa2d794
@ -3,6 +3,8 @@ Date Added
|
||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||
|
||||
2008/06/22
|
||||
* Extended script command 'set' to return the variable reference (topic:190602). [FlavioJS]
|
||||
2008/06/19
|
||||
* Added Sirius_White's fix for sense working on emperium. (bugreport: 1679) [SketchyPhoenix]
|
||||
* Fixed SC_CHANGEUNDEAD behavior: Blessing and Increase AGI deals 1 damage and does not apply buffs to those inflicted by it.
|
||||
|
@ -4,7 +4,7 @@
|
||||
//= A reference manual for the eAthena scripting language.
|
||||
//= Commands are sorted depending on their functionality.
|
||||
//===== Version ===========================================
|
||||
//= 3.21.20080612
|
||||
//= 3.22.20080622
|
||||
//=========================================================
|
||||
//= 1.0 - First release, filled will as much info as I could
|
||||
//= remember or figure out, most likely there are errors,
|
||||
@ -118,6 +118,8 @@
|
||||
//= skill, addtoskill, guildskill, getskilllv, getgdskilllv, itemskill,
|
||||
//= petskillattack, petskillattack2, petskillsupport, skilleffect, npcskilleffect,
|
||||
//= unitskilluseid, unitskillusepos, bonus/bonus2/bonus3/bonus4/bonus5
|
||||
//= 3.22.20080622
|
||||
//= Extended 'set' to return the variable reference. [FlavioJS]
|
||||
//=========================================================
|
||||
|
||||
This document is a reference manual for all the scripting commands and functions
|
||||
@ -1108,6 +1110,8 @@ will make @x equal 100.
|
||||
will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
|
||||
integer in this language) and make @x equal it.
|
||||
|
||||
Returns the variable reference (since trunk r12870).
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*setd "<variable name>",<value>;
|
||||
@ -4394,7 +4398,7 @@ autoscript).
|
||||
---------------------------------------
|
||||
|
||||
*skill <skill id>,<level>{,<flag>};
|
||||
*skill "<skill name",<level>{,<flag>};
|
||||
*skill "<skill name>",<level>{,<flag>};
|
||||
*addtoskill <skill id>,<level>{,<flag>};
|
||||
*addtoskill "<skill name>",<level>{,<flag>};
|
||||
|
||||
|
@ -4673,24 +4673,33 @@ BUILDIN_FUNC(input)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* •Ď<EFBFBD>”<EFBFBD>Ý’č
|
||||
*------------------------------------------*/
|
||||
/// Sets the value of a variable.
|
||||
/// The value is converted to the type of the variable.
|
||||
///
|
||||
/// set(<variable>,<value>) -> <variable>
|
||||
BUILDIN_FUNC(set)
|
||||
{
|
||||
TBL_PC* sd = NULL;
|
||||
int num=st->stack->stack_data[st->start+2].u.num;
|
||||
char *name=str_buf+str_data[num&0x00ffffff].str;
|
||||
char prefix=*name;
|
||||
char postfix=name[strlen(name)-1];
|
||||
struct script_data* data;
|
||||
int num;
|
||||
char* name;
|
||||
char prefix;
|
||||
char postfix;
|
||||
|
||||
if( !data_isreference(script_getdata(st,2)) ){
|
||||
data = script_getdata(st,2);
|
||||
if( !data_isreference(data) )
|
||||
{
|
||||
ShowError("script:set: not a variable\n");
|
||||
script_reportdata(script_getdata(st,2));
|
||||
st->state = END;
|
||||
return 1;
|
||||
}
|
||||
|
||||
num = reference_getuid(data);
|
||||
name = reference_getname(data);
|
||||
prefix = *name;
|
||||
postfix = (*name ? name[strlen(name)-1] : '\0');
|
||||
|
||||
if( not_server_variable(prefix) )
|
||||
{
|
||||
sd = script_rid2sd(st);
|
||||
@ -4701,15 +4710,18 @@ BUILDIN_FUNC(set)
|
||||
}
|
||||
}
|
||||
|
||||
if( postfix=='$' ){
|
||||
// •¶Žš—ń
|
||||
if( postfix == '$' )
|
||||
{// string variable
|
||||
const char* str = script_getstr(st,3);
|
||||
set_reg(st,sd,num,name,(void*)str,script_getref(st,2));
|
||||
}else{
|
||||
// <20>”’l
|
||||
}
|
||||
else
|
||||
{// integer variable
|
||||
int val = script_getnum(st,3);
|
||||
set_reg(st,sd,num,name,(void*)val,script_getref(st,2));
|
||||
}
|
||||
// return a copy of the variable reference
|
||||
script_pushcopy(st,2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user