diff options
author | Reid <reidyaro@gmail.com> | 2016-04-11 04:00:13 +0200 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2016-04-11 04:00:13 +0200 |
commit | 8c27b1488a93ef3c3fdcaf019931d0e6c4c64e70 (patch) | |
tree | 4616f6775146d90b96b44257484554b5488c2979 /npc/functions | |
parent | b0af0f82b3760d086852c94d011d3dcab87cf053 (diff) | |
download | serverdata-8c27b1488a93ef3c3fdcaf019931d0e6c4c64e70.tar.gz serverdata-8c27b1488a93ef3c3fdcaf019931d0e6c4c64e70.tar.bz2 serverdata-8c27b1488a93ef3c3fdcaf019931d0e6c4c64e70.tar.xz serverdata-8c27b1488a93ef3c3fdcaf019931d0e6c4c64e70.zip |
Add compareandsetq function, it compares a given quest variable's value with the current one, if both vals are equals, it sets the variable with a new value.
Diffstat (limited to 'npc/functions')
-rw-r--r-- | npc/functions/main.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt index f2dad770..420f2b79 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -172,3 +172,16 @@ function script askyesno { return select (menuaction(l("Yes")), menuaction(l("No"))); } + +// Argument: +// 0 Quest variable +// 1 Current value +// 2 Next value +function script compareandsetq { + if (getq (getarg(0)) == getarg(1)) + { + setq getarg(0), getarg(2); + return true; + } + return false; +} |