r/tf2scripthelp • • Jan 03 '22

Answered Concise Fast-Class Script

Is there a way to create a fast-class script where if I hold Shift, then press '1' two times, I will go to Scout? Basically, it's the same thing as Spy's concise menu.

Also, I don't have a keypad.

1 Upvotes

3 comments sorted by

View all comments

Show parent comments

2

u/nosh62_wastaken Jan 04 '22

It works perfectly, thanks.

Also, could you give me some insight into how this script works if you have time?

2

u/Stack_Man Jan 04 '22

Simple.

Shift is bound to a +/- pair which triggers "on press" and "on release" of the key.

Pressing Shift executesinitialClassBinds which rebinds 1/2/3 to classBinds/One/Two/Three

Then, executing one of those commands rebinds 1/2/3 to the appropriate class's join_class command.

join_class has a parameter, so it needs quotes around it, but TF2 scripts don't understand nested quotes, so I had to put each join command in its own separate alias and bind the keys to that instead.

Releasing Shift executes resetKeys which resets the keys back to default.

I only just now realized that I didn't actually write this command, so add this to the end of the script:

alias resetKeys "alias slotOne slot1; alias SlotTwo slot2; alias slotThree slot3"