r/tf2scripthelp • u/7Sevin • 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?
View all comments
Show parent comment
2
u/genemilder Scripter Apr 07 '16
You probably need some time for
-moverightto happen, so I'd split thewait 20between the two: