Site hosted by Angelfire.com: Build your free website today!
Home
< ------------------------------------------------------------------------------------------------------------------->
Counter-Strike Scripting Guide!
Metabinds Continued:

//First, the buy aliases need to be defined
//    (this doesn't have anything to do with the actual metabind)
alias deagle "buy; menuselect 1; menuselect 3; buy; menuselect 7"
alias mp5 "buy; menuselect 3; menuselect 1; buy; menuselect 6"
alias akColt "buy; menuselect 4; menuselect 1; menuselect 3; buy; menuselect 6"
alias sigAug "buy; menuselect 4; menuselect 2; menuselect 4; buy; menuselect 6"
alias scout "buy; menuselect 4; menuselect 5; buy; menuselect 6"
alias awp "buy; menuselect 4; menuselect 6; buy; menuselect 6"
alias buyHE "buyequip; menuselect 4"
alias buyFB "buyequip; menuselect 3"

//next, we set up the Metabind alias itself
alias +mb_buying "bind F1 scout; bind F2 awp; bind F3 buyHE; bind f4 buyFB"
alias -mb_buying "bind F1 deagle; bind F2 mp5; bind F3 akColt; bind F4 sigAug"

//This will call -mb_buying to set up the normal binds for F1-F4 (when bound key is NOT held down)
-mb_buying

//the metabind
bind shift "+mb_buying"

To walk through it. The alias'es for the purchases themselves don't matter. They can be any name, any aliases, to perform any action. For the metabind itself, we will look at the bind to start off.
bind shift "+mb_buying"

This will make shift be bound to +mb_buying. Because of how +/- aliases work, when shift is PRESSED DOWN, the + part of +mb_buying will be executed. When shift is RELEASED, the - part of +mb_buying will be executed. Basicly, when shift is pressed down, +mb_buying is ran, and when shift is released, -mb_buying is ran.

Now, moving right along then.. when shift is pressed down, the + part gets executed, which performs this:
bind F1 scout; bind F2 awp; bind F3 buyHE; bind f4 buyFB

This will change F1-F4 to the intended purchase alias'es when the shift is PRESSED DOWN. In essence, its making SHIFT+F1/F2/F3/F4 do scout/awp/buyHE/buyFB.

When shift is released, this is ran:
bind F1 deagle; bind F2 mp5; bind F3 akColt; bind F4 sigAug
This will set up what F1-F4 do normally, when no keys are held down.. which resets things to how they are.

In reality a metabind is a simple thing, but at first people get scared from 'going the extra step' passed a simple bind.

Random Stuff:
In this section, you can find out a few random things that are important in scripting.
First:  the developer #: Developer lets the fragger see info about his game in the top-left corner, without opening the console.  When it is set to 0 (default), nothing is shown.  When developer is 1, you can use the "echo" command to convey info to the user.
"developer 1; echo hi; developer 0"
This will activate developer mode (DM), say hi on the top left corner of the screen, and deactivate DM.  We always make sure to deactivate DM so no info other than what we want gets to the user; it would be bad if you saw when someone died at the top left corner.
Second: Toggle, a toggle script consists of 3 lines: 1 line will perform a function, 1 line will perform another function, and 1 line to do the "toggling". EX}
alias toggle "toggle1"
alias toggle1 "say this is the toggle1; alias toggle toggle2"
alias toggle2 "say ths is the toggle2; alias toggle toggle1"