Half-life2 (HL2) Counter-strike DoD [TiC] Clan

[TiC] 'TALK is CHEAP' Clan the BEST Clan in the World ! www.ticclan.com
www.ticclan.com

[TiC] 'TALK is CHEAP' Clan

[TiC] 'TALK is CHEAP' Clan the BEST Clan in the World ! www.ticclan.com
www.ticclan.com

MAIN MENU:
Home
About us
FORUM
Links
Contact us

JOINING:
Join
Rules
Clan Structure
Required Items
Required Binds
Help us

EVENTs & PROJECTs:
Events & Projects
Event Calendar
Host an Event Form
Events Department
Training Department
Recruiting Department
MyTuner Project
MyTuner Manual
MyTuner Eval Form
Map Terminolgy Proj.
[TiC] Magazine

Special Ops Group:
S.O.G.
Challenge us

PRIVATE SECTION:
Private Area
(Note: We log everything)

SEARCH:
Search:    Google

Search ticclan.com
Search the Web



Fast Counter the best
Site visitors
Since 5 June, 1999.

Tips & Tutorials/  [TiC-G]MeanGoof's Scripting Tutorial/  Lesson#3:

MeanGoof wrote this scripting tutorial to help the MiGHTY [TiC]Clan and others.
MeanGoof's Scripting Tutorials:
 
(17 July, 2002)
 
(By: "Meangoof")
 (Former [TiC]Clan Guest)



 Lesson #3:
 Toggle scripts:
 

What are Toggle Scripts?:


What is a toggle script you might ask? Did you ever wish that you had a way to make your move keys toggle between running and walking, without always having to hold down the shift key when you want to walk? Did you ever wish you had a particular key that could turn the radar on when you hit it, and turn it off when you hit it again? Toggle scripts allow you to do exactly this sort of thing.

This class will include the following:

1) A review of last week's lesson.
2) A detailed explanation of a simple toggle script.
3) A session on the clan server to try out your new toggle script (and to debug it if it does not work).


Back to the top of page


 

A review of  previous script classes:


a) CS has over 250 commands that can be invoked through the console, directly from a script, or from a bind to one of your keys.

b) You can create your own commands by using aliases. You build aliases as a sequence of valid CS commands, each separated by a semi column and enclosed in double quotes.

Example: alias crouchjump "+duck;wait;wait;+jump;wait;wait;-duck;wait;wait;-jump"


c) Just like the normal commands, the commands you create can be used from the console, in a script, as part of new commands etc etc.

Example:

Create a command

alias wait4 "wait;wait;wait;wait"

Now create another command based on the previous one

alias wait8 "wait4;wait4"

Now whenever you use wait4 or wait8 they behave like normal commands

for example:

alias +selectHE "weapon_hegrenade;wait8"
alias -selectHE "lastinv;wait4"

In this last example, whenever you press a key bound to the +selectHE alias, the HE grenade is selected.
When you let go of that key, your last selected weapon comes back automatically.

d) +/- commands are special types of commands that are normally bound to keys. The plus version is bound to a key. When the key is pressed, the command is executed, and when the key is let go, the minus command is executed. You can use +/- commands in scripts or other aliases, but make sure that you don't break the semantic of the command by forgetting to call up the minus command. Forgetting this could put your game in a state that has you locked up doing something. For example, is you issue the +forward command and forget to execute the -forward command, you will forever being moving forward.


Back to the top of page


 

A detailed description of a toggle script:


What follows is a toggle script that allows you to toggle between running and walking

alias walkToggle "walk_on"
alias walk_on "+speed;developer 1;echo walking is on;developer 0;alias walkToggle walk_off"
alias walk_off "-speed;developer 1;echo walking is off;developer 0;alias walkToggle walk_on"

bind "1" "walkToggle"

Let's look at this script one line at a time.


1.) alias walkToggle "walk_on" :

In this line I create a new command called walkToggle. This command, when first executed, will execute the walk_on command (which is defined on the next line). This command will change itself to execute something else each time it is executed. By that I mean that the first time it is executed, it will execute the walk_on command, the second time it is executed it will execute the walk_off command, the third time it is executed it will be back to executing the walk_on command and so on.


2.) alias walk_on "+speed;developer 1;echo walking is on;developer 0;alias walkToggle walk_off" :

In this 2nd line, I define the walk_on command. Remember from the previous line, this is actually what gets executed the first time the walkToggle command is executed because the walkToggle command is first aliased to this particular command. The first thing that this command does is to execute the +speed command. This has the same effect as if you pressed and held down the shift key, thus making your player walk instead of running. The second thing this command does is to execute the developer 0/echo/developer 1 sequence which puts the walking is on message on the top left hand corner of your hud (see the description of the developer/echo command combination I provided in the first class on scripting). The last thing the walk_on command does is where the magic lies in toggle script. It executes the alias command on the walkToggle command, to re-alias the walkToggle command to its new meaning, namely walk_off. This means that after executing the walk_on command, the walkToggle command, when executed again, will execute the walk_off command. Very cool euh?


3.) alias walk_off "-speed;developer 1;echo walking is off;developer 0;alias walkToggle walk_on" :

In this third line I define the behaviour of the walk_off command. After executing the walk_on command, this is the command that the walkToggle command is aliased to. The first thing this command does is to execute the -speed command. This is the same thing as if you released the shit key on your keyboard, putting your player back into the running mode. The line then displays the walking is off message on the top left hand corner of your hud. The last thing this line does is to re-alias the walkToggle command back to its original meaning (walk_on) so that when the walkToggle command is executed again, it will cycle back to its original meaning which was to make you walk.


4.) bind "1" "walkToggle" :

Aliases by themselves serve very little purpose. You have to have a way to execute them. This last line binds the 1 key on your keyboard to the walkToggle command. After executing this line, every time you hit the 1 key on your keyboard, it will execute the walkToggle command for you, which will toggle you back and forth between the walk and run mode.

Personally, I would not put this particular line in my private script. I would either drop my console and issue this command from the console (which will automatically update my config.cfg file) or I would put an entry line inside my kb_act.lst file and make my bind from the games controls menu.

That's all there is to toggle scripts. Write this one down in your autoexec.cfg or private script file and lets go on the server to try it out.


Back to the top of page



 

 MeanGoof's Scripting Tutorial:

 | INDEX | Lesson1 | Lesson2 | Lesson3 | Lesson4 |

 

This page was originally created by [TiC]EVIL 28Aug01. Last updated 02/06/03.


SERVERs:
[TiC]Clan Servers
Player's Code of Conduct
Rcon Guidelines
[TiC] CS Server STATS
[TiC] CS Gametiger
Find your IP Number

SCRIPTs:
Scripts
TFC Scripting Tutorial
CS Scripting Tutorial
TFC Script Set
HL Speak Commands

TIPs:
Tips
Half-life & CS Tweaks
Crosshairs & Sprites
TFC Strategies
CS & TFC Newbie Guide
Counter-Terrorism Guide
Logo WareHouse
Color Logo Bible
Clan Leader's Bible

LOGO WareHouse has color spray paint logos downloads, tutorials, and tips for Half-Life Mods!

When the going gets tough, you better have the "Clan LEADER's Bible" handy! We read the Bible !!

MyTuner is FREE add-on to Roger Wilco, it  adds "hot-key" channel switching feature and is the preferred channel switcher, used by tens of thousands of gamers world wide!

The Map Terminology Handbook is a PROJECT of our Club to help people in the gaming community to more quickly and easily describe where they are on a map to their teammates.

AtomicWARRIOR.com is trying to bring civility to online gaming. If you are a friendly gamer go check out this site. It's where all the friendly gamers hangout.

We are a REGISTERED Clan baby!

Black Widow Games,,, the world's premier game developer!

Copyright 1999-2004 [TiC]Clan™. All rights reserved. www.ticclan.com . Terms of Service. Privacy Policy.