changeset 1281:aeba72213167

Various improvements in error and other unexpected situation handling (skill interrupted, etc.)
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 25 Dec 2010 22:47:37 +0000
parents d05c134cdddc
children d4717f14a9f8
files gm-alchemist.tf
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gm-alchemist.tf	Sat Dec 25 19:55:08 2010 +0000
+++ b/gm-alchemist.tf	Sat Dec 25 22:47:37 2010 +0000
@@ -107,7 +107,7 @@
 	/set alch_can=$(/galch_get_item %{alch_organ} %{galch_cans})%;\
 	/if (alch_can!~"")\
 		/msq Get '%{alch_organ}' from can '%{alch_can}'%;\
-		/repeat -14 1 @@get %{alch_organ} from %{alch_can}%;\
+		/repeat -14 1 /galch_get_organ%;\
 	/else \
 		/msq No matching can for organ '%{alch_organ}'.%;\
 	/endif%;\
@@ -123,9 +123,16 @@
 	@@use mix potion at flask use %{alch_mineral} %{alch_organ} %{alch_herb}
 
 
+/def -i galch_get_organ =\
+	/if (alch_st)\
+		/set alch_hasorgan=1%;\
+		@@get %{alch_organ} from %{alch_can}%;\
+	/endif
+
 /def -i galch_return =\
 	/set alch_st=0%;\
-	/if (alch_can!~"" & alch_organ!~"")\
+	/if (alch_can!~"" & alch_organ!~"" & alch_hasorgan)\
+		/set alch_hasorgan=0%;\
 		/msq Returning '%{alch_organ}' in can '%{alch_can}'%;\
 		@@put %{alch_organ} in %{alch_can}%;\
 	/endif%;\
@@ -138,14 +145,17 @@
 /gdef -i -msimple -aBCred -t"You need a prepared alchemist's flask first." galch_need_flask =\
 	/galch_return
 
-/gdef -i -mregexp -Ealch_st -aBCred -t"^ \.\. but you do not seem to have any '([a-z ]+)' on you\.$" galch_has_no1 =\
+
+/gdef -i -mregexp -Ealch_st -aBCred -t"^You do not seem to have any '([a-z ]+)' on you\.$" galch_has_no1 =\
 	/galch_return
 
-/gdef -i -mregexp -Ealch_st -aBCred -t"^You do not seem to have any '([a-z ]+)' on you\.$" galch_has_no2 =\
+/gdef -i -mregexp -Ealch_st -aBCred -t"^ \.\. but you do not (seem to have any '[a-z ]+' on you\.|have enough '[a-z ]+' left\.)" galch_has_no2 =\
 	/galch_return
 
-/gdef -i -mregexp -Ealch_st -aBCred -t"^ \.\. but you do not have enough '([a-z ]+)' left\.$" galch_has_no3 =\
-	/galch_return
+/def -i galch_interrupted =\
+	/if (alch_st) /galch_return%;/endif
+
+/test prlist_insert("event_skill_intr", "galch_interrupted")
 
 
 /gdef -i -F -aBCwhite -mregexp -t"^You mix the ingredients together and wait for the contents settle. A flask containing" galch_flask_ready =\
@@ -209,7 +219,7 @@
 ;; Store herb into proper jar
 /def -i galch_store_herb =\
 	/let _herb=%{1}%;\
-	/if (regmatch("^(light green|white|orange|red|blue|green|yellow|head of|orange|brown) ([a-z]+)", _herb))\
+	/if (regmatch("^(purplish|light green|white|orange|red|blue|green|yellow|head of|orange|brown) ([a-z]+)", _herb))\
 		/let _herb=%{P2}%;\
 	/endif%;\
 	/let _jar=$(/galch_get_item %{_herb} %{galch_jars})%;\
@@ -243,3 +253,4 @@
 			/msq No match for '%{_item}'.%;\
 		/endif%;\
 	/endif
+