summaryrefslogtreecommitdiff
path: root/npc/magic/config.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/magic/config.txt')
-rw-r--r--npc/magic/config.txt21
1 files changed, 21 insertions, 0 deletions
diff --git a/npc/magic/config.txt b/npc/magic/config.txt
index a179982c..2a6a9559 100644
--- a/npc/magic/config.txt
+++ b/npc/magic/config.txt
@@ -401,6 +401,27 @@ function script mcharge {
return;
}
+// transcheck( {item 1, amount 1}, {item 2, amount 2}... )
+// returns true upon success
+function script transcheck {
+ if (getargcount() < 2 || getargcount() % 2 != 0)
+ return Exception("Faulty transcheck invoked - error");
+
+ // Count items
+ for (.@i=0;.@i < getargcount(); .@i++) {
+ if (countitem(getarg(.@i)) < getarg(.@i+1))
+ return false;
+ .@i++;
+ }
+
+ // Delete Items
+ for (.@i=0;.@i < getargcount(); .@i++) {
+ delitem getarg(.@i), getarg(.@i+1);
+ .@i++;
+ }
+ return true;
+}
+
- script Magic Load NPC_HIDDEN,{
OnInit:
end;