changeset 1303:eee2595609ab

Add /wconget macro and 'wget' command alias. Change the code how container automatic get/put is handled.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 17 Jan 2011 03:26:10 +0200
parents cde14bd45f91
children 588d9dac9107
files gm-alchemist.tf
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gm-alchemist.tf	Mon Jan 17 03:25:24 2011 +0200
+++ b/gm-alchemist.tf	Mon Jan 17 03:26:10 2011 +0200
@@ -283,7 +283,9 @@
 
 
 ;; Automatically put item into a container containing specified type of herb or organ
-/def -i wconput =\
+/def -i galch_container_cmd =\
+	/let _cmd=%{1}%;/shift%;\
+	/let _arg=%{1}%;/shift%;\
 	/if (regmatch("^([0-9]+|all)$", {1}))\
 		/let _count=%{1}%;\
 		/shift%;\
@@ -292,20 +294,24 @@
 	/endif%;\
 	/let _item=$[galch_herb_fixes({*})]%;\
 	/if (_count!~"")\
-		/let _cmd=%{_count} %{_item}%;\
+		/let _tgt=%{_count} %{_item}%;\
 	/else \
-		/let _cmd=%{_item}%;\
+		/let _tgt=%{_item}%;\
 	/endif%;\
 	/let _cont=$(/galch_get_item %{_item} %{galch_jars})%;\
 	/if (_cont!~"")\
-		@@put %{_cmd} in %{_cont}%;\
+		@@%{_cmd} %{_tgt} %{_arg} %{_cont}%;\
 	/else \
 		/let _cont=$(/galch_get_item %{_item} %{galch_cans})%;\
 		/if (_cont!~"")\
-			@@put %{_cmd} in %{_cont}%;\
+			@@%{_cmd} %{_tgt} %{_arg} %{_cont}%;\
 		/else \
 			/msq No match for '%{_item}'.%;\
 		/endif%;\
 	/endif
 
+/def -i wconput = /galch_container_cmd put in %{*}
 /prdefgbind -s"wput" -c"/wconput"
+
+/def -i wconget = /galch_container_cmd get from %{*}
+/prdefgbind -s"wget" -c"/wconget"