Upvote Upvoted 6 Downvote Downvoted
Alias based lastinv
posted in Customization
1
#1
4 Frags +

EDIT: I finally got around to rewriting this script, it is acually readable and more usable.
EDIT2: Emulated default scroll wheel item switching, and added view model aliases for ease of use.

alias view1 "slot1; r_drawviewmodel 1"
alias view2 "slot2; r_drawviewmodel 1"
alias view3 "slot3; r_drawviewmodel 1"

bind MWHEELUP "prevslot"
bind MWHEELDOWN "nextslot"

bind q "lastslot"

bind 1 @slot1
bind 2 @slot2
bind 3 @slot3

alias push0 ""
alias push1 ""

alias @slot1 "view1; push0; push1; alias push0 stack1; alias nextslot @slot2; alias prevslot @slot3"
alias @slot2 "view2; push0; push1; alias push0 stack2; alias nextslot @slot3; alias prevslot @slot1"
alias @slot3 "view3; push0; push1; alias push0 stack3; alias nextslot @slot1; alias prevslot @slot2"

alias stack1 "alias push1 pop1"
alias stack2 "alias push1 pop2" 
alias stack3 "alias push1 pop3" 

alias pop1 "alias lastslot @slot1"
alias pop2 "alias lastslot @slot2"
alias pop3 "alias lastslot @slot3"

OLD POST:

So I have had a minor annoyance with scriping in TF2, namely there is no way to do weapon based setting in all cases, like when using the lastinv command. While this can be worked around, if you want to do +- weapon binds, you are forced to use lastinv. I just recently came upon the solution to that problem, a implementation of lastinv, done competely in aliases.
All credit goes to MrRadicalEd of the Natural Selection forum.

//to use, use "lastslot" where you would otherwise use "lastinv", and @slot# where you would otherwise use slot#
alias null ""
alias sswitch ""
alias !lastslot ""
alias ?lastslot ""
//
alias @slot1 "slot1;!slot1.same;?lastslot;!lastslot;alias ?lastslot is.slot1;alias !same.slot !slot1.same+;alias !slot1.same !same.slot;"
alias is.slot1 "alias !lastslot !slot1;alias !slot1.same sswitch"
alias !slot1 "alias lastslot @slot1"
alias !slot1.same+ "alias ?lastslot null;alias sswitch !slot1.sswitch"
alias !slot1.sswitch "alias !slot1.same sswitch"
alias !slot1.same "sswitch"

alias @slot2 "slot2;!slot2.same;?lastslot;!lastslot;alias ?lastslot is.slot2;alias !same.slot !slot2.same+;alias !slot2.same !same.slot;"
alias is.slot2 "alias !lastslot !slot2;alias !slot2.same sswitch"
alias !slot2 "alias lastslot @slot2"
alias !slot2.same+ "alias ?lastslot null;alias sswitch !slot2.sswitch"
alias !slot2.sswitch "alias !slot2.same sswitch"
alias !slot2.same "sswitch"

alias @slot3 "slot3;!slot3.same;?lastslot;!lastslot;alias ?lastslot is.slot3;alias !same.slot !slot3.same+;alias !slot3.same !same.slot;"
alias is.slot3 "alias !lastslot !slot3;alias !slot3.same sswitch"
alias !slot3 "alias lastslot @slot3"
alias !slot3.same+ "alias ?lastslot null;alias sswitch !slot3.sswitch"
alias !slot3.sswitch "alias !slot3.same sswitch"
alias !slot3.same "sswitch"
EDIT: I finally got around to rewriting this script, it is acually readable and more usable.
EDIT2: Emulated default scroll wheel item switching, and added view model aliases for ease of use.

[code]
alias view1 "slot1; r_drawviewmodel 1"
alias view2 "slot2; r_drawviewmodel 1"
alias view3 "slot3; r_drawviewmodel 1"

bind MWHEELUP "prevslot"
bind MWHEELDOWN "nextslot"

bind q "lastslot"

bind 1 @slot1
bind 2 @slot2
bind 3 @slot3

alias push0 ""
alias push1 ""

alias @slot1 "view1; push0; push1; alias push0 stack1; alias nextslot @slot2; alias prevslot @slot3"
alias @slot2 "view2; push0; push1; alias push0 stack2; alias nextslot @slot3; alias prevslot @slot1"
alias @slot3 "view3; push0; push1; alias push0 stack3; alias nextslot @slot1; alias prevslot @slot2"

alias stack1 "alias push1 pop1"
alias stack2 "alias push1 pop2"
alias stack3 "alias push1 pop3"

alias pop1 "alias lastslot @slot1"
alias pop2 "alias lastslot @slot2"
alias pop3 "alias lastslot @slot3"
[/code]

OLD POST:

So I have had a minor annoyance with scriping in TF2, namely there is no way to do weapon based setting in all cases, like when using the lastinv command. While this can be worked around, if you want to do +- weapon binds, you are forced to use lastinv. I just recently came upon the solution to that problem, a implementation of lastinv, done competely in aliases.
All credit goes to MrRadicalEd of the Natural Selection forum.
[code]
//to use, use "lastslot" where you would otherwise use "lastinv", and @slot# where you would otherwise use slot#
alias null ""
alias sswitch ""
alias !lastslot ""
alias ?lastslot ""
//
alias @slot1 "slot1;!slot1.same;?lastslot;!lastslot;alias ?lastslot is.slot1;alias !same.slot !slot1.same+;alias !slot1.same !same.slot;"
alias is.slot1 "alias !lastslot !slot1;alias !slot1.same sswitch"
alias !slot1 "alias lastslot @slot1"
alias !slot1.same+ "alias ?lastslot null;alias sswitch !slot1.sswitch"
alias !slot1.sswitch "alias !slot1.same sswitch"
alias !slot1.same "sswitch"

alias @slot2 "slot2;!slot2.same;?lastslot;!lastslot;alias ?lastslot is.slot2;alias !same.slot !slot2.same+;alias !slot2.same !same.slot;"
alias is.slot2 "alias !lastslot !slot2;alias !slot2.same sswitch"
alias !slot2 "alias lastslot @slot2"
alias !slot2.same+ "alias ?lastslot null;alias sswitch !slot2.sswitch"
alias !slot2.sswitch "alias !slot2.same sswitch"
alias !slot2.same "sswitch"

alias @slot3 "slot3;!slot3.same;?lastslot;!lastslot;alias ?lastslot is.slot3;alias !same.slot !slot3.same+;alias !slot3.same !same.slot;"
alias is.slot3 "alias !lastslot !slot3;alias !slot3.same sswitch"
alias !slot3 "alias lastslot @slot3"
alias !slot3.same+ "alias ?lastslot null;alias sswitch !slot3.sswitch"
alias !slot3.sswitch "alias !slot3.same sswitch"
alias !slot3.same "sswitch"[/code]
2
#2
2 Frags +

nice find!

nice find!
3
#3
9 Frags +

what does this do? im dumb

what does this do? im dumb
4
#4
2 Frags +

When you switch weapons using one of the @slot# commands, it sets the weapon you came from to "lastslot". You can change the first command in @slot1 from "slot1" to an alias that does other things like toggle view models, change crosshair, etc. on a weapon by weapon basis, something you can't do with the "lastinv" command.

When you switch weapons using one of the @slot# commands, it sets the weapon you came from to "lastslot". You can change the first command in @slot1 from "slot1" to an alias that does other things like toggle view models, change crosshair, etc. on a weapon by weapon basis, something you can't do with the "lastinv" command.
5
#5
1 Frags +

Admirable made a nice script package years ago that I still use. It has custom lastinv aliases, reload/model toggles, and crosshair switching.

http://etf2l.org/forum/general/topic-1926/page-1/

Admirable made a nice script package years ago that I still use. It has custom lastinv aliases, reload/model toggles, and crosshair switching.

http://etf2l.org/forum/general/topic-1926/page-1/
6
#6
0 Frags +

http://tf2.gamebanana.com/scripts/3441
6 years old but your's looks more user friendly? idk.

http://tf2.gamebanana.com/scripts/3441
6 years old but your's looks more user friendly? idk.
7
#7
3 Frags +
vilehttp://tf2.gamebanana.com/scripts/3441
6 years old but your's looks more user friendly? idk.

That uses wait command, banned from most servers.

[quote=vile]http://tf2.gamebanana.com/scripts/3441
6 years old but your's looks more user friendly? idk.[/quote]
That uses wait command, banned from most servers.
8
#8
1 Frags +
Arkanoid0When you switch weapons using one of the @slot# commands, it sets the weapon you came from to "lastslot". You can change the first command in @slot1 from "slot1" to an alias that does other things like toggle view models, change crosshair, etc. on a weapon by weapon basis, something you can't do with the "lastinv" command.

Sorry for the possibly stupid question but how is that any different than the broesel crosshair switcher?

[quote=Arkanoid0]When you switch weapons using one of the @slot# commands, it sets the weapon you came from to "lastslot". You can change the first command in @slot1 from "slot1" to an alias that does other things like toggle view models, change crosshair, etc. on a weapon by weapon basis, something you can't do with the "lastinv" command.[/quote]
Sorry for the possibly stupid question but how is that any different than the broesel crosshair switcher?
9
#9
0 Frags +
Treshvilehttp://tf2.gamebanana.com/scripts/3441
6 years old but your's looks more user friendly? idk.
That uses wait command, banned from most servers.

iirc, the wait command was useless in that script. it looks very messy though.

[quote=Tresh][quote=vile]http://tf2.gamebanana.com/scripts/3441
6 years old but your's looks more user friendly? idk.[/quote]
That uses wait command, banned from most servers.[/quote]

iirc, the wait command was useless in that script. it looks very messy though.
10
#10
0 Frags +

Bump for edit.

Bump for edit.
11
#11
1 Frags +

So, since I'm dumb and don't know how to script, if I wanted to set this up so that I have no viewmodels on my main weapon, but viewmodels on both secondary and melee, how would I script this?

So, since I'm dumb and don't know how to script, if I wanted to set this up so that I have no viewmodels on my main weapon, but viewmodels on both secondary and melee, how would I script this?
12
#12
1 Frags +
AoshimaSo, since I'm dumb and don't know how to script, if I wanted to set this up so that I have no viewmodels on my main weapon, but viewmodels on both secondary and melee, how would I script this?
alias view1 "slot1; r_drawviewmodel 0"
alias view2 "slot2; r_drawviewmodel 1"
alias view3 "slot3; r_drawviewmodel 1"

bind q lastslot
bind 1 @slot1
bind 2 @slot2
bind 3 @slot3

alias push0 ""
alias push1 ""

alias @slot1 "view1; push0; push1; alias push0 stack1"
alias @slot2 "view2; push0; push1; alias push0 stack2"
alias @slot3 "view3; push0; push1; alias push0 stack3"

alias stack1 "alias push1 pop1; 
alias stack2 "alias push1 pop2; 
alias stack3 "alias push1 pop3; 

alias pop1 "alias lastslot @slot1"
alias pop2 "alias lastslot @slot2"
alias pop3 "alias lastslot @slot3"
[quote=Aoshima]So, since I'm dumb and don't know how to script, if I wanted to set this up so that I have no viewmodels on my main weapon, but viewmodels on both secondary and melee, how would I script this?[/quote]

[code]
alias view1 "slot1; r_drawviewmodel 0"
alias view2 "slot2; r_drawviewmodel 1"
alias view3 "slot3; r_drawviewmodel 1"

bind q lastslot
bind 1 @slot1
bind 2 @slot2
bind 3 @slot3

alias push0 ""
alias push1 ""

alias @slot1 "view1; push0; push1; alias push0 stack1"
alias @slot2 "view2; push0; push1; alias push0 stack2"
alias @slot3 "view3; push0; push1; alias push0 stack3"

alias stack1 "alias push1 pop1;
alias stack2 "alias push1 pop2;
alias stack3 "alias push1 pop3;

alias pop1 "alias lastslot @slot1"
alias pop2 "alias lastslot @slot2"
alias pop3 "alias lastslot @slot3"
13
#13
3 Frags +

Thank you for this handy script.

There's a little bug though that doesn't allow you to switch weapons via mouse wheel after the game start. You should press either [1], [2] or [3] key for mouse wheel to start working as supposed (until the full game restart). To fix this just add

@slot1

as the last line of the script.

#12: And you forgot

bind MWHEELUP "prevslot"
bind MWHEELDOWN "nextslot"

when answering Aoshima's question.

Thank you for this handy script.

There's a little bug though that doesn't allow you to switch weapons via mouse wheel after the game start. You should press either [1], [2] or [3] key for mouse wheel to start working as supposed (until the full game restart). To fix this just add
[code]@slot1[/code]
as the last line of the script.

#12: And you forgot
[code]bind MWHEELUP "prevslot"
bind MWHEELDOWN "nextslot"[/code]
when answering Aoshima's question.
Please sign in through STEAM to post a comment.