OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Resources Beta Testing & Submission => Topic started by: sbsmac on 23 Aug 2010, 10:52:01

Title: Squint - the sqf editor and error-checker
Post by: sbsmac on 23 Aug 2010, 10:52:01
Squint is an editor and static-analyser for ArmA script files 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.

Whilst it was primarily designed for sqf analysis, it can unbinarise rap files, even those within pbos, and do cursory analysis on these.  This is an area I'm particularly keen to improve and not being an addon-maker myself I could do with some advice on what 'common errors' could be caught.

You can learn more about it from this presentation: https://docs.google.com/present/edit?id=0AZ7iqGyosaZyZGNkOHg2Z3ZfMjVjM3JwN3FjNw&hl=en

there is also a basic guide to getting started: https://docs.google.com/present/edit?id=0AZ7iqGyosaZyZGNkOHg2Z3ZfNWQ2aHNuM2hk&hl=en

Installation instructions are at https://sites.google.com/site/macsarmatools/squint/installation-1

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

(http://www.armaleague.com/mac/misc/what3.PNG)
Title: Re: Squint - the sqf editor and error-checker
Post by: kju on 23 Aug 2010, 12:32:19
Very much recommended to every scripter.  :good:
No matter if you are beginner or expert.
It will be extremely helpful to any level of expertise.

Even more you can make the app even more useful
and powerful by providing Mac with feedback and suggestions.  :clap:
Title: Re: Squint - the sqf editor and error-checker
Post by: JamesF1 on 23 Aug 2010, 12:58:11
As I said on the BIS forums: a thoroughly brilliant tool, and one I'll be making extensive and exclusive use of in the future.  Something I've wanted to do for a long time, but never had the patience to follow through on it (language parsing has always frustrated me  :P).

As kju said, I'd thoroughly recommend this to all and sundry.
Title: Re: Squint - the sqf editor and error-checker
Post by: haroon1992 on 28 Aug 2010, 16:09:19
How can i download the installation file so that I could later install SQUINT on my laptop which has no Internet Connection?

Title: Re: Squint - the sqf editor and error-checker
Post by: sbsmac on 28 Aug 2010, 19:20:32
Hmm - tricky one.  Squint doesn't need an internet connection to run but it does need one for installation (and auto-update).

It's possible you could work around the installation problem by installing it on a connected PC then copying the exe and related dlls to your laptop. You can find them by searching under
"Documents And Settings\<username>\Local Settings\Apps\..."
Title: Re: Squint - the sqf editor and error-checker
Post by: haroon1992 on 29 Aug 2010, 16:35:11
I'll try it, thanks for the reply and for this tool which seems very useful.

Regards,
Haroon1992
Title: Re: Squint - the sqf editor and error-checker
Post by: sbsmac on 29 Aug 2010, 20:43:18
No problem.  :)

Probably worth posting the latest update here as well (copied from the project update page (https://sites.google.com/site/macsarmatools/project-updates)) 

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

Squint went public just over a week ago and the feedback has been extremely pleasing...

But no release is perfect and there have been a lot of great suggestions on how to improve squint.  Based on those I've been working hard to add the following features....

    * Support for the following file-extenstions: *.ext;*.sqm;*.cpp;*.hpp;*.rvmat;*.bin;*.cfg;*.pbl
    * Line-numbers have been added to the code-window.
    * Search and replace have been added
    * An 'undo' feature has been implemented
    * A basic auto-indent has been implemented; you can auto-indent code as you go along or select a region and hit TAB to auto-indent.
    * Auto-complete/intellisense has been implemented.  When enabled, squint will monitor your typing and offer you a choice of possible completions in a pop-up dialog box. This really saves a lot of time and effort for those long BIS_fnc_.. names! Auto-complete can also offer you completion for local variable names that are in scope and can help you avoid 'bracket-fatigue' by offering completions for common control constructs, eg  "for [{},{},{}] do {};" as a completion of "for".
    * The colour scheme is more flexible than before. You can change the background colour and font used by the file-list and error-list and you get an immediate preview of your colour-changes for the code-window.
    * You can import and export colour 'themes'; I hope to host some user-made themes on the squint website over the next week - please contact me via the BIS forums if you have a colour-scheme you'd like to share.
    * BIS & ACE function names have been added to the dictionary as 'known' global variables.
    * An external helper app allows shell-integration.  Just right click on a file to open it in squint !
    * Support for binarised files is now implemented.  You can edit the contents of config.bin or any other binarised file, even those already inside pbo's.
    * The error-detection phase is now much faster for large multi-file projects.
    * The code-window now has much less flicker when jumping around within a file.
    * As well as the new features, a significant number of bugs have been fixed including one that could cause squint to hang while idle.


Thanks to all who have provided feedback so far - please keep it coming to help me improve the tool.

To learn more about the new features, see these two links

    * Shell integration (https://sites.google.com/site/macsarmatools/squint/shell-integration)
    * Tips & Tricks (https://sites.google.com/site/macsarmatools/squint/tips-tricks)


As always, existing users should find that they are automatically updated to the latest version which is currently 1.0.0.95.  If squint is not updating, you can force an update by re-running the setup (https://sites.google.com/site/macsarmatools/squint/installation-1) file.

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

I'm current working on support for 'big' projects (ie 10s to 100s of files) where there is a requirement to be able to mask certain squint errors (on a per-file or per-block basis). As always, feedback from actual users is appreciated - I'm always particularly keen to hear about the script-errors that squint doesn't find.
Title: Re: Squint - the sqf editor and error-checker
Post by: sbsmac on 03 Sep 2010, 23:52:55
This week's update...

Squint is starting to take shape as the kind of tool I want it to be.  Some recent changes have made it much more useful for analysing large projects.
 
Firstly, there is a powerful new filter system which you can read about at https://sites.google.com/site/macsarmatools/squint/filters-and-the-dictionary. This enables you to quickly filter out 'false' warnings or those which you're not interested in.

Second, squint now does a much better job of only recalculating invalid data, for example when you update the filter list squint now only recalculates the error list rather than reparsing every file.  Processing of large files is also now much faster.

Thirdly the UI responsiveness has been much improved, particularly when auto-complete is enabled.


My testbed for these changes has been the Operation Arrowhead missions.pbo file which contains over a thousand sqf, cpp and hpp files. On my 2GHz laptop squint is now able to read, analyse and report on this pbo in less than 30 seconds.  Constructing a set of filters to focus in on the important bugs takes around 10 minutes.

In addition to these changes, I've added several new error-checking rules and fixed the usual clutch of bugs.  As always, I'm keen to hear from people on how they think the tool can be improved, my next focus will probably  be on config files where there are still some improvements required in squint's ability to recognise some kinds of input.
Title: Re: Squint - the sqf editor and error-checker
Post by: haroon1992 on 13 Sep 2010, 15:47:39
I really really want to use this tool as it sounds cool.

But with that internet requirements for the setup, I can't use it.

Hope you would add a REAL setup file soon.

Also, thanks for developing such a helpful tool for the community.


Regards,
Haroon1992
Title: Re: Squint - the sqf editor and error-checker
Post by: sbsmac on 16 Sep 2010, 17:02:44
Hmm - does the suggestion to install on a connected machine then just copy the exe across not work for you ?
Title: Re: Squint - the sqf editor and error-checker
Post by: haroon1992 on 17 Sep 2010, 09:30:55
They use Deep Freeze here, so when you restart, nothing's left...
(restart is required when dot-net 4.0 is finished installing the contents)

And what's the point of requiring an internet connnection to install your software?

That software, visual dialog maker also required an internet connection, is that yours too?(just a doubt)



Regards,
Haroon1992
Title: Re: Squint - the sqf editor and error-checker
Post by: sbsmac on 18 Sep 2010, 22:27:10
Quote
They use Deep Freeze here, so when you restart, nothing's left...
(restart is required when dot-net 4.0 is finished installing the contents)

Interesting - I wasn't aware of this application- your original request makes a bit more sense now I understand you only have network access at work ! :)

Quote
That software, visual dialog maker also required an internet connection, is that yours too?(just a doubt)

No - that was from someone-else.

Quote
And what's the point of requiring an internet connnection to install your software?

Squint uses 'Clickonce' deployment (see http://en.wikipedia.org/wiki/ClickOnce).  The huge advantage of this from my perspective is that it provides automatic updating for users.  Since I am still adding several features each week this makes it much easier to keep everybody in step with the latest version.

I've been looking at whether it is possible to get ClickOnce to install from a local copy but haven't found anything yet... sorry.

*Edit* you could try copying the contents of http://www.armaleague.com/mac/squint/bin/ to a local directory and running the setup.exe from there.   I really don't know if this will work though.
Title: Re: Squint - the sqf editor and error-checker
Post by: haroon1992 on 25 Sep 2010, 15:53:33
Thanks for considering my advise...
Quote

you could try copying the contents of http://www.armaleague.com/mac/squint/bin/ to a local directory and running the setup.exe from there.   I really don't know if this will work though.

I've already tried that and it failed.

Regards,
Haroon1992
Title: Re: Squint - the sqf editor and error-checker
Post by: zonker3210 on 29 Sep 2010, 17:47:51
Squint uses 'Clickonce' deployment (see http://en.wikipedia.org/wiki/ClickOnce).  The huge advantage of this from my perspective is that it provides automatic updating for users.  Since I am still adding several features each week this makes it much easier to keep everybody in step with the latest version.

I've been looking at whether it is possible to get ClickOnce to install from a local copy but haven't found anything yet... sorry.

Have you tried setting the "Install Mode" setting?

How to: Specify the ClickOnce Offline or Online Install Mode
http://msdn.microsoft.com/en-us/library/y0507x17%28VS.100%29.aspx

An alternative is to create two separate build configurations as detailed here...
http://stackoverflow.com/questions/1679889/clickonce-cd-setup-tries-to-connect-to-the-internet

It's really not that hard to do from your perspective but users such as haroon1992 will need to understand that they won't reap the benefits of the ClickOnce update system. I doubt that's a major problem when compared to not being able to use Squint at all without an offline installer.
Title: Re: Squint - the sqf editor and error-checker
Post by: haroon1992 on 29 Sep 2010, 18:02:36
Right now,I just want to use the software.

(I wish updates to be also downloadable ones just like ArmA Edit)

Regards,
Haroon1992
Title: Re: Squint - the sqf editor and error-checker
Post by: zonker3210 on 30 Sep 2010, 00:34:06
Sorry for the confusion but my previous post was directed towards sbsmac since, as I indicated, he will need to modify his build configuration (or possibly his build process itself) in order to allow offline/manual installation. ClickOnce is an excellent deployment option but unfortunately it isn't a good fit for all scenarios.
Title: Re: Squint - the sqf editor and error-checker
Post by: haroon1992 on 30 Sep 2010, 04:03:47
Yeah I know it..
I'm just declaring that I can go without an update.
(if the version is bug-free in sqf scripting ,of course)
Title: Re: Squint - the sqf editor and error-checker
Post by: sbsmac on 30 Sep 2010, 19:00:13
zonker - thanks for the information.  Unfortunately the first link just restates what I already suspected which is that while you can choose to allow an application to _run_ while either offline or online, there doesn't seem to be a way to get the benefits of installing from a local copy combined with auto-update from a remote copy.

In any case, I have made haroon a special distribution which can be downloaded from
  http://www.armaleague.com/mac/misc/squint_v119.rar

Get it quick since I'll delete it fairly soon ! :)
Title: Re: Squint - the sqf editor and error-checker
Post by: zonker3210 on 30 Sep 2010, 19:48:28
@sbsmac: Sorry if the links provided weren't helpful. You can install a ClickOnce from a local copy (i.e., a CD) and then specify a different (i.e., internet, network, etc.) location which the app will check for a newer versions. However, doing so is still not going to help in cases like haroon1992's since the auto-update feature is still going to face the same lack of connectivity as the installer. As I said, ClickOnce is great but it's not the ultimate solution. One good approach would be to have your build process produce two versions of the app: one of which uses ClickOnce for installation & auto-updates via your site; the other as a standard Setup project (*.msi) which can be shared via sites like Armaholic for people who, for whatever reason, choose not to use the ClickOnce version.

Just because you have a hammer, that doesn't mean that everything becomes a nail. ;)
Title: Re: Squint - the sqf editor and error-checker
Post by: sbsmac on 30 Sep 2010, 21:07:17
On the contrary, they were very helpful - I hadn't seen the informatiion in the second one before. :) 

Quote
You can install a ClickOnce from a local copy (i.e., a CD) and then specify a different (i.e., internet, network, etc.) location which the app will check for a newer versions.

This is exactly what I would like to do.  I have no incentive to force users to install from the network although clearly I would like to 'encourage' them to update from it ! The documentation is a little unclear but implies that by using the 'install from CD-ROM' option rather than 'install from website' users can install from a local copy of the files. The downside presumably is that the setup.exe alone is no longer sufficient for installation - instead users have to download the whole set of deployment files ?

>One good approach would be to have your build process produce two versions of the app

I'm rather spoiled by the convenience of just being able to click 'publish solution' and would prefer not to go back to wrestling with makefiles (particularly Microsoft's variant).   Still, I might look at what Visual Studio is doing under the hood nowadays ;-)

>Just because you have a hammer, that doesn't mean that everything becomes a nail.

I seriously considered writing my own auto-update code (in fact pvpmissionwizard already contains all the essentials and uses them for auto-update of data) but clickonce is incredibly convenient so little point in reinventing the wheel.  I think it's a fair assumption that 99% of people who play arma are going to have some kind of internet connectivity (sorry haroon!)  :)

Title: Re: Squint - the sqf editor and error-checker
Post by: zonker3210 on 01 Oct 2010, 01:59:38
Quote
The downside presumably is that the setup.exe alone is no longer sufficient for installation - instead users have to download the whole set of deployment files ?

If that's a concern, you might consider adding a post-build step to bundle the files from your deployment folder into a single zip/7z/rar file. Or, as I originally suggested, create a separate Setup project that does not use ClickOnce technology. There's no real drawback to having multiple Setup projects in your VS solution...just specify custom build configurations so that you're only compiling the Setup projects when appropriate.

Quote
I think it's a fair assumption that 99% of people who play arma are going to have some kind of internet connectivity

True but sometimes it's nice not to have to be connected to the internet while working on stuff. Even though I'm an internet junkie (everybody says "Hiiiiiiiiiiiiiiiiiiiiiiiii, zonker!"), I do like to work offline sometimes while scripting. Also, if I don't have a net connection, I don't want to wait for an app to try to find updates online...fail to connect...and then handle the error...and eventually start up. I want instant gratification and I want it NOW! :)

I use ClickOnce for some applications that I write at work...it's a wonderful way to ensure that my users are working with the most up-to-date build of the app. I wouldn't recommend it as a sole option for deploying an app to a diverse set of users (i.e., across multiple corporate domains, across the internet, etc.), though. It forces you into a specific publishing framework and, as you've seen, it's a pain in the butt if you need to do anything outside the "standard" approach.

That said, there's no need to really for you to get your hands dirty with makefiles and the low-level stuff like that. A standard Setup project is simple enough if you have a basic configuration. Even pre- & post-build steps be configured in the IDE without much trouble but if not you can still get away with tweaking a few items in the underlying Setup project's XML-based configuration file. And given what you've accomplished with tools like Squint and RptMon, I seriously doubt that would be much trouble for you at all. ;)

Regardless, nice job with the various tools you've created. Definitely some neat stuff!
Title: Re: Squint - the sqf editor and error-checker
Post by: haroon1992 on 01 Oct 2010, 09:13:57
Thank you very much for the download!! :clap:
(You are such a kind person!)

Right now,I'm grabbing .Net 4.0 which is required.
And it seems its not that easy to make an off-line setup file, isn't it ?



Regards,
Haroon1992
Title: Re: Squint - the sqf editor and error-checker
Post by: sbsmac on 01 Oct 2010, 11:26:24
Hope it was worth the wait Haroon !  :)

@Zonker

I hadn't considered a setup project before - alas after a bit of digging it appears these are not available in the Express 2010 edition I'm using.  I like the idea of having dual deployments though..
1) the current small deployable setup.exe which installs from the web
2) A larger self-contained installer which installs locally but updates through the network when available.

It occurs to me that one way to achieve this would be a simple perl-script to dynamcially create a 'variant' project from the the main one, with the "install from CD-ROM" option set, then to run VSE from the command line to build both projects. (Happy to hack makefiles of my own - just prefer to avoid fighting VS over the ones it uses!).  So off to find out whether VSE can build from the command-line...  (For bonus points might as well automate the ftp  upload as well I suppose)

Quote
Also, if I don't have a net connection, I don't want to wait for an app to try to find updates online...fail to connect...and then handle the error...and eventually start up. I want instant gratification and I want it NOW!

Yep - know what you mean :)  I've been meaning for some time now to change the update-checking to post-load with a little dialog prompt to alert users when an update is available. There's a nice article I have bookmarked somewhere which describes ways to control ClickOnce manually (*Edit* http://bloggingabout.net/blogs/dennis/archive/2007/11/05/manual-check-for-updates-with-clickonce.aspx)

Quote
Regardless, nice job with the various tools you've created. Definitely some neat stuff!

Thanks - and the suggestions and feedback are very helpful. :)