changeset 1293:5fbe9210c31c

Added /wconput macro (and command alias 'wput') for putting any alchemist herb or organ into the specific container. The macro also supports item count and "all" syntaxes, e.g. "/wconput all liver" or "/wconput 9 apple".
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 09 Jan 2011 01:47:45 +0000
parents f8dc10690790
children 4986500d464c
files gm-alchemist.tf
diffstat 1 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gm-alchemist.tf	Mon Jan 03 11:21:13 2011 +0000
+++ b/gm-alchemist.tf	Sun Jan 09 01:47:45 2011 +0000
@@ -13,7 +13,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; General settings and data
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-/eval /set galch_file=%{HOME}/public_html/alch/herb.txt
+/eval /set galch_file=%{HOME}/public_html/alch/results.txt
 
 
 /set galch_cans=\
@@ -269,3 +269,32 @@
 	/endif
 
 /prdefgbind -s"wla" -c"/wconlook"
+
+
+;; Automatically put item into a container containing specified type of herb or organ
+/def -i wconput =\
+	/if (regmatch("^([0-9]+|all)$", {1}))\
+		/let _count=%{1}%;\
+		/shift%;\
+	/else \
+		/let _count=%;\
+	/endif%;\
+	/let _item=$[galch_herb_fixes({*})]%;\
+	/if (_count!~"")\
+		/let _cmd=%{_count} %{_item}%;\
+	/else \
+		/let _cmd=%{_item}%;\
+	/endif%;\
+	/let _cont=$(/galch_get_item %{_item} %{galch_jars})%;\
+	/if (_cont!~"")\
+		@@put %{_cmd} in %{_cont}%;\
+	/else \
+		/let _cont=$(/galch_get_item %{_item} %{galch_cans})%;\
+		/if (_cont!~"")\
+			@@put %{_cmd} in %{_cont}%;\
+		/else \
+			/msq No match for '%{_item}'.%;\
+		/endif%;\
+	/endif
+
+/prdefgbind -s"wput" -c"/wconput"