Search the Community
Showing results for tags 'object oriented'.
Found 3 results
-
[RELEASE] SQX Language - Object Oriented Scripting
engima posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
WHAT IS SQX? SQX is a script language that is used to create scripts and missions in Arma 3. SQX is very similar to SQF, but it has support for object oriented scripting. PHILOSOPHY SQX extends the SQF language primarily by adding control structures that allow for object oriented scripting. As such, plain SQF is allowed, but it also introduces support to organize the code into classes and inheritances. SQX also introduces a small toolbox of some optionally available new commands and keywords that may be helpful (such as the "return" statement). The SQX language reference explains all the ways that SQX differs from SQF. One could say that SQX is for SQF what TypeScript is for Javascript. FEATURES OF SQX True object orientation (objects and inheritence, virtuals and overrides) Type handling and customizable types (classes, interfaces, enums) Three different kinds of class members (fields, methods, properties) Three different kinds of accessors (private, protected, public) Support for statics (methods and properties) Syntax close to SQF Some new convenient commands (like "is", "as", "return" etc.) Compiler synchronizes line numbers between SQX and SQF to support runtime error handling SQX class objects can be broadcasted between machines Complete reference documentation (at www.typesqf.com). WHAT CAN YOU DO? You can structure your code in an object oriented way, creating your own types and actions using classes, interfaces and enums. Well, these are just the tools. What you really can achieve is great structured code, easy to read, easy to write and easy to understand. It extends the boundaries of what code is possible to overview and control. WHAT IS OBJECT ORIENTATION? If you are a developer, you already know, and the reference documentation and general SQF resources should be enough. I you are not familiar with it then start with this Wikipedia article: https://en.wikipedia.org/wiki/Object-oriented_programming. HOW TO GET STARTED? Download the TypeSqf Editor from www.typesqf.com. Create a new mission. In Eden Editor in Arma 3, create a new mission and insert at least one playable unit. In TypeSqf, select "Open mission" and select the newly created mission.sqm. Install the CPack TypeSqf.MissionTemplate.Mp.Standard. In TypeSqf, open the CPack Console in the Tools menu. Write "Install TypeSqf.MissionTemplate.Mp.Standard" and press ENTER. The mission template (written in SQX) is now installed into your mission. Compile and build the project and play the default template mission. Compile the mission in TypeSqf by using "Compile project" on the Build menu. Play the simple default mission. MEDIA The following video shows when I use SQX to create and use a Crowd object: HOW DOES IT WORK? A class instance variable (instantiated with the new keyword) is under the hood an SQF variable of type Array. The class instance's fields and properties are saved as array items in an order kept track of by the SQX compiler. Methods compiles into global functions, with the instance variable (the class array) sent in as the first parameter. This is of course all abstracted by the compiler and not visible to the developer. All SQX is written into .sqx files, and all .sqx files are then compiled into .sqx.sqf counterparts enabling them to be read and interpreted by Arma 3. SOME IMPORTANT NOTES A language limitation: Due to limitations in SQF arrays it is not possible to instantiate two classes that reference each other. I.e. a parent class can have children, but these children cannot contain references back to its parent. The solution is simply to avoid these kinds of structures, and if you still do it you will get a runtime error. An editor limitation: The TypeSqf editor does not have complete autocompletion regarding SQX, but it helps with the most common stuff. E.g. it only suggests one level of chained properties and methods, and it suggests variable names by searching the whole file instead of the actual programming scope context. If you are an advanced developer, please remember that the SQX language does handle most of expected code structures, which is more than the editor will suggest. THE TYPESQF EDITOR Note that this forum is for the SQX Language, which is closely related to, but also separated from, the TypeSqf Editor. Please only post questions and comments regarding the SQX Language here. Questions and comments about the TypeSqf editor goes into the TypeSqf forum. VERSION HISTORY Version 1.07 -SQX: Support for multiline strings (thanks Josef!). Version 1.06 -SQX: Fixed: Analyze of multiple class inheritence levels sometimes resulted in faulty error messages. Version 1.05 -Fixed: Analyzer does not forget about file content in files that are being removed. Version 1.03 -SQX: Refactor of SQF/SQX analyzer and compiler (speeded up the build times a lot). -SQX: Now possible to declare typed variables on a single assignement line (private Scalar _number = 0). -SQX: Now possible to declare typed variables using new SQX keyword 'var' (var _number = 0). Version 1.02 -Fixed: Strange behavior regarding negation symbol (e.g. "return -1;"). -Fixed: No warning when sub class tries to override a method that does not exist in base class. Version 1.01 SQX: Added checks for when a sub class is missing call to explicit base constructor. Version 1.0 First version.- 11 replies
-
- 9
-
Hi, three weeks into Arma and learning most squard controls. What I am missing is "stop all" (or disregard last command). I know how to select team members then use "stop". I keep accidently picking wrong command (normally move) which messes up my squad postions. On pressing space the only option is "regroup". I want a quick "Stop" as well. Also handy for when you want them to stop and wait while you scout ahead. Only way I know is to issue a "move". For example. Heat of battle. You sent commands to members like target, move, stop, etc... basically have them all positioned nicely. I go to instruct a member say "attack" using mouse and by accident issue "move" command. So easy to do. You know you cursor over tagret. Get "attack" press mouse but cursor has gone back to move. Sometimes I also do not select unit (via mouse) so my next command is issues to all. So I am avoiding using attack, stopped using mouse to select units and learning key combos. I know I could script it for my missions. (i have searched on title "regroup" "Stop") ta ---------- Post added at 02:29 PM ---------- Previous post was at 01:54 PM ---------- doh missed ATTN NOOBIES! stickly. Please move this. ---------- Post added at 02:45 PM ---------- Previous post was at 02:29 PM ---------- ignore found what I wanted. key 1 then 6.
-
oo - addClass and createObject, how to use?
CarlGustaffa posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
...\ArmA 2\Expansion\Addons\modules_e\oo\data\scripts\functions has some interesting stuff. I think, lol. Can anyone explain what they do and how to use it?