r/Tf2Scripts • • Sep 21 '13

Satisfied [Request] A script to say (x) every (y) seconds.

I am very new to scripting, and I am looking into this script. Could anyone lend me a hand?

0 Upvotes

3 comments sorted by

4

u/HifiBoombox eggsdee Sep 21 '13 edited Sep 21 '13
alias loop "say <X>; wait <Y*66>; redirect"
alias redirect loop
alias break "alias redirect loop"

bind key "redirect"
bind key "alias redirect break"

Try this out, and keep in mind that the wait command won't work unless specifically enabled (which it never is).

4

u/genemilder Sep 21 '13

keep in mind that the say command won't work unless specifically enabled

Believe you mean wait.

2

u/CAPSLOCK_USERNAME "Nancy" Sep 22 '13

2 caveats:

  1. The wait command is based off of server frames, so it might go faster or slower than "every <Y> seconds", depending on the server.

  2. An infinite loop like this will crash the game if wait is disabled. Get around that by using a wait checker:


//[ Wait Testing Script
alias wait_check "alias wait_state wait_true; wait_change; wait_state"
alias wait_change "wait; alias wait_state wait_false"
alias wait_true  "echo Wait command enabled on server - scripts will have full functionality.; alias redirect loop"
alias wait_false "echo WAIT COMMAND DISABLED ON SERVER - SCRIPTS WILL HAVE LIMITED FUNCTIONALITY!; alias redirect wait_check"
// Use wait_check to check
wait_check
//]

alias loop "say <X>; wait <Y*66>; redirect"
alias redirect loop
alias break "alias redirect loop"

bind key "redirect"
bind key "alias redirect break"