* 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.
|
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.
|
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
|
2008/06/19
|
||||||
* Added Sirius_White's fix for sense working on emperium. (bugreport: 1679) [SketchyPhoenix]
|
* 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.
|
* 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.
|
//= A reference manual for the eAthena scripting language.
|
||||||
//= Commands are sorted depending on their functionality.
|
//= Commands are sorted depending on their functionality.
|
||||||
//===== Version ===========================================
|
//===== Version ===========================================
|
||||||
//= 3.21.20080612
|
//= 3.22.20080622
|
||||||
//=========================================================
|
//=========================================================
|
||||||
//= 1.0 - First release, filled will as much info as I could
|
//= 1.0 - First release, filled will as much info as I could
|
||||||
//= remember or figure out, most likely there are errors,
|
//= remember or figure out, most likely there are errors,
|
||||||
@ -118,6 +118,8 @@
|
|||||||
//= skill, addtoskill, guildskill, getskilllv, getgdskilllv, itemskill,
|
//= skill, addtoskill, guildskill, getskilllv, getgdskilllv, itemskill,
|
||||||
//= petskillattack, petskillattack2, petskillsupport, skilleffect, npcskilleffect,
|
//= petskillattack, petskillattack2, petskillsupport, skilleffect, npcskilleffect,
|
||||||
//= unitskilluseid, unitskillusepos, bonus/bonus2/bonus3/bonus4/bonus5
|
//= 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
|
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
|
will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
|
||||||
integer in this language) and make @x equal it.
|
integer in this language) and make @x equal it.
|
||||||
|
|
||||||
|
Returns the variable reference (since trunk r12870).
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*setd "<variable name>",<value>;
|
*setd "<variable name>",<value>;
|
||||||
@ -4394,7 +4398,7 @@ autoscript).
|
|||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
*skill <skill id>,<level>{,<flag>};
|
*skill <skill id>,<level>{,<flag>};
|
||||||
*skill "<skill name",<level>{,<flag>};
|
*skill "<skill name>",<level>{,<flag>};
|
||||||
*addtoskill <skill id>,<level>{,<flag>};
|
*addtoskill <skill id>,<level>{,<flag>};
|
||||||
*addtoskill "<skill name>",<level>{,<flag>};
|
*addtoskill "<skill name>",<level>{,<flag>};
|
||||||
|
|
||||||
|
@ -4673,27 +4673,36 @@ BUILDIN_FUNC(input)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/// Sets the value of a variable.
|
||||||
* •Ď<EFBFBD>”<EFBFBD>Ý’č
|
/// The value is converted to the type of the variable.
|
||||||
*------------------------------------------*/
|
///
|
||||||
|
/// set(<variable>,<value>) -> <variable>
|
||||||
BUILDIN_FUNC(set)
|
BUILDIN_FUNC(set)
|
||||||
{
|
{
|
||||||
TBL_PC *sd=NULL;
|
TBL_PC* sd = NULL;
|
||||||
int num=st->stack->stack_data[st->start+2].u.num;
|
struct script_data* data;
|
||||||
char *name=str_buf+str_data[num&0x00ffffff].str;
|
int num;
|
||||||
char prefix=*name;
|
char* name;
|
||||||
char postfix=name[strlen(name)-1];
|
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");
|
ShowError("script:set: not a variable\n");
|
||||||
script_reportdata(script_getdata(st,2));
|
script_reportdata(script_getdata(st,2));
|
||||||
st->state = END;
|
st->state = END;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(not_server_variable(prefix))
|
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);
|
sd = script_rid2sd(st);
|
||||||
if( sd == NULL )
|
if( sd == NULL )
|
||||||
{
|
{
|
||||||
ShowError("script:set: no player attached for player variable '%s'\n", name);
|
ShowError("script:set: no player attached for player variable '%s'\n", name);
|
||||||
@ -4701,15 +4710,18 @@ BUILDIN_FUNC(set)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( postfix=='$' ){
|
if( postfix == '$' )
|
||||||
// •¶Žš—ń
|
{// string variable
|
||||||
const char *str = script_getstr(st,3);
|
const char* str = script_getstr(st,3);
|
||||||
set_reg(st,sd,num,name,(void*)str,script_getref(st,2));
|
set_reg(st,sd,num,name,(void*)str,script_getref(st,2));
|
||||||
}else{
|
}
|
||||||
// <20>”’l
|
else
|
||||||
|
{// integer variable
|
||||||
int val = script_getnum(st,3);
|
int val = script_getnum(st,3);
|
||||||
set_reg(st,sd,num,name,(void*)val,script_getref(st,2));
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user