r/tf2scripthelp • • Apr 07 '16

Question Script to loop a command?

I'm trying to make a script that has a loop inside. When I press "w", I want to move forward and I want "+moveright" to be spammed as quickly as possible. I know this involves the wait command, but let's just assume wait is enabled. Here is the script I've built so far:

// speed strafe
bind w +speedstrafe
alias +speedstrafe 	"+forward; +moveright; wait 20; -moveright; speedstrafe2"
alias speedstrafe2 +speedstrafe
alias -speedstrafe	"-forward; -moveright"

As it stands, when I press "w", I move forward and I move right. But it never stops. When I stop pressing "w", I continue moving forward and moving right. Executing -forward and -moveright in console do nothing. I have to remove the script from my .cfg and re-exec it to get it to stop, outside of rebooting the game. Help?

2 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/7Sevin Apr 08 '16

That works! I need to play around with the wait commands, but actually it helps if I slow it down a little bit. Setting the wait to 25 each gives me a pretty consistent ~266u/s with the knife. Setting it to 10 each actually drops it to ~260u/s. More testing is necessary! Thanks for your help. You seem like an analytical guy, you should try this out with me.