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(-) 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(