changeset 69:e8a24520d8d8 misc

Added TF script for half-automatizing copying and giving/sending of waypoint maps to someone else.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 10 Mar 2010 12:12:07 +0000
parents 482f975d51ea
children 56c00d32d570
files ship_maps.tf
diffstat 1 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ship_maps.tf	Wed Mar 10 12:12:07 2010 +0000
@@ -0,0 +1,48 @@
+;; TinyFugure script for semi-automatically copying and sending waypoint
+;; maps to another ship. Requires TF 5.0 beta 7 or later.
+;; (C) Copyright 2009-2010 Matti 'ccr' Hämäläinen <ccr@tnsp.org>
+;;
+;; Usage: Start with "/setship destination_ship_name"
+;; to set name of the destination ship where copied maps will be sent.
+;;
+;; Then "/cmap mapname" to make a copy of given map and send it.
+;;
+;; NOTICE! If map copying fails, the script will automatically retry!
+;; Make sure you have enough empty map scrolls available.
+;;
+
+/def -i -aBCred -mregexp -t"tells you 'ARGH! I can't believe" copymap_fail =\
+	/repeat -1 1 /copymap_copy
+
+/def -i -aBCgreen -mregexp -t"tells you 'Easy as pie, Captain.'" copymap_ok =\
+	/repeat -1 1 /copymap_finish
+
+/def -i -aBCred -mregexp -t"advises you 'That ship already has a map by that name, Captain.'" sendmap_has =\
+	/echo -p @{BCyellow}Destination had that map, destroying copy.@{n}%;\
+	/test send(strcat("@@bookcase remove ",tmpmap))
+
+/def -i copymap_copy =\
+	/echo -p @{BCyellow}Trying to copy map '%{tmpmap}' to '%{copymap}' ...@{n}%;\
+	/test send(strcat("@@bookcase copy ",tmpmap," ",copymap))
+
+/def -i copymap_finish =\
+	/echo -p @{BCyellow}Sending '%{copymap}' to '%{targetship}'.@{n}%;\
+	/test send(strcat("@@bookcase give ",copymap," ",targetship))%;\
+	/test send(strcat("@@bookcase rename ",tmpmap," ",copymap))
+
+/def -i cmap =\
+	/set copymap=%{1}%;\
+	/set tmpmap=tmpmap%;\
+	/echo -p @{BCwhite}Copying@{n} '@{BCgreen}%{copymap}@{n}' ...%;\
+	/echo -p @{BCyellow}Temporarily renaming '%{copymap}' to '%{tmpmap}'.@{n}%;\
+	/test send(strcat("@@bookcase rename ",copymap," ",tmpmap))%;\
+	/copymap_copy
+
+/def -i setship =\
+	/if ({#} > 0)\
+		/set targetship=%{1}%;\
+		/echo -p @{BCwhite}Setting target ship to@{n} '@{BCgreen}%{targetship}@{n}' ...%;\
+		/echo -p Now use @{BCwhite}/cmap mapname@{n}%;\
+	/else \
+		/echo -p @{BCred}No ship name given!@{n} Use '/setship targetshipfoobar'.%;\
+	/endif