OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: snafu on 30 Jan 2009, 20:02:14

Title: Scripting Basics
Post by: snafu on 30 Jan 2009, 20:02:14
Hey all,

I have hit a ceiling with my editing skills, being limited to what I want with the scripts available. I want to learn but not sure where to start. I am not a coder and it takes me a long time to learn stuff like this; I still have nightmares of Visual Basic when I had to use it in school. So I need some help from you stand-up blokes.

Should I learn sqs or just focus on sqf seeing that ArmA favours it?

The first script I want to make is that when an enemy group is spotted by a friendly group/unit/vehicle a smoke grenade spawn at their location allowing the player to CAS their ass. It sounds basic enough but it probably isn't. Would this be easy enough for a newbie to attempt?
Title: Re: Scripting Basics
Post by: Mandoble on 30 Jan 2009, 20:58:02
SQF, definitively. While you might still use SQS for small and quite basic scripts.
Try to put here your advances with your spot script and we'll provide clues to complete it.
Title: Re: Scripting Basics
Post by: Ext3rmin4tor on 30 Jan 2009, 22:08:58
I think he meant you may use SQS for basic scripts (as I do) or cutscenes. But it is better to learn SQF since ArmA2 will be likely SQF only.
Title: Re: Scripting Basics
Post by: NightJay0044 on 30 Jan 2009, 23:27:27
Although I'm a beginner in scripting myself, what's SQF mean? I know sqs is for your scripting files.

SQF another form of scripting?
Title: Re: Scripting Basics
Post by: Mandoble on 30 Jan 2009, 23:36:57
Yes, it is a different scripting language. Basic differences are in control/condition blocks like while, for, if, swich. Usage of sleep instead of ~, every line ending with ; and no more gotos/exit. And finally, the existance of scope areas for local variables, so that local variables might be local just to a control block and no to the entire script.
Title: Re: Scripting Basics
Post by: Rommel92 on 31 Jan 2009, 00:48:25
Incase you haven't even started to begin attempting your script, you would have three parts.

#Detection
Detect that the BLUFOR groups knows of the OPFOR group, perhaps via a trigger?

#Interpretation
Ensure that the data is all correct by some debugging, and make sure that the group is indeed friendly etc.

#Processing
Get the BLUFOR group to throw the smoke grenade, and re-route your CAS to that position.

Interesting/Relevant Commands:

Alive - http://www.ofpec.com/COMREF/index.php?action=details&id=16
Count - http://www.ofpec.com/COMREF/index.php?action=details&id=77
CommandMove - http://www.ofpec.com/COMREF/index.php?action=details&id=70
OR
DoMove - http://www.ofpec.com/COMREF/index.php?action=details&id=111
Leader - http://www.ofpec.com/COMREF/index.php?action=details&id=193
CreateVehicleLocal - http://www.ofpec.com/COMREF/index.php?action=details&id=456
Group - http://www.ofpec.com/COMREF/index.php?action=details&id=157
Position - http://www.ofpec.com/COMREF/index.php?action=details&id=250""

Hopefully this will get you started a bit quicker.

 regards, Romm