Cycling Aliases

Firstly, a cycling alias is basically a group of toggling aliases, because of this, I advise reading my 'Toggling Aliases' tutorial before attempting this tutorial because I will not be going through how to use the Toggle alias. So, as the name suggests, you use the cycling Alias to 'cycle' between commands. So instead of switching between 2 commands as in the 'Toggle' aliases, you can switch through unlimited commands. We will be using the basic 'Toggle' alias, but taking it a little bit further.

For the purpose of this tutorial, the example we will be using is Switching between all the Grenades. Firstly we will need to know how to bring up the grenades. We use the following commands;

weapon_flashbang
weapon_hegrenade
weapon_smokegrenade

So we want to be able to switch through all the grenades by pressing just one button. Firstly, we will set up the aliases;

alias get_he "weapon_hegrenade"
alias get_flash "weapon_flashbang"
alias get_smoke "weapon_smokegrenade"

alias switch_gren "get_he"

So, as in the Toggle tutorial, when we execute the 'get_he' we want to change the alias for 'switch_gren' to get the Flashbang out. Remember, we do this like this;

alias get_he "weapon_hegrenade; alias switch_gren get_flash"

This will work for just the HE, so when we press the button bound to 'switch_gren' it will get out the HE Grenade, then when pressed again, it will bring out the Flashbang. Now we will need to do it for the Smoke Grenade.

alias get_flash "weapon_flashbang; alias switch_gren get_smoke"

For the smoke grenade, we need to switch the alias back to the start, to the 'get_he', we do this like this;

alias get_smoke "weapon_smokegrenade; alias switch_gren get_he"

So we press the button bound to 'switch_gren' it will bring out the HE Grenade, pressed again will bring out the Flashbang, pressed again will bring out the Smoke Grenade, then pressed again will bring out the HE Grenade again.


The Final Result


If you would like to use this code, just copy and paste this into the correct files, see the Introductory tutorial to find out which.

alias get_he "weapon_hegrenade; alias switch_gren get_flash"
alias get_flash "weapon_flashbang; alias switch_gren get_smoke"
alias get_smoke "weapon_smokegrenade; alias switch_gren get_he"
alias switch_gren "get_he"

bind "?" "switch_gren"

So there we go, this is just a basic Gren Swicther, goto the common scripts page for an advanced version. I hope you enjoyed this tutorial!

Comments

emfive
15:26 22/1/2003
Hello UKTerrorist staff [ Comment: Report | IP: Logged ]
Add comment

Menu

News
Features
Events
Site
Search UKT:

User



Register here

Shoutbox

Zechs_
*sniff*
04:40 3/9/2008

X
JESUS CHRIST ITS A LION
23:33 27/8/2008

`NWA
lol @ this shoutbox going stron 2 years after the last news item was posted.
02:22 27/8/2008

w1ckedz
I wrote that Culexus comment Myers hahahaha
21:32 25/8/2008

tiz
Stealing is terrible I know! Some ****er even had the cheek to put it on ebay... [ [ expand ]