Upvote Upvoted 0 Downvote Downvoted
Replace an alias ?
posted in Customization
1
#1
0 Frags +

Hello,
Yesterday, I tried the broesel crosshair switcher just for viewmodels. By the way, I wondering if it's possible to keep the sticky launcher, use mouse1 as +attack and switch to the grenade launcher only when i'm using the slot1 or the slot3 (I use mouse5 for switch and attack with the slot3.)

So, there is my demoman.cfg:

bind mouse1 "+prim" 
bind mouse2 "+secd"
bind mouse5 "+mel"

alias +prim "slot1;+attack"
alias -prim "-attack"
alias +secd "+attack2"
alias -secd "-attack2"
alias +mel "slot3;+attack"
alias -mel "-attack"
alias +prim "slot1;r_drawviewmodel 0; +attack"
alias +secd "r_drawviewmodel 1; +attack2"
alias +mel"slot3;r_drawviewmodel 1; +attack"

So I would like to know if a command like "If" exist for cfg.
Or a way to replace this line:

alias +prim "slot1;r_drawviewmodel 0; +attack"

by something like this:

alias +prim exept "slot2"

Thanks.

Hello,
Yesterday, I tried the broesel crosshair switcher just for viewmodels. By the way, I wondering if it's possible to keep the sticky launcher, use mouse1 as +attack and switch to the grenade launcher only when i'm using the slot1 or the slot3 (I use mouse5 for switch and attack with the slot3.)

So, there is my demoman.cfg:
[code]bind mouse1 "+prim"
bind mouse2 "+secd"
bind mouse5 "+mel"

alias +prim "slot1;+attack"
alias -prim "-attack"
alias +secd "+attack2"
alias -secd "-attack2"
alias +mel "slot3;+attack"
alias -mel "-attack"
alias +prim "slot1;r_drawviewmodel 0; +attack"
alias +secd "r_drawviewmodel 1; +attack2"
alias +mel"slot3;r_drawviewmodel 1; +attack"[/code]

So I would like to know if a command like "If" exist for cfg.
Or a way to replace this line:[code]alias +prim "slot1;r_drawviewmodel 0; +attack"[/code] by something like this:[code]alias +prim exept "slot2"[/code]
Thanks.
2
#2
2 Frags +

Use this instead http://www.teamfortress.tv/34834/yttriums-competitive-viewmodels

His video explains why it's better if you need convincing.

Use this instead http://www.teamfortress.tv/34834/yttriums-competitive-viewmodels

His video explains why it's better if you need convincing.
3
#3
0 Frags +

for broesels xhair switcher you're supposed to change all of the "slots" in existing scripts to "weapon"

so for your example it'd be

alias +prim "weapon1;r_drawviewmodel 0; +attack"

alias +prim exept "weapon2"

for broesels xhair switcher you're supposed to change all of the "slots" in existing scripts to "weapon"

so for your example it'd be

alias +prim "weapon1;r_drawviewmodel 0; +attack"

alias +prim exept "weapon2"
4
#4
0 Frags +
ProSkeezfor broesels xhair switcher you're supposed to change all of the "slots" in existing scripts to "weapon"

so for your example it'd be

alias +prim "weapon1;r_drawviewmodel 0; +attack"

alias +prim exept "weapon2"

It doesn't work at all

[quote=ProSkeez]for broesels xhair switcher you're supposed to change all of the "slots" in existing scripts to "weapon"

so for your example it'd be

alias +prim "weapon1;r_drawviewmodel 0; +attack"

alias +prim exept "weapon2"[/quote]
It doesn't work at all
5
#5
2 Frags +

There is no such thing as an if statement for scripting. Scripters get around this by re-aliasing instead, so basically instead of 'something' checking if an event happened (which is impossible), we make it so that when the event happens the 'something' behaves differently (which is possible).

As long as you're only aliasing to a single command, you can alias within an existing alias, like so:

alias something "alias +prim slot2"

That changes the +prim command, like you wanted.

If it has multiple commands, you can't alias to it directly. This doesn't work:

// this will make +prim go to slot1 and nothing else, and then run r_drawviewmodel 0 and +attack after that
// don't use this because it's broken
alias something_else "alias +prim slot1;r_drawviewmodel 0; +attack"

But you can make an alias for those multiple commands to solve that problem. What you'd have to do for that is something like:

alias something_else "alias +prim switch_primary"
alias switch_primary "slot1;r_drawviewmodel 0; +attack"

So you know, that aliasing can still be at the end of something. So this would work:

alias something "some_command; another_command; alias +prim slot2; more_commands"

With the some_command, another_command, and more_commands being example placeholders.

I don't know what you want to do exactly, so I can't make the script for you. But hopefully that should help you do it.

There is no such thing as an if statement for scripting. Scripters get around this by re-aliasing instead, so basically instead of 'something' checking if an event happened (which is impossible), we make it so that when the event happens the 'something' behaves differently (which is possible).

As long as you're only aliasing to a single command, you can alias within an existing alias, like so:
[code]alias something "alias +prim slot2"[/code]
That changes the +prim command, like you wanted.

If it has multiple commands, you can't alias to it directly. This doesn't work: [code]// this will make +prim go to slot1 and nothing else, and then run r_drawviewmodel 0 and +attack after that
// don't use this because it's broken
alias something_else "alias +prim slot1;r_drawviewmodel 0; +attack"[/code]
But you can make an alias for those multiple commands to solve that problem. What you'd have to do for that is something like:
[code]alias something_else "alias +prim switch_primary"
alias switch_primary "slot1;r_drawviewmodel 0; +attack"[/code]

So you know, that aliasing can still be at the end of something. So this would work:
[code]alias something "some_command; another_command; alias +prim slot2; more_commands"[/code]
With the some_command, another_command, and more_commands being example placeholders.

I don't know what you want to do exactly, so I can't make the script for you. But hopefully that should help you do it.
Please sign in through STEAM to post a comment.