Difference between revisions of "Alt.tf"

From AvatarWiki
Jump to navigation Jump to search
 
(changing trigger to disconnect hook speeds up switching alts)
Line 34: Line 34:
 
/def -i relog = /alt ${world_name}
 
/def -i relog = /alt ${world_name}
  
/def -i -p999 -F -E(get_alt) -t"Leaving the AVATAR System for the 'real world'..." leaving_avatar = \
+
/def -i -p999 -F -E(get_alt) -h'disconnect' leaving_avatar= \
;;I'm delaying the login to make sure the tcp socket dies out,
+
         /world %{alt}%;\
;; which is an issue with the modified /world below...
 
         /repeat -0.8 1 /world %{alt}%;\
 
 
         /set get_alt 0%;\
 
         /set get_alt 0%;\
 
         /set alt=
 
         /set alt=

Revision as of 19:13, 16 September 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

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

You'll probably want to edit line 6 of this script ;)

/echo %% /alt               (Logout and) login %main_alt
/echo %% /alt <world>       (Logout and) login <world>
/echo %% /relog             Logout and login current character

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

/set get_alt 0
/set alt=

;;Quick, easy and safe alt switching
/def -i alt = \
    /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=

;;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