Login
OFPEC RSS
Username:
Password:
Not a member yet?
Register for free!
Home
Intel Depot
Editors Depot
Missions Depot
Addons Depot
Forum
Home
›
COMREF
›
S
›
switch
switch
exp
Operand types
exp
:
Anything
Type of returned value
Switch Type
Description
Begins switch form.
Used In
ArmA
Example
switch (_a) do { case 1: {block}; case 2 : {block}; default {block};}
Search OFPEC COMREF
Types
Arrays
Scripting Topics
BIS Functions
Arma2 CfgVehicles
Arma2 Weapons
ArmA CfgVehicles
ArmA Weapons
OFP CfgVehicles
OFP Weapons
- Select Game -
List All
Arma3 Only
Arma2:OA Only
Arma2 Only
ArmA Only
Elite
Original OFP
- Select Group -
objects
units
groups
vehicles
weapons
arrays
items
backpacks
buldozer
mines
uniforms
vests
tasks
locations
artillery
configs
UAVs
briefings
mission flow
sites
map
draw
leaderboards
markers
environment
game
dialogs
displays
namespaces
radio
channels
FSM
diagnostics
firing from vehicles
slingload
advanced flight model
DLC
weapon stabilization
suppression
waypoints
cutscenes
sound
mathematics
variables
script commands
multiplayer
Zeus
3D editor
3D draw
Top of page
If it's 1, do this.
If it's 2, do this other stuff.
If it's anything else (the default bit) then do this.
Another example:
switch (character_name) do {
case "Koslowski": {
hint "War's boring. Anyone else bored?";
};
case "Gastovski": {
hint "Am I good or am I good?";
};
default: {
hint "All your base are belong to us!";
};
};
It's important that you define the default action to fall through to if the value you're checking doesn't match any of your declared possibilities.