diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/init.c | 2 | ||||
-rw-r--r-- | src/emap/script.c | 29 |
2 files changed, 6 insertions, 25 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index 73d7928..33405b0 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -99,7 +99,7 @@ HPExport void plugin_init (void) addScriptCommand("requestlang", "", requestLang); addScriptCommand("requestitem", "", requestItem); addScriptCommand("requestitems", "*", requestItems); - addScriptCommand("requestitemindex", "v", requestItemIndex); + addScriptCommand("requestitemindex", "", requestItemIndex); addScriptCommand("requestitemsindex", "v*", requestItemsIndex); addScriptCommand("requestcraft", "*", requestCraft); addScriptCommand("initcraft", "s", initCraft); diff --git a/src/emap/script.c b/src/emap/script.c index 2f853ca..8d5cb44 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -723,28 +723,7 @@ BUILDIN(requestItems) BUILDIN(requestItemIndex) { - getSessionData(client); - struct script_data* data; - int64 uid; - const char* name; - - data = script_getdata(st, 2); - if (!data_isreference(data)) - { - ShowError("script:requestitem: not a variable\n"); - script->reportsrc(st); - st->state = END; - return false; - } - uid = reference_getuid(data); - name = reference_getname(data); - - if (is_string_variable(name)) - { - ShowError("script:requestitemindex: not a variable\n"); - script->reportsrc(st); - return false; - } + getSessionDataReturn(client, -1); if (!sd->state.menu_or_input) { @@ -763,10 +742,11 @@ BUILDIN(requestItemIndex) // take received text/value and store it in the designated variable sd->state.menu_or_input = 0; - int item = 0; + int item = -1; if (!sd->npc_str) { + script_pushint(st, -1); ShowWarning("npc string not found\n"); script->reportsrc(st); return false; @@ -774,12 +754,13 @@ BUILDIN(requestItemIndex) if (sscanf (sd->npc_str, "%5d", &item) < 1) { + script_pushint(st, -1); ShowWarning("input data is not item id\n"); script->reportsrc(st); return false; } - script->set_reg(st, sd, uid, name, (void*)h64BPTRSIZE(item), script_getref(st,2)); + script_pushint(st, item); st->state = RUN; } return true; |