From 4bf3d0470d4cbaef9c11368767ca0be5ad37612a Mon Sep 17 00:00:00 2001 From: gumi Date: Sun, 26 Feb 2017 11:59:43 -0500 Subject: Revert "allow to get vars of other players with getd" This reverts commit eb5fc0076764d2f604e6a484fe144988f6e9da9b. --- doc/script_commands.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 77b361498..ca7ebacca 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -1371,11 +1371,10 @@ Examples: --------------------------------------- -*getd(""{, {, }}) +*getd("") Returns a reference to a variable, the name can be constructed dynamically. -If is present, it can be used to get a variable from another player or -npc. If the target player or npc is not found, is returned. +Refer to setd() for usage. This can also be used to set an array dynamically: setarray(getd(".array[0]"), 1, 2, 3, 4, 5); -- cgit v1.2.3-70-g09d2 From 1b0d3bd8f84db5b471646e0404193759afb908db Mon Sep 17 00:00:00 2001 From: gumi Date: Sun, 26 Feb 2017 12:04:23 -0500 Subject: add getvariableofpc() buildin --- doc/script_commands.txt | 21 ++++++++++++++++++++ src/map/script.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index ca7ebacca..7015feec1 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -1409,6 +1409,27 @@ getvariableofnpc() should not be used on them. --------------------------------------- +*getvariableofpc(, {, }) + +Returns a reference to a PC variable from the target player. +If is passed, it will return this value if the player is +not found. + +Examples: + +//This will return the value of @var, note that this can't be used, since +//the value isn't caught. + getvariableofpc(@var, getcharid(CHAR_ID_ACCOUNT, "player")); + +//This will set the .@v variable to the value of the player's @var +//variable. + .@v = getvariableofpc(@var, getcharid(CHAR_ID_ACCOUNT, "player")); + +//This will set the @var variable of the player to 1. + set(getvariableofpc(@var, getcharid(CHAR_ID_ACCOUNT, "player")), 1); + +--------------------------------------- + *goto(