Navy Seals: Covert Operations - NSSL Guide

Introduction

This guide is intended to familiarize you with nssl and is not a definitive guide on every possible use, nor does it list every command.

This guide will continually evolve and can always be found on the ns:co website ( http://www.ns-co.net )

N.S.S.L. is a very power scripting language. In this document, I will describe what N.S.S.L. is and how to use it. In short N.S.S.L. Is a scripting language that greatly expands upon basic Q3 scripting. You can do things in N.S.S.L. that would either require extensive scripts or just plain would not be possible.
Let’s get started shall we?

I shall be using different fonts and colors throughout this document to let you know when I’m posting actual code, pseudo code, and an English expression of what that code actually does.

Terminology you will be hearing in this document:
cvar = client variable = a variable set by the client. IE: name, kind of weapon, amount of ammo, etc.

Text like this is general information

This text is NSSL script


This text is psuedo code, what is effectivley a "dumbed down" version of NSSL

Lesson 1. Basic command list and syntax.

All N.S.S.L. scripts and commands MUST start with one of these: Clientscript, CS, or NSSL.
These commands tell NS:CO that the following code is N.S.S.L.

Examples:

CS {Function} variable {action # action}

Clientscript {Function} variable {action # action}

NSSL {Function} variable {action # action}

Note: The Pound Character ( # ) is used when using multiple commands, since we cannot use the 'semi-colon' for malicious reasons.

These are the functions that can be used in N.S.S.L. :
if usage:

if <CVAR> ==,!=,<>=, <VALUE/STRING> then { <CMD> } else { <CMD> }

switch usage:

switch <CVAR> <STRING/VALUE> { <CMD> } <STRING/VALUE> { <CMD> } else { <CMD> }

while usage:

while <CVAR> ==,!=,<>= <VALUE> then { <CMD> }

modify usage:

modify <CVAR> <+VALUE/-VALUE/STRING>

copy usage:

copy <CVAR IN> <CVAR OUT>

exec usage:

exec {<cmd>}

There are more functions included in NSSL, but for the sake of brevity and to not confuse new users and inexperienced scripters, they have been omited from this document, an advanced scripting guide will be written to include these commands at a later date.

Lesson 2. {IF Then Else statements}

Ahh, the most used and useful function in N.S.S.L. the if statement is used to compare a variable to a value and if it matches execute a command, it can also execute a command if it Does NOT match the value aswell.

Example:

CS if name == “Eggy!” then { say Yup, I’m Eggy!} else { say I’m NOT Eggy!}

See if name is Eggy!, if yes, then say “Yup, I’m Eggy!”, if name is not Eggy! Then say “I’m NOT Eggy!”

Note: you do not need to include the else operator if you don’t want to do something if the action is false.

When using an If statement, you can use the following operators
== same as (you can use a string OR value to compare to)
!= not the same as ( string/value )
>= bigger or the same as ( value )
<= smaller or the same as ( value )
< smaller then ( value )
> bigger then ( value )

Lesson 3. {Switch functions}

My favorite function in N.S.S.L. is Switch. It can be used to evaluate a cvar and do commands based on the cvars values.

SWITCH <VARIABLE> <string/VALUE> { <COMMAND> } <string/VALUE> { <COMMAND> } ELSE { <COMMAND> }

Example:

CS switch ui_team 1 { say I’m a Seal } 2 { say I’m a Tango }else { say I’m a Spectator }

if ui_team = 1 say I’m a Seal, if it = 2 say I’m a Tango, and if it doesn’t equal either say I’m a Spectator.

Switch is very powerful and can be used to do different functions based on the values of a var, it can even do something if the state of a cvar is undeterminable.

Lesson 4. {Executing a command}

Exec is used to “execute” a statement or command. If you want to do something from inside the N.S.S.L. environment, without having to do something with it, you use the exec operator.

Example:

CS exec { vstr blind }

This is a fairly straight forward command, so I will let you experiment with it.

Lesson 5. {While Loops}

Yes, I’m finally getting to while loops. I know a lot of you have been waiting for this, so without further ado:
While is used to execute a value as soon as a cvar is equal to the control value. It can be used to check health, ammo, etc and execute a command as soon as it reaches true and can be made to either cycle infinitely or for a set period of time.

CS WHILE <VARIABLE> (OPERATOR) <string/VALUE> { <COMMAND> } <SLEEP> <AGE>

Example:

CS while *health <= 5 { say_team I’m DEAD watch your back } 250 -1

as long as health is greater than or equal to 5 do nothing, as soon as it drops to 5 or less say_team im dead. Do this every 250ms (1/4 of a second) forever.

You notice the 250 -1 at the end, the 250 represents how often. This number is to be in milliseconds. The -1 is the age, or how long does this statement last, you can use any value (represents each time it *Loops*) or -1 for infinite.

Lesson 6. {Modify a Variable}

Now to speak a little on Modify, it can be used to either add or substract a value to a value, or add a string to the end of a string.

Example:

{String}

CS modify name “ likes donuts” <- notice the space after “

add “likes donuts to the end of name, so that name equals “Defcon-x likes donuts”


{Value}

CS modify killcount +1

adds 1 to the var killcount (before you think about cheating this is NOT a real var <G>)

Lesson 7. {Copying a var}

Copy is used to copy the contents of a var to another var, while not as useful as some of the other feature of N.S.S.L. there are times when it is very handy, especially when working with *special system* vars that can’t be directly modified.

Example:

CS copy *health health_var

copies the contents of *heatlh to health_var

Special Vars:

There are some special cvars we can use in N.S.S.L. such as health and weapon. Defcon-x has been gracious enough to give us access to a few cgame vars. Here are the list of available cgame vars and their syntax / use. You can only use these vars inside N.S.S.L. and they MUST have the * (asterisk) infront of the var name. The * denotes that this is a cgame var and not a normal cvar. You CANNOT modify the contents of a cgame var.

*Health = Health remaining in points.
*Stamina = Stamina remaining in points
*Weapon = Current weapon selected
*Rounds = number of bullets left in current weapon
*Clips = number of clips available for current weapon

You can use cvars in a say statement now in 1.5, anytime you want to tell someone (or yourself) the contents of a cvar, just add a $ infront of the var and place inside an nsecho, say, or say_team.

Example:

CS exec { say $ui_mapname is the current map }

say ns_snowcamp is the current map

This feature is only available inside the N.S.S.L. environment.

Reference:

These are the currently available CVARS for use in NSSL with NS:CO Beta-1.9

*health
*stamina
*weapon
*rounds
*clips
char_stamina
char_stealth
char_speed
char_accuracy
char_technical
char_strength
char_xp
ui_sealplayers
ui_tangoplayers
ui_players
ui_sealpoints
ui_tangopoints
ui_team
ui_assaultstate
ui_bombstate
ui_gotbomb
ui_isvip
ui_gotbriefcase
mi_viprescue
mi_viptime
mi_blowup
mi_assaultfield
Displays current health level
Displays current stamina level
Displays current weapon
Displays number of bullets remaining
Displays number of clips remaining
Displays current stamina xp
Displays current stealth xp
Displays current speed xp
Displays current accuracy xp
Displays current technical xp
Displays current strength xp
Current xp available
Players on seals team
Players on tango team
Total number of players in game
# of points the seal team has
# of points the tango team has
Team you are currently on
Player in assault field?
Player in bomb field?
Player got bomb (0/1)
Player is vip (0/1)
Player got briefcase (0/1)
ViP rescue
ViP on time
Bomb spot in the map
# of Assault fields

[ www.ns-co.net | www.team-mirage.net | Written by Gate. Based on a documennt by Defcon-X and Eggy | Designed by Democritus ]