Jump to content

Recommended Posts

y4mT-7Z9q5Mt0MpYP0KSdcrF3jsayzxyCU63Vo_r

 

TypeSqf Editor 0.61

by Engima

 
Overview
The TypeSqf Editor is a script editor for Arma 3. The most important features are:

  • Syntax Highlighting
  • Syntax Checking
  • Auto Completion
  • Folding
  • Object Oriented Scripting (SQX Syntax)
  • CPack Service (like nuGets in Visual Studio)

 

Description

The TypeSqf editor is a developer's tool for scripting in Arma 3. Besides using it to write SQF code with syntax highlighting and auto completion, it analyzes your syntax in real time, alerting you if something is erroneous or suspicious.

 

Object Oriented Scripting
The editor comes with an optional extended functionality for SQF syntax, called SQX. In a convenient way, and with as many similarities to SQF as possible, SQX enables object oriented scripting (classes) and adds type handling. Classes may contain a constructor, fields, properties and methods. It works because the .sqx files are compiled into corresponding .sqf files before executed by Arma 3.

 

The CPack Service

The CPack Service is a service for sharing content with other script editors as well as to organize your own code. In short a CPack is a content bundle (a .zip file) that you upload and label with a name and a version number. Then they are very easy for anyone to download and include in any mission.

 

Download

Download at Official TypeSqf Site.
 

Installation / Usage

1. Open the zip file and run the installer.
2. Run TypeSqf from the start menu.

(See the video "Getting started with the TypeSqf editor" below.)
 

Media:

Getting started with the TypeSqf editor.

 

Creating and using an SQX Crowd class in Arma 3 using the TypeSqf Editor.

 

More videos:

TypeSqf Features Part 1 - Getting started with TypeSqf

TypeSqf Features Part 2 - Main Features

TypeSqf Features Part 3 - The Power Of CPacks

TypeSqf Features Part 4 - The CPack Console

 

You can find all videos here.

 

Feedback and error reports

I will gladly receive any feedback. Please tell me good things, bad things, errors, whishes etc. Please use this forum thread for comments, but email all error reports to typesqf@outlook.com.

 

Thanks to

Josef - The main man on auto completion for script commands.

 

Changelog

Version 0.61

-SQX: Added parameter check in calls to constructors (if first command in constructor is "params").

 

Version 0.60

-Added parameter check in calls to functions (if first command in function is "params").

-SQX: Added parameter check in calls to methods (if first command in method is "params").

-SQX: Added support for static fields in classes.

-SQX: Added support for static properties in classes.

-SQX: Fixed: Some Operators compiled incorrectly (e.g. the lookup operators >> and /).

-SQX: Fixed: Compiler adds faulty semicolons at end of array elements.

 

Version 0.59

-Added all script commands in Arma 3 version 1.76.

-It is now possible for CPack authors to add a line to the top of description.ext.

-Fixed: Crasch if the CPack installer tries to write to a file that is open by another process.

-Fixed: Stability issues.

-SQX: Analyzer improvements.

 

Version 0.58

-Project file is now saved automatically when starting a new project or opening an existing mission.

-Added video "TypeSqf Features Part 4 - The CPack Console".

-Fixed: No code completion on lines with the alternative variable declaration syntax.

-SQX: Fixed: Compiled files (.sqx.sqf) is not removed when a CPack is removed.

-SQX: Analyzer improvements.

-SQX: Fixed: Compiler sometimes not starting.

 

Version 0.57

-Added menu item "Videos" with links to tutorial videos.

-Analyzer improvements.

-SQX: Analyzer improvements.

 

Version 0.56

-Enabled support for alternative variable declaration syntax. Like { private _myVar = 10; }.

-Analyzer improvements.

-SQX: Syntax Highlighting improvements.

-SQX: Analyzer improvements.

 

Version 0.55

-New and better installer (uninstall the old version before installing this).

-Variables declared in mission.sqm now included in editor (mission.sqm must not be binarized).

-Items in the file explorer now gets selected on right click.

-SQX: Minor analyzer improvements.

 

Version 0.54

-Added all script commands in Arma 3 version 1.72.
-Revealed SQX content (it was previously "beta content").
-SQX: Added enums.
-SQX: Added code completion for static methods.
-SQX: Added code completion for custom types (classes and interfaces).
-SQX: Minor fixes in the analyzer.

 

Version 0.53

-Fixed: Error when updating CPacks and files need to be overwritten.

-Fixed: Improved checks for declared, non declared, used and not used variables.

-SQX: Added static methods.

-SQX: Made it possible to specify type on iteration variable in a forEach statement. Like "{ hint _x } forEach as String;".

-SQX: Made it possible to specify type on iteration variable in a count statement. Like "_count = { _x.IsActive } count as MyClass;".

-SQX: Fixed: Analyzer do not recognize interface types for method return values.

-SQX: Fixed: Minor issues in analyzer.

 

Version 0.52

-Logical operators 'and' and 'or' now supports alternative syntax with signature "Boolean and Code".

-Fixed: Files installed by CPack dependencies are not added to project file explorer.

-Fixed: Error when installing CPacks with dependencies to same package but different version.

-Fixed: Minor issues and improvements in analyzer.

-SQX: Added interfaces.

-SQX: Changed name of data type Number to Scalar (the same name as in SQF).

-SQX: Added interface templates (you will need to reset templates for them to regenerate).

 
Requirements
Microsoft Windows.

Other releases
Engima's Traffic
Engima's Civilians
Engima's Simple Tasks

  • Like 9
  • Thanks 1

Share this post


Link to post
Share on other sites

Awesome! Looks like Notepad++ but with fancy instant error checking! Will definitly test when back from work.

 

But question: Can it also edit .ext and .hpp files? So I can use this for all my mission editing needs?

Share this post


Link to post
Share on other sites

Great work but why reinvent the wheel ?

I can already use notepad++ or the amazing sumblime text (or the free equivalent Atom) and even the heavy but beatiful intellij. Imo it is a waste of time.

  • Like 1

Share this post


Link to post
Share on other sites

Great work but why reinvent the wheel ?

I can already use notepad++ or the amazing sumblime text (or the free equivalent Atom) and even the heavy but beatiful intellij. Imo it is a waste of time.

 

My thoughts exactly.

 

It's good to have alternatives but even just getting this on par with things like poseidon is still going to take a lot of work.

 

 

 

The other thing is.... this thread really belongs here:

https://forums.bistudio.com/forum/163-arma-3-community-made-utilities/

  • Like 1

Share this post


Link to post
Share on other sites

Awesome! Looks like Notepad++ but with fancy instant error checking! Will definitly test when back from work.

 

But question: Can it also edit .ext and .hpp files? So I can use this for all my mission editing needs?

Right now it handles .sqf files only. But I don't see it as finished, and hope to get it in later. At lease if community likes it.

Share this post


Link to post
Share on other sites

Maybe one idea that would be incredible useful: Treat files starting with fn_*.sqf as functions and allow new files to be automatically added to a include.hpp or description.ext in the correct class CfgFunctions {}.

All editors I tested treat SQF functions as scripts. It would be awesome to hide the file and .ext registrations behind an UI (but allow changes by hand aswell).

  • Like 1

Share this post


Link to post
Share on other sites

Great work but why reinvent the wheel ?

I can already use notepad++ or the amazing sumblime text (or the free equivalent Atom) and even the heavy but beatiful intellij. Imo it is a waste of time.

When I started development the only alternatives were Notepad++ and Squint (worked good for Arma 2 only). And this TypeSqf editor is not exactly new. I've used it a long time. But it has been a little buggy, so I have not wanted to tell everyone about it. Suddenly I found it in quite stable shape, so why not release it now? And noone I have seen yet offers any similarity to my CPack service. :)

  • Like 1

Share this post


Link to post
Share on other sites

Trying this out, thank you. I too dream of 'son of Squint'. :)

 

Early impression is that it's really only missing one thing... bracket/parenthesis matching.

Share this post


Link to post
Share on other sites

No, it actually misses one more thing, to search in all files in the project. Fixed now! :)

 

v0.35
- Added search option "Find in all files".

Share this post


Link to post
Share on other sites

Maybe one idea that would be incredible useful: Treat files starting with fn_*.sqf as functions and allow new files to be automatically added to a include.hpp or description.ext in the correct class CfgFunctions {}.

All editors I tested treat SQF functions as scripts. It would be awesome to hide the file and .ext registrations behind an UI (but allow changes by hand aswell).

Hi NeoArmageddon!

 

Thanks for the suggestion! Of course things like these can go into the editor if they are common and useful and not messeing up the minds of the users.

 

But I'm wondering, is this a common design pattern? And also, exactly what problems are solved? Is it very difficult to add the function information to CfgFunctions by hand?

Share this post


Link to post
Share on other sites

Hi NeoArmageddon!

 

Thanks for the suggestion! Of course things like these can go into the editor if they are common and useful and not messeing up the minds of the users.

 

But I'm wondering, is this a common design pattern? And also, exactly what problems are solved? Is it very difficult to add the function information to CfgFunctions by hand?

I think the basic is to auto add a fnc,to the includes/hpp or ext. and not treated as .sqf .

unless i misunderstand, but anything closer to the real Squint , would be the giggles in shit.. (cats meow). thanks for sharing.

im ganna follow this and dream of it being better than what we already have.not complaining about note pad and what not, but simplicity is the way to go, no matter what you can add just make it auto , no editing settings.

Share this post


Link to post
Share on other sites

But I'm wondering, is this a common design pattern? And also, exactly what problems are solved? Is it very difficult to add the function information to CfgFunctions by hand?

 

Yes, that is the way SQF functions have to be written, to be provessed by the game as function and not just as code variable (for example to be shown in the function library or to be able to recompile them at runtime. Very handy feature for mission development).

 

Adding the functions by hand is not a problem, but it is cumbersome in two ways: 1) You need to be exact in naming both file and functions 2) Every function needs it's own file, that makes it hard to navigate your local library.

Share this post


Link to post
Share on other sites

how correct is your text editor? 

 

i get errors for Private variable '_Unit' not declared

 

but in my script i use _Unit = param [0];

 

So do i need to use

Private ["_Unit"];

_Unit = param [0];

 

there are a few more error types like syntax , ive used ' instead of ".

with the param [0];  is same as this select 0;

but if i put _Unit addEventHandler ['Respawn',{_this select 0 execVM

i get 0 cannot be used as a target for assignment.

 

so should _Unit addEventHandler ['Respawn',{_this select 0 execVM

be done like this

_Unit addEventHandler ['Respawn', { params []{  execVM

 

thanks, hope this isnt too of a noob question.

That is a good question.

Actually, the question "How correct is your text editor" is up to the user to decide, and I am curious and interested in your and all user's opinion - each with their own coding conventions and ways to do things. I believe that for some users the editor will fit very well, and for some maybe not. For myself of course, I'd say it handles .sqf scripting very well and how I prefer it to be.

However, SQF script engine is quite complex, and sometimes the editor and what acutually can be done might differ a bit, and that is because the language structure and engine interpretation is reverse engineered. I don't know how SQF interpretor works, so a challange has been to find out. My goal all the time has been to allow for everything, but sometimes the TypeSqf editor requires one way of doing it when in reality there are alternative ways of doing it. An example would be use of parenthesis. This is not a real example, but say you enter this line:

 

_class = _classes select 10 + floor random 10;

 

TypeSqf might complain, because it evaluates the plus before the select or vice versa, when in reality it works (or not works) in real SQF engine. Solution is simply to add parenthesis, which I mean in this case is better for the user too sinse it increases readability:

 

_class = _classes select (10 + floor random 10);

 

Here's also my comments on things you mention:

I have chosen to require variable declarations for several reasons. One is it enables the editor to help the user with things like spelling. Another, more important imo, is that if variables might be named the same in an inner and outer scope. Without declaration the script engine will see the variables as the same variable, and altering the value of the inner will alter the value of the outer, which most often is seen bad coding that breaks scripts. If the variables with the same name is declared in their respective scopes, they will be treated as two different variables. In general from the editor's point of view: a declared variable is easier to track and it is easier to interpret the user's intention of having it - like detecting if it's no longer used etc.

Single quotes (') versus double quotes (") might be one thing that is still a little limiting. However, and as you write, I would think that there is always an alternative solution that could be used. And of couse, things can be erroneous or too limiting. In that case, let me know. I haven't had many beta testers this far.

For the issue with the eventHandler part, use parenthesis. I'd say that it is also much easier to read for a user:

_Unit addEventHandler ['Respawn', {(_this select 0) execVM ...

Share this post


Link to post
Share on other sites

In addition: BI said either declaration only

private["_my","_vars"];

or declaration and initialization like

private _my = true;
private _var = 3.141;

Is the correct way to work with local variables when you are using functions. So if you ask me, the editor already works good enough according to official documentation.

Share this post


Link to post
Share on other sites

hmm, I think if you're an experienced scripter this tools editor is great , I went thru  8 to 10 scripts just following errors 

and found some scripts not working anymore in game with a lot of errors in rpt.

 

So in my case (NOT GOOD) for noobs like me.

 

but me being that guy that will kick a dead horse because I need to know more will continue 

trying to see where I went wrong in your editor.

 

 

i forgot to say most of my scripts were using params[];  not  Private [];

https://community.bistudio.com/wiki/params

maybe this is where I thought I needed to fix because your editor wants Private [];

So in this case, do i keep both? or ignore the variable declarations

and just add (if missing) to the params[];

 

also, I don't think there is any dependable editor out there for noobs

most tell you there's an error on some line of your script but not really how to fix.

your editor seems to be trying to give answers wich is awesome, keep up the good work.

Share this post


Link to post
Share on other sites

Actually I have never used params[...] myself, so I will look into it. But when I read about it, it just seems to parse an array into local variables, not declare them. Have you tried keeping the params command but just add the private [...] with local variables above? But I have probably misses something. This is a quite new command, and if it's broken I will fix it.

Share this post


Link to post
Share on other sites

It's a better version of BIS_fnc_param, and yes it declares them. There's no reason to use 

_this select
anymore

Share this post


Link to post
Share on other sites

Actually I have never used params[...] myself, so I will look into it. But when I read about it, it just seems to parse an array into local variables, not declare them. Have you tried keeping the params command but just add the private [...] with local variables above? But I have probably misses something. This is a quite new command, and if it's broken I will fix it.

 

params makes declaration of the variables it initializes redundant (infact I think param["_something"]; private _something = true; will throw an error).

Share this post


Link to post
Share on other sites

@ Neo this is problem I believe I'm having , but

 

Private ["something" ,"somethingelse"];

and

params ["something" ,"somethingelse"];

seems redundant to need both. but some scripts throw error's when i take out params.

Im kinda stuck at having to use both.

IE: if i only use  params ["_something" ,"_somethingelse]; I get the error  " _something" not being decleard .

Share this post


Link to post
Share on other sites

Actually I have never used params[...] myself, so I will look into it. But when I read about it, it just seems to parse an array into local variables, not declare them. Have you tried keeping the params command but just add the private [...] with local variables above? But I have probably misses something. This is a quite new command, and if it's broken I will fix it.

yes, if i just use Private ["_script"]; I later get errors in the game because I'll be lacking _this select 

if i use params ["_script"]; I get an error in your tool (needing to declare _script).

 

I'm using both, but it's double the work. and I'm not fully positive yet of errors till I play a match on dedicated server beginning to end.

Share this post


Link to post
Share on other sites

so here is my initPlayerlocal.sqf

Private ["_player" ,"_isJIP"];
params ["_player" ,"_isJIP"];

_player = _this select 0;
_isJIP 	= _this select 1;

if (!_isJIP) then 
{
[_player] call Blood_Bath_fnc_playerSpawn;

};

if (_isJIP) then
{
[_player] call Blood_Bath_fnc_JIPSpawn;

};

[]execVM "SA\scripts\markerJip.sqf";

Private ["_target" ,"_caller" ,"_dead" ,"_body" ,"_killer" ,"_killed" ,"_victim"];

player addEventHandler [ "Respawn", {[player] call fnc_setPgunHandle}];
player addEventHandler [ "HandleRating", {0}];

addMissionEventHandler [ "EntityKilled", {
  params ["_killed", "_killer" ];
  
  if ( _killed isKindOf "Man") then {
      _killed addAction ["<img image='\a3\ui_f\data\gui\cfg\debriefing\enddeath_ca.paa' align='center' size='1.2'/>{Bury The Dead}</t>",{
	    params ["_target", "_caller"];
	    private _body = _target getRelPos [-0.01, 0];
	    hideBody _target;
        deleteVehicle _target;
        _caller playActionNow "MedicOther";
        private _dead = createSimpleObject ["A3\characters_F\blood_splash.p3d",_body];
        _dead setPos (_body vectorAdd (getPosWorld _dead vectorDiff (_dead modelToWorld [0,0,0])));
        _dead setPos [(getPos _dead) select 0, (getpos _dead) select 1, 0.5];
     
	 },nil,0.1,true,true,"","(_target distance _this) < 2"];
   };
}];

player addMPEventHandler ["MPKilled", {
  params ["_victim", "_killer"];

   if ( typeOf _killer isKindOf "Man") then {
     systemChat format ["%1 was killed by %2", name _victim, name _killer];
   };
}];
player addEventHandler ["InventoryOpened", {
  [] spawn {waitUntil { !(isNull (findDisplay 602)) };
     createDialog "DigitalLoadout";[(_this select 0)] call loadChange;
   };
true}];

["InitializePlayer", [player]] call BIS_fnc_dynamicGroups;
  [] spawn {sleep 10;hintSilent "Press U to open Group Manager";
};

and here is list of what editor is saying

f9qp7k.jpg

Share this post


Link to post
Share on other sites

@ Neo this is problem I believe I'm having , but

 

Private ["something" ,"somethingelse"];

and

params ["something" ,"somethingelse"];

seems redundant to need both. but some scripts throw error's when i take out params.

Im kinda stuck at having to use both.

IE: if i only use  params ["_something" ,"_somethingelse]; I get the error  " _something" not being decleard .

This issue is now fixed. Thanks for notifying me about the problem.

 

And again, please do not fill this thread with error reports. Send them to typesqf@outlook.com instead. In this thread I am hoping for user experience reports, idéas and all other comments.

 

New version published:

v0.36

- Added auto completion.
- Fixed: Script command params did not declare variables.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×