Difference between revisions of "Alt.tf"

From AvatarWiki
Jump to navigation Jump to search
(changing trigger to disconnect hook speeds up switching alts)
(adds -x<command> option)
Line 1: Line 1:
<P>This script provides <br>
+
<P>This script provides
> quick, easy and safe alt switching<br>
+
* quick, easy and safe alt switching
> a modified /world (stdlib.tf) which will not connect if tf has an active connection</P>
+
* a modified /world (stdlib.tf) which will not connect if tf has an active connection
 +
* you can use /alt -x<command> <alt>  to log in <alt> and have <command> executed 8 seconds after the alt logged in.</P>
  
 
<P>
 
<P>
Line 7: Line 8:
 
</P>
 
</P>
 
<P>
 
<P>
You'll probably want to edit line 6 of this script ;)
+
You'll probably want to change the value of "main_alt" at the beginning of this script.
 
</P>
 
</P>
<pre>/echo %% /alt               (Logout and) login %main_alt
+
<pre>
/echo %% /alt <world>       (Logout and) login <world>
+
;Bug reports, suggestions and/or diffs are appreciated, '''sulfar''' _AT_ ''inbox'' +DOT+ ''com''
/echo %% /relog             Logout and login current character
+
/loaded __SULFAR__/alt.tf
 +
 
 +
/echo -aCyellow %% /alt                 (Logout and) login %{main_alt}
 +
/echo -aCyellow %% /alt <worldname>     (Logout and) login <worldname>
 +
/echo -aCred %%    [-x<command>]            execute <command> 8 sec. after alt switch
 +
/echo -aCyellow %% /relog               (Logout and) login current worldname
  
 
;Set this variable to your main alt
 
;Set this variable to your main alt
 
/set main_alt sulfar
 
/set main_alt sulfar
  
/set get_alt 0
+
/def alt_init = \
/set alt=
+
        /set get_alt 0%;\
 +
        /set alt=%;\
 +
        /set alt_post=%;\
 +
        /set alt_execute_post=
  
 
;;Quick, easy and safe alt switching
 
;;Quick, easy and safe alt switching
 
/def -i alt = \
 
/def -i alt = \
    /set alt %*%;\
+
        /alt_init%;\
    /if (alt =~ "") /set alt %{main_alt}%;/endif%;\
+
        /if (!getopts("x:", "")) /return 0%; /endif%; \
    /if (is_open())\
+
        /if (opt_x !~ "") \
        /set get_alt 1%;\
+
                /set alt_post %{opt_x}%;\
        quit%;\
+
                /set alt_execute_post 1%;\
    /else \
+
        /else \
        /world %{alt}%;\
+
                /set alt_post=%;\
        /set get_alt 0%;\
+
                /set alt_execute_post 0%;\
        /set alt=%;\
+
        /endif%;\
    /endif
+
        /set alt %*%;\
 +
        /if (alt =~ "") /set alt %{main_alt}%;/endif%;\
 +
        /if (is_open())\
 +
                /set get_alt 1%;\
 +
                quit%;\
 +
        /else \  
 +
                /world %{alt}%;\
 +
                /set get_alt 0%;\
 +
                /set alt=%;\
 +
        /endif
  
 
/def -i relog = /alt ${world_name}
 
/def -i relog = /alt ${world_name}
Line 39: Line 57:
 
         /set alt=
 
         /set alt=
  
;;To avoid multiplay accidents, this modified /world (stdlib.tf) will not
+
/def -i -E(alt_execute_post) -p999 -F -t"Welcome back to the AVATAR System, *" alt_execute_post = \
;; connect if tf has an active connection
+
        /let post %alt_post%;\
 +
        /alt_init%;\
 +
        /echo -aCcyan %%% /%0: Alt switch ready!  Executing command: %post%;\
 +
        /if (post !~ "") /eval -s0 /repeat -8 1 %{post}%; /endif
 +
 
 +
;To avoid multiplay accidents, this modified /world (stdlib.tf) will not
 +
; connect if tf has an active connection
 
/def -i world = \
 
/def -i world = \
    /if (!getopts("nlqxfb", 0)) /return 0%; \
+
        /if (!getopts("nlqxfb", 0)) /return 0%; \
    /endif%; \
 
    /let _args=%*%; \
 
    /if (_args =~ "") \
 
        /let _args=$(/nth 1 $(/@listworlds -s))%; \
 
        /if (_args =/ "default") \
 
            /let _args=$(/nth 2 $(/@listworlds -s))%; \
 
 
         /endif%; \
 
         /endif%; \
    /endif%; \
+
        /let _args=%*%; \
    /let _opts=%; \
+
        /if (_args =~ "") \
    /if (is_open(_args)) \
+
                /let _args=$(/nth 1 $(/@listworlds -s))%; \
        /if (opt_n) /let _opts=%_opts -n%; /endif%; \
+
                /if (_args =/ "default") \
        /if (opt_q) /let _opts=%_opts -q%; /endif%; \
+
                        /let _args=$(/nth 2 $(/@listworlds -s))%; \
        /@fg %_opts %_args%; \
+
                /endif%; \
    /elseif (is_open())\  
+
        /endif%; \
        /echo %% But you *are* connected!%;\
+
        /let _opts=%; \
    /else \  
+
        /if (is_open(_args)) \
        /if (opt_l) /let _opts=%_opts -l%; /endif%; \
+
                /if (opt_n) /let _opts=%_opts -n%; /endif%; \
        /if (opt_q) /let _opts=%_opts -q%; /endif%; \
+
                /if (opt_q) /let _opts=%_opts -q%; /endif%; \
        /if (opt_x) /let _opts=%_opts -x%; /endif%; \
+
                /@fg %_opts %_args%; \
        /if (opt_f) /let _opts=%_opts -f%; /endif%; \
+
        /elseif (is_open())\
        /if (opt_b) /let _opts=%_opts -b%; /endif%; \
+
                /echo %% But you *are* connected!%;\
        /@connect %_opts %_args%; \
+
        /else \
    /endif
+
                /if (opt_l) /let _opts=%_opts -l%; /endif%; \
 +
                /if (opt_q) /let _opts=%_opts -q%; /endif%; \
 +
                /if (opt_x) /let _opts=%_opts -x%; /endif%; \
 +
                /if (opt_f) /let _opts=%_opts -f%; /endif%; \
 +
                /if (opt_b) /let _opts=%_opts -b%; /endif%; \
 +
                /@connect %_opts %_args%; \
 +
        /endif
 +
 
  
 
</pre>
 
</pre>
 
  
 
[[Category: TinyFugue Scripting]]
 
[[Category: TinyFugue Scripting]]

Revision as of 05:13, 11 October 2008

This script provides

  • quick, easy and safe alt switching
  • a modified /world (stdlib.tf) which will not connect if tf has an active connection
  • you can use /alt -x<command> <alt> to log in <alt> and have <command> executed 8 seconds after the alt logged in.

Bug reports, suggestions and/or diffs are appreciated, sulfar _AT_ inbox +DOT+ com

You'll probably want to change the value of "main_alt" at the beginning of this script.

;Bug reports, suggestions and/or diffs are appreciated, '''sulfar''' _AT_ ''inbox'' +DOT+ ''com''
/loaded __SULFAR__/alt.tf

/echo -aCyellow %% /alt                  (Logout and) login %{main_alt}
/echo -aCyellow %% /alt <worldname>      (Logout and) login <worldname>
/echo -aCred %%     [-x<command>]            execute <command> 8 sec. after alt switch
/echo -aCyellow %% /relog                (Logout and) login current worldname

;Set this variable to your main alt
/set main_alt sulfar

/def alt_init = \
        /set get_alt 0%;\
        /set alt=%;\
        /set alt_post=%;\
        /set alt_execute_post=

;;Quick, easy and safe alt switching
/def -i alt = \
        /alt_init%;\
        /if (!getopts("x:", "")) /return 0%; /endif%; \
        /if (opt_x !~ "") \
                /set alt_post %{opt_x}%;\
                /set alt_execute_post 1%;\
        /else \
                /set alt_post=%;\
                /set alt_execute_post 0%;\
        /endif%;\
        /set alt %*%;\
        /if (alt =~ "") /set alt %{main_alt}%;/endif%;\
        /if (is_open())\
                /set get_alt 1%;\
                quit%;\
        /else \ 
                /world %{alt}%;\
                /set get_alt 0%;\
                /set alt=%;\
        /endif

/def -i relog = /alt ${world_name}

/def -i -p999 -F -E(get_alt) -h'disconnect' leaving_avatar= \
        /world %{alt}%;\
        /set get_alt 0%;\
        /set alt=

/def -i -E(alt_execute_post) -p999 -F -t"Welcome back to the AVATAR System, *" alt_execute_post = \
        /let post %alt_post%;\
        /alt_init%;\
        /echo -aCcyan %%% /%0: Alt switch ready!  Executing command: %post%;\
        /if (post !~ "") /eval -s0 /repeat -8 1 %{post}%; /endif

;To avoid multiplay accidents, this modified /world (stdlib.tf) will not
;  connect if tf has an active connection
/def -i world = \
        /if (!getopts("nlqxfb", 0)) /return 0%; \
        /endif%; \
        /let _args=%*%; \
        /if (_args =~ "") \
                /let _args=$(/nth 1 $(/@listworlds -s))%; \
                /if (_args =/ "default") \
                        /let _args=$(/nth 2 $(/@listworlds -s))%; \
                /endif%; \
        /endif%; \
        /let _opts=%; \
        /if (is_open(_args)) \
                /if (opt_n) /let _opts=%_opts -n%; /endif%; \
                /if (opt_q) /let _opts=%_opts -q%; /endif%; \
                /@fg %_opts %_args%; \
        /elseif (is_open())\
                /echo %% But you *are* connected!%;\
        /else \
                /if (opt_l) /let _opts=%_opts -l%; /endif%; \
                /if (opt_q) /let _opts=%_opts -q%; /endif%; \
                /if (opt_x) /let _opts=%_opts -x%; /endif%; \
                /if (opt_f) /let _opts=%_opts -f%; /endif%; \
                /if (opt_b) /let _opts=%_opts -b%; /endif%; \
                /@connect %_opts %_args%; \
        /endif