changeset 1296:5dbfd9e3703d

Use /grepeat to kill the delayed organ extracting from can if potion mixing is interrupted or fails due to missing components etc.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 13 Jan 2011 22:21:08 +0000
parents ede339f380c9
children f40a79cce816
files gm-alchemist.tf
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gm-alchemist.tf	Thu Jan 13 01:19:32 2011 +0000
+++ b/gm-alchemist.tf	Thu Jan 13 22:21:08 2011 +0000
@@ -1,6 +1,6 @@
 ;;
 ;; GgrTF::Alchemist - Alchemist guild support and utility macros
-;; (C) Copyright 2010 Matti Hämäläinen (Ggr)
+;; (C) Copyright 2010-2011 Matti Hämäläinen (Ggr)
 ;;
 ;; This file (triggerset) is Free Software distributed under
 ;; GNU General Public License version 2.
@@ -113,18 +113,22 @@
 	/set alch_can=$(/galch_get_item %{alch_organ} %{galch_cans})%;\
 	/if (alch_can!~"")\
 		/msq Get '%{alch_organ}' from can '%{alch_can}'%;\
-		/repeat -14 1 /galch_get_organ%;\
 	/else \
 		/msq No matching can for organ '%{alch_organ}'.%;\
+		/let _error=1%;\
 	/endif%;\
 	/set alch_jar=$(/galch_get_item %{alch_herb} %{galch_jars})%;\
 	/if (alch_jar!~"")\
 		/msq Get '%{alch_herb}' from jar '%{alch_jar}'%;\
-		@@get %{alch_herb} from %{alch_jar}%;\
 	/else \
 		/msq No matching jar for herb '%{alch_herb}'.%;\
+		/let _error=1%;\
 	/endif%;\
+	/if (_error) /break%;/endif%;\
 	/set alch_st=1%;\
+	@@get %{alch_herb} from %{alch_jar}%;\
+	/set alch_process=$(/grepeat -14 1 /galch_get_organ)%;\
+	/msq PS=%{alch_process}%;\
 	/msq Mixing potion from '%{alch_mineral}', '%{alch_organ}' and '%{alch_herb}'...%;\
 	@@use mix potion at flask use %{alch_mineral} %{alch_organ} %{alch_herb}
 
@@ -142,7 +146,8 @@
 
 /def -i galch_return =\
 	/set alch_st=0%;\
-	/if (alch_can!~"" & alch_organ!~"" & alch_hasorgan)\
+	/kill %{alch_process}%;\
+	/if (alch_hasorgan)\
 		/set alch_hasorgan=0%;\
 		/msq Returning '%{alch_organ}' in can '%{alch_can}'%;\
 		@@put %{alch_organ} in %{alch_can}%;\
@@ -153,7 +158,7 @@
 	/endif
 
 
-/gdef -i -msimple -aBCred -t"You need a prepared alchemist's flask first." galch_need_flask =\
+/gdef -i -msimple -Ealch_st -aBCred -t"You need a prepared alchemist's flask first." galch_need_flask =\
 	/galch_return
 
 
@@ -172,6 +177,7 @@
 /gdef -i -F -aBCwhite -mregexp -t"^You mix the ingredients together and wait for the contents settle. A flask containing" galch_flask_ready =\
 	/set alch_st=0%;\
 	/set alch_close=0%;\
+	/set alch_hasorgan=0%;\
 	/if (alch_submit)\
 		/set alch_submit=0%;\
 		@@submit flask%;\