From f89da71c4480a6d2924351fb9e5a26e2f593e9a5 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 27 May 2017 18:06:26 -0400 Subject: document previously undocumented parameter of getparam --- doc/script_commands.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 0ba350ad1..8b8326862 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -2451,7 +2451,7 @@ arrays: --------------------------------------- -*readparam() +*readparam({, ""}) This function will return the basic stats of an invoking character, referred to by the parameter number. Instead of a number, you can use a -- cgit v1.2.3-60-g2f50 From 0e30a97cb5629ee3c600fc2cdbc1ed9f0bc69636 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 27 May 2017 18:15:25 -0400 Subject: allow to pass actual params to getparam --- src/map/script.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/map/script.c b/src/map/script.c index 75f747fb6..81645b0e1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8568,20 +8568,26 @@ BUILDIN(disableitemuse) BUILDIN(readparam) { int type; struct map_session_data *sd; + struct script_data *data = script_getdata(st, 2); - type=script_getnum(st,2); - if (script_hasdata(st,3)) - sd = script->nick2sd(st, script_getstr(st,3)); - else - sd=script->rid2sd(st); + if (reference_toparam(data)) { + type = reference_getparamtype(data); + } else { + type = script->conv_num(st, data); + } + + if (script_hasdata(st, 3)) { + sd = script->nick2sd(st, script_getstr(st, 3)); + } else { + sd = script->rid2sd(st); + } if (sd == NULL) { - script_pushint(st,-1); + script_pushint(st, -1); return true; } - script_pushint(st,pc->readparam(sd,type)); - + script_pushint(st, pc->readparam(sd, type)); return true; } -- cgit v1.2.3-60-g2f50