Jump to content

Recommended Posts

y4mT-7Z9q5Mt0MpYP0KSdcrF3jsayzxyCU63Vo_r

 

TypeSqf Editor 1.08

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.)

 

Code

Code is shared at Github: https://github.com/XEngima/Apps-TypeSqfEdit

 

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

 

There's more. 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 and the search and replace dialog.

 

Changelog

Version 1.08

-Added bracked highlighting (thanks Josef!)

-Added context menu for undo, redo, cut, copy, paste and replace (thanks GHSid!)

-Support for multiline strings in SQF.

-Fixed: The CPack Manager sometimes added non existing file nodes in the project tree view.

-General fixes and improvements.

-SQX: Support for multiline strings.

 

Version 1.07

-It is now possible to rename files and folders in the project tree view.

-Fixed: Addressed some stability issues (thanks Josef!).

-Minor fixes and improvements.

 

Version 1.06

-Added support for all script commands up until Arma 3 version 2.00 (ScriptCommands.xml).

-Fixed: General stability issues in CPack manager.

-Fixed: Settings file not updated with new project when a new project is opened.

-SQX: Updated the SQF/SQX analyzer and compiler to version 1.06.

-SQX: Fixed: Analyze of multiple class inheritence levels sometimes resulted in faulty error messages.

 

Version 1.05

-Improved the syntax highlighting.

-Fixed: Editor crasching when analyzing files that do not belong to current project.

-Fixed: Intellisense sometimes contained multiple identical private variables.

-SQX: Fixed: Analyzer does not forget about file content in files that are being removed.

 

Version 1.04

-Added menu item "Rebuild project" to perform a full reset, reanalyze and build of the project.

-Added support for all script commands up until Arma 3 version 1.98 (into ScriptCommands.xml).

-Made the project root node expanded from start when opening a project.

-General improvements.

-SQF: Now possible to use "#" instead of "select" when selecting from a list (allowed in Arma 3 since version 1.82).

-SQF: Now possible to have empty string literals in params.

-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.03

-Added intellisense when using keyword "override" in a sub class.

-Updated analyzer and SQX compiler to version 1.03.

-SQX: Fixed: Strange behavior regarding negation symbol (e.g. "return -1;").

-SQX: Fixed: No warning when sub class tries to override a method that does not exist in base class.

-Fixed: Help menu link to SQX forum not working.

 

Version 1.02

-Added support for all script commands up until Arma 3 version 1.96 (into ScriptCommands.xml).

-Added status bar that shows replaced occurrences on the replace dialog (thanks Josef!).

 

Version 1.01

-Fixed: Crasch when performing search and replace in text selection (thanks Josef!)
-Updated analyzer and SQX compiler to version 1.01.
-SQX: Added checks for when a sub class is missing call to explicit base constructor.

 

Version 1.0

-Updated analyzer and SQX compiler to version 1.0.
-SQX: Fixed: Debug logging in implicit constructors missing.
-SQX: Fixed: Error when defining an interface with the same name as a class.
-SQX: Added error message explaining that type Number that has changed to Scalar.

 

Version 0.70

-Added search and replace functionality. (Big thanks to Josef!)

 

Version 0.69

-Added support for all script commands up until Arma 3 version 1.96 (into ScriptCommands.xml).
-Updated dependency to .NET to 4.6.2.

 

Requirements
Microsoft Windows.

Other releases
The SQX Script Language (Object Oriented SQF Scripting)

TvT/PvP Campaign Framework (TvTCF)

Campaign - Operation Shoe Lace

Engima's Traffic
Engima's Civilians
Engima's Simple Tasks

  • Like 12
  • Thanks 3

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
Guest

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.

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/

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 2

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

×