Jump to content
Sign in to follow this  
sbsmac

Squint - the sqf editor and error-checker

Recommended Posts

I'm pleased to announce that squint is ready for its first public release.

Squint is an editor and error-checker for ArmA script files (sqf, cpp, ext, sqm) and can save you many hours of headache by detecting syntax errors and common logic problems before you even run your scripts in a mission.

You can learn more about it from this presentation. (If anyone knows how to embed iframe tags in this forum please let me know.)

there is also a basic guide to getting started.

Installation instructions are here or you can just run the setup file from my homepage .

Please be patient while I tidy up the documentation over the next few days. There are certain to be a few bugs as well, please help me out by reporting them rather than ignoring them. I'm also particularly keen to get your suggestions on the kinds of errors you find in your code which squint does not yet catch.

Here's a screenshot...

what3.PNG

Edited by sbsmac

Share this post


Link to post
Share on other sites

Looks great! Nice work! That little guy in the basic guide is awesome, with a capital AWESOME.

Share this post


Link to post
Share on other sites

I tried your first version and that was quite confusing. This version looks much more nicer. Just hope I can change the background away from black.

However, you need to fix the link to the setup file, 404 here.

Share this post


Link to post
Share on other sites

Oops - setup link fixed, thanks for that.

Yes, you can completely customise the colours used in the code-window by going to the Settings/Fonts and colours menu option.

Share this post


Link to post
Share on other sites

I Just fired up my mission and "imported"/add folder. I seems very useful. I fixed all of the errors the hard way already, but it offered to help me with my privates.

Here's my suggestions

- Tabs are evil. Not the actual tab button but the \t one. An option to make an number of spaces when you press tab instead would be nice. If you ever used N++ you know what I mean.

- When you fix missing private declarations it does not indent properly. The text start out completely to the left even if your spawn for example is more to the right.

- Does not detect bis function BIS_fnc_infoText

- Parameters: I use an technigue seen in AAS where the parameters' classes names get assigned to the selected value. Eg. an "class P_Hour" in description.ext get's set to 11 when game starts. P_Hour is non-recognised variable. I know this not possible to do with dynamic variable assignment, however, detected param classes or make an option to turn off the warning perhaps?

- One of my files in UTF-8 without BOM, contained a non-ascii (>127) character. This character got interpreted wrong.

Hope you find at least some of this feedback useful. Keep up the good work :bounce3:.

Edit:

- This is not important unless you have OCD or something like that. If you do have something like that then this: When changing the font type you have to write a character or something similar to get the text in the window to change.

Edited by Muzzleflash

Share this post


Link to post
Share on other sites

Thanks. A few comments.

Changing tabs to 'n' spaces should be fairly straightforward.

Indenting is 'hard' for the parser since it only deals with a logical stream of tokens and expressions rather than knowing about format and spacing. I'm looking at some auto-indent for sqf though in the future (squint can already auto-format cpp).

None of the BIS functions are currently recognised. I just need to build a dictionary for these when I can get to my gaming PC (my back is fubared right now and I'm confined to bed with a crappy laptop).

Parameters- can you provide a short code-example and I'll see what I can do.

UTF8... yes the bane of my life. The richtextbox control used in squint doesn't understand UTF-8 and even if it did, handling multi-byte characters through the data-path would be a serious headache for me atm. *Most* non-ascii's should be handled correctly now but I'm prepared to believe there may be a few that escape under certain circumstances. Again, if you can provide a specific example I can take a look.

Share this post


Link to post
Share on other sites
it offered to help me with my privates.

^LOL

Nice I'll be downloading ASAP.

Share this post


Link to post
Share on other sites
Parameters- can you provide a short code-example and I'll see what I can do.

Again I understand dynamic variable assignment is tough and it is totally fine if you decide my parameter case does not warrant an exception. Here is part of an description.ext:

class P_Hour
   {
       title = "Hour of day";
       values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
       texts[] = {"00:XX", "01:XX", "02:XX", "03:XX", "04:XX", "05:XX", "06:XX", "07:XX", "08:XX", "09:XX", "10:XX", "11:XX", "12:XX", "13:XX","14:XX", "15:XX", "16:XX", "17:XX", "18:XX", "19:XX", "20:XX", "21:XX", "22:XX", "23:XX"};
       default = 12;
   };

The following script turns the class into a variable. If run in the editor then P_Hour = 12;. Cause 12 is default. In mp or somewhere where you can specify parameters it get's set to that value. The benefit of this approach I think is that it does not require you to maintain order in the params and you don't do manual indexing into paramsArray. This is the script that does the work:

if (isNil "paramsArray") then {
if (isClass (missionConfigFile/"Params")) then {
	for "_i" from 0 to (count (missionConfigFile/"Params") - 1) do {
		_paramName = configName ((missionConfigFile >> "Params") select _i);
           _paramValue = getNumber (missionConfigFile >> "Params" >> _paramName >> "default");
           call compile format ["%1 = %2", _paramName, _paramValue];
	};
};
} else {
for "_i" from 0 to (count paramsArray - 1) do {
       _paramName = configName ((missionConfigFile >> "Params") select _i);
       _paramValue = paramsArray select _i;
       call compile format ["%1 = %2", _paramName, _paramValue];
};
};

Again this might be a special case, however you need some way to tell squint that this variable, even if not recognized, is okay. "I got this one squint".

UTF8... yes the bane of my life. The richtextbox control used in squint doesn't understand UTF-8 and even if it did, handling multi-byte characters through the data-path would be a serious headache for me atm. *Most* non-ascii's should be handled correctly now but I'm prepared to believe there may be a few that escape under certain circumstances. Again, if you can provide a specific example I can take a look.

I'm surprised that .Net does not support UTF all the way. A specific example is this:

In N++:

/*
Søren Enevoldsen - Muzzleflash - Deadecho
*/

In Squint

/*
Søren Enevoldsen - Muzzleflash - Deadecho
*/

I noticed that my file somehow got saved with BOM. I changed it back and reloaded in squint it did not make a difference to it's interpretation.

EDIT: The good part is at least is saves the character(s) the same way it loads them. Saving in Squint (with the expanded byte representation) produces the correct result, which I verified by loading in N++ after.

-------------------------

^LOL

Nice I'll be downloading ASAP.

Yeah had a laugh myself when I wrote that :D

---------- Post added at 01:04 ---------- Previous post was at 00:49 ----------

Using the preprocessed view seems to FUBAR the syntax highlighting (Notice the T too):

problem.jpg

Edited by Muzzleflash

Share this post


Link to post
Share on other sites
I'm also particularly keen to get your suggestions on the kinds of errors you find in your code which squint does not yet catch.

Yay! I finally managed to come up with one. (just reported)

:drinking2:

But that default background color for the editor window.. sure, fortunately one may change it, but still....

...are you friggin serious?!

Black!? :icon_bash:

:D

Share this post


Link to post
Share on other sites

One of the web guys I work with swears by a black background for coding. I have no idea why! :)

Share this post


Link to post
Share on other sites
Yay! I finally managed to come up with one. (just reported)

:drinking2:

But that default background color for the editor window.. sure, fortunately one may change it, but still....

...are you friggin serious?!

Black!? :icon_bash:

:D

Well, if you're using it for extended periods of time, black is easier on the eyes than white, and it also makes the highlighting more... highlighted.

Share this post


Link to post
Share on other sites

flippin awesome tool. fixed a bunch of errors right on loading. Thanks for a great tool.

an this work for HPP files?

Edited by gunterlund21

Share this post


Link to post
Share on other sites

Awesome tool thanks for sharing, already found some errors in a couple of scripts that I didnt even notice.

Share this post


Link to post
Share on other sites
One of the web guys I work with swears by a black background for coding. I have no idea why! :)

Maybe that way it feels more like Neo hacking the matrix or something in this direction :cool:

Well, if you're using it for extended periods of time, black is easier on the eyes than white...

Black? As a background color? Easier on the eyes? To read (white and even colored!!!) text?

...

Are you shitting me?

:D

Share this post


Link to post
Share on other sites

I don't use black, but very dark colored background. Less blinding than white background. When you play a lot of "dark missions", it matters a lot. I even have means to put a red/black marker over the map to make it less blinding.

You should see my UltraEdit colors :D

Share this post


Link to post
Share on other sites

cool tool. from a cpp point of view I would love to see a class explorer which would allow quick navigation in huge configs.

Share this post


Link to post
Share on other sites
Maybe that way it feels more like Neo hacking the matrix or something in this direction :cool:

Black? As a background color? Easier on the eyes? To read (white and even colored!!!) text?

...

Are you shitting me?

:D

To read white text, it'd be bad, but it's almost all highlighted in different colours. So for me at least, it's easier on the eyes than having the same highlighting but a white background.

Share this post


Link to post
Share on other sites

OMG! This is AWSOME!

None of the BIS functions are currently recognised. I just need to build a dictionary for these when I can get to my gaming PC (my back is fubared right now and I'm confined to bed with a crappy laptop).

Surely someone can help with this?

Share this post


Link to post
Share on other sites

Please enable "Browse" for folder ASAP.

I find that nice because you can copy and paste the folder your in already.

Also an undo would be real nice and when you go to reload a project and want to dump all your changes it really shouldn't ask me about every file that has changed.

Edited by callihn

Share this post


Link to post
Share on other sites

Obviously some of you never had to work with white/green on black monochrome 40x25 monitors back in the day..... ;-) And you should be grateful I changed the font away from 'Comic Sans' which I'd been using as a placeholder during development.

Anyway you can change colours by going to the "settings/fonts and colours" menu option. I may at some stage introduce different 'themes'. In the meantime everlasting glory will go to the person who can come up with a nicer combination of colours and post it here as a new default. The easiest thing to do is post a small screenshot and a link to your config file which is well hidden on your disk but which you can find by running this command at the command prompt

c:\> findstr /s squint.Properties.Settings user.config

If this command turns up multiple files and you're not sure which one is correct, try changing the Settings/Path to something unique like "jabberwocky" and searching for that instead.

To answer some of the other points...

you need some way to tell squint that this variable, even if not recognized, is okay. "I got this one squint".

Yep on the list - see http://dev-heaven.net/issues/12493 . I'll probably just start out with a 'per-file' exception mechanism.

(on UTF-8) The good part is at least is saves the character(s) the same way it loads them

Yes I worked quite hard to make sure that what went out was the same as what went it. Handling different encodings is 'difficult' especially as the data-path assumes that each character is one byte (not good for internationalisation but indexing errors into the file is a nightmare otherwise).

Using the preprocessed view seems to FUBAR the syntax highlighting (Notice the T too):

Yep- known issue -see http://dev-heaven.net/issues/12912

Can this work for HPP files?

Yes, if you drag an hpp file into the file list you can open it but they are currently mis-categorised as sqf files. To fix this, just right-click on the filename in the file-list and choose "Select Grammar->CPP" from the popup menu.

from a cpp point of view I would love to see a class explorer which would allow quick navigation in huge configs.

You can already use simple text search but it would be fairly straightforward to add a right-click option to show both parents and owners. For example if you right-clicked on 'class myMagazine' you might get a little dialog showing....

Owners: Magazines>>USMagazines>>SD>>myMagazine

Parents: myMagazine:myDefaultMag:30rndStandardMag:Magazine

More interesting would be the ability to 'jump to parent/owner' from a right click. I don't work with configs a lot so let me know what kinds of things would be useful.

Please enable "Browse" for folder ASAP.

Can you be a bit more specific ? Are you talking about the "File->add to project->Folder" browser ? It's a bit rubbish - will look at changing it. Tbh I never use "File-add To project", it's much easier just to drag files, folders or pbo's from the desktop into the file-list to add them to the project.

- This is not important unless you have OCD or something like that. If you do have something like that then this: When changing the font type you have to write a character or something similar to get the text in the window to change.

Good catch - will add to the list.

Edited by sbsmac

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
Sign in to follow this  

×