Difference between revisions of "Alt.tf"
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 | + | <P>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.</P> | ||
<P> | <P> | ||
Line 7: | Line 8: | ||
</P> | </P> | ||
<P> | <P> | ||
− | You'll probably want to | + | You'll probably want to change the value of "main_alt" at the beginning of this script. |
</P> | </P> | ||
− | <pre>/echo %% /alt | + | <pre> |
− | /echo %% /alt < | + | ;Bug reports, suggestions and/or diffs are appreciated, '''sulfar''' _AT_ ''inbox'' +DOT+ ''com'' |
− | /echo %% /relog | + | /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 = \ | ||
− | + | /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 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 = \ |
− | ; | + | /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%; \ | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
/endif%; \ | /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 | ||
+ | |||
</pre> | </pre> | ||
− | |||
[[Category: TinyFugue Scripting]] | [[Category: TinyFugue Scripting]] |
Revision as of 04: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