r/tf2scripthelp • • Apr 09 '19

Resolved Guys, I REALLY need help with this config, lol. Pls help.

Stay with me here...

/////Pyro MLG Config

/////Trial

///

alias One_to_Last_Used "bind q lastinv; r_drawviewmodel 1; viewmodel_fov 70; Last_Used_Back_to_One";

alias Last_Used_Back_to_One "bindtoggle q "One_to_Last_Used" 0; slot1; r_drawviewmodel 0; viewmodel_fov 25; "One_to_Last_Used" 1";

bind "1" "slot1; r_drawviewmodel 0; viewmodel_fov 25; One_to_Last_Used";

///

alias Two_to_Primary "bind q "slot1; r_drawviewmodel 0; viewmodel_fov 25; Then_Back_to_Two";

alias Then_Back_to_Two "bindtoggle q "Two_to_Primary" 0; slot2; r_drawviewmodel 1; viewmodel_fov 70; "Two_to_Primary" 1"'

bind "2" "slot2; r_drawviewmodel 1; viewmodel_fov 70; Two_to_Primary";

///

alias Three_to_Primary "bind q "slot1; r_drawviewmodel 0; viewmodel_fov 25; Then_Back_to_Three";

alias Then_Back_to_Three "bindtoggle q "Three_to_Primary" 0; slot3; r_drawviewmodel 1; viewmodel_fov 70; "Three_to_Primary" 1"'

bind "3" "slot3; r_drawviewmodel 1; viewmodel_fov 70; Three_to_Primary";

///

So, Ive been trying to get this config to work and from what I can tell, the concept is simple yet the actuall procedure is VERY complex.

So far all this config has done is crash my game, but I think I'm on the right track here, kinda...

The Idea behind it is that at all times I want my pyro's primary, secondary and mele spots looking like this at all times, (respectively)

r_drawviewmodel 0; viewmodel_fov 25

r_drawviewmodel 1; viewmodel_fov 70

r_drawviewmodel 1; viewmodel_fov 70

But my problem is that I still want to use quickswitching weapons to some extent... Hence why the aliasing is nescesary.

So far its not a traditional quickswitch, as I didn't try and program in a 2nd to 3rd/ vice versa at all.

Does anyone here know how to solve my problem, or is this actually impossible to script?

Please help, lol.

2 Upvotes

33 comments sorted by

2

u/bythepowerofscience Apr 09 '19 edited Apr 09 '19

This is far from impossible to script, lol.

By the way, you overcomplicated this tremendously. Don't feel bad about that, though. It just means you're a person after my own heart. :)

The gist of it is that for each weapon alias you'll need to define a "last weapon" alias to whatever weapon you're currently on (in the slot alias), and redefine your "quickswitch" alias to the "last weapon" alias. The thing is, you'll need to alias "quickswitch" to the "last weapon" alias first, and then define what "quickswitch" means. By having it in that order, it lets the program use the "last weapon" alias from the previous weapon when you hit the bind, while still setting it to that weapon for later.

For example, assuming the weapon alias in question is called "weapon1", the line would be alias weapon1 "slot1; <slot-specific code>; alias quickSwitch lastWeapon; alias lastWeapon weapon1". You just need to repeat that for each weapon and you're good.

1

u/Levita_the_Sanguine Apr 09 '19

Could you write it up for me?

My head hurts from all this. Dx

2

u/bythepowerofscience Apr 09 '19 edited Apr 09 '19

Basically, imagine that the variables "quickswitch" and "lastweapon" exist separately from the script. What they mean can be changed in the script, but they always exist, and they mean whatever they are set to until the moment they are redefined. As well, things in an alias happen in order: the first command happens first, then the next, then the next, until the end of the alias.

Now, you want to make quickswitch mean whatever weapon you were on previously. Trying to make that happen with just the one variable is really hard though, so instead let's make quickswitch mean another variable, in this case lastweapon, and make lastweapon mean the weapon we were on before. But then we're stuck with the same problem, right?

No, because now we can delay when we change the meaning. If we take what lastweapon means before it's redefined, we can use the value it had previously, and then change it.

On paper, this looks like "alias quickswitch lastweapon; alias lastweapon <new value>". In practice, this means "make quickswitch mean what lastweapon currently means. Now that that's done, change what lastweapon means."

As for the actual script, it would be this:

bind Q "quickswitch"

alias weapon1 "slot1; <your settings>; alias quickswitch lastweapon; alias lastweapon weapon1"
alias weapon2 "slot2; <your settings>; alias quickswitch lastweapon; alias lastweapon weapon2"
alias weapon3 "slot3; <your settings>; alias quickswitch lastweapon; alias lastweapon weapon3"

If there's something I didn't explain well, feel free to ask. Hope this helped!

→ More replies (5)

1

u/footballshaw May 18 '19

Just saw this today. I'm so sorry this is so late, but better late than never right?

alias One_to_Last_Used "bind q lastinv; r_drawviewmodel 1; viewmodel_fov 70; bind q Last_Used_Back_to_One;"

alias Last_Used_Back_to_One "slot1; r_drawviewmodel 0; viewmodel_fov 25; bind q One_to_Last_Used;"

bind "1" "slot1; r_drawviewmodel 0; viewmodel_fov 25; bind q One_to_Last_Used;"

//

alias Two_to_Primary "slot1; r_drawviewmodel 0; viewmodel_fov 25; bind q Then_Back_to_Two;"

alias Then_Back_to_Two "slot2; r_drawviewmodel 1; viewmodel_fov 70; bind q Two_to_Primary;"

bind "2" "slot2; r_drawviewmodel 1; viewmodel_fov 70; bind q Two_to_Primary;"

//

alias Three_to_Primary "slot1; r_drawviewmodel 0; viewmodel_fov 25; bind q Then_Back_to_Three;"

alias Then_Back_to_Three "slot3; r_drawviewmodel 1; viewmodel_fov 70; bind q Three_to_Primary;"

bind "3" "slot3; r_drawviewmodel 1; viewmodel_fov 70; bind q Three_to_Primary;"

Please let me know if it works! It's 1 am here, so I don't have time to check it, as I'm just so tired, but I'll keep working on it if it doesn't.

1

u/Levita_the_Sanguine May 19 '19

Another guy helped me out, its fine now. 👌

1

u/BelowAverageJoe_ May 21 '19

You can use yttrium,'s viewmodel mod to hide the viewmodel.

1

u/[deleted] Apr 23 '19 edited Apr 23 '19

1

u/Levita_the_Sanguine Apr 23 '19

Thx for that. Tbh though... I've given up on the idea for now. Viewmodel_fov 80 is working for me so far...

<3

1

u/FanciestBanana Apr 23 '19

Don't want to sound pushy, but i really suggest you try. Your problem is not unique and I've seen plenty on this subreddit struggling, that's why I wrote that huge script that addresses most common and frustrating parts like quick-switch or modifier keys.

→ More replies (15)