Jump to content
Sign in to follow this  
sbsmac

Squint - the sqf editor and error-checker

Recommended Posts

I still sometimes get random corruption in files. Typically it is newlines that somehow get's deleted. I'm sure it wasn't me since I was editing at the top of a file and about 300 lines down, it appeared that a couple of newlines had been deleted. This is not when saving or loading, but when editing.

Edited by Muzzleflash

Share this post


Link to post
Share on other sites
Is this strictly for projects, or all even one file saved like this?

If you have dragged a file into a 'new' project (ie one that hasn't been named) then when you close squint with autosave enabled it will present a 'save as' dialog. If you cancel this, no changes to any of the files in the new project get changed so this pretty much gives you the behaviour you want (I think). Just use CTRL-SHIFT-N when you start squint to get a new project if necessary.

I still sometimes get random corruption in files. Typically it is newlines that somehow get's deleted

Strange, I haven't seen this. Does it happen at the place you are editing or in completely unrelated parts of the file?

Share this post


Link to post
Share on other sites
Strange, I haven't seen this. Does it happen at the place you are editing or in completely unrelated parts of the file?

Pretty sure I've seen both. I'll try and see if I can spot a pattern, so you will know where to look, however it seems very random.

Share this post


Link to post
Share on other sites

Thanks - the most likely scenarios are either

1) It's some kind of crossover between the key-input and rendering output. However, this would cause problems at or near the cursor position rather than elsewhere in the file,.

2) A line-conversion problem - but you would see this as soon as the file was loaded.

Other that that I'm a little stuck for ideas- will try loading up a few files and see if I can reproduce this. BTW - just been tweaking the auto-indent for the next release- it's now much nicer to use.

Share this post


Link to post
Share on other sites

Squint actually helped me find something yesterday that I was not even aware of being a bug / bad usage:

_cond = _this select 2;
if (typeName _cond == typeName true) then {
   _cond = {_cond}; // -> this not good
};
//.....
//.....
if (_this call _cond) then .............

:)

Share this post


Link to post
Share on other sites

Ha - I had to stare at that for a few minutes myself to see the error ! :)

Share this post


Link to post
Share on other sites

How does filters work?

I referenced an object in the editor by name. I then added the name of that to both project and file filters however it still showed up as an error.

Share this post


Link to post
Share on other sites

Does this explain it well enough ? https://sites.google.com/site/macsarmatools/squint/filters-and-the-dictionary

If not I'll be happy to improve the documentation if you still have questions. :)

I referenced an object in the editor by name.

Actually squint should be able to recognise named objects from mission.sqm. The fact it doesn't is a temporary bug which should be fixed in the next release later today.

Share this post


Link to post
Share on other sites
Does this explain it well enough ? https://sites.google.com/site/macsarmatools/squint/filters-and-the-dictionary

If not I'll be happy to improve the documentation if you still have questions. :).

I sometimes forget that there actually really do, in real life, exists people who not only develops software, that also writes documentation.

:)

Actually squint should be able to recognise named objects from mission.sqm. The fact it doesn't is a temporary bug which should be fixed in the next release later today.

Awesome

Share this post


Link to post
Share on other sites
I sometimes forget that there actually really do, in real life, exists people who not only develops software, that also writes documentation.

Not as much as I would like but I try :) (Which reminds me, if anyone is willing to help with any aspect of squint, including documentation, please let me know.)

Anyway....

V112 release

There are two significant improvements in v112.

Auto-indent.

If you are not already using auto-indent you can enable it from the Settings/Editor/Misc menu. I've modified auto-indent so that-

*All kinds of brackets - {,(,[ are recognised; the only restriction is that opening brackets must be the first non-whitespace character on a line and closing brackets must be the last non-whitespace character (unless followed by a semicolon).

*Closing brackets immediately unindent the line they are on (no need to press return any more)

*Opening brackets are used as the basis for indentation - no matter how far up the file they are.

*Pressing TAB indents the current line but leaves your cursor in the same relative position

*You can now use SHIFT-TAB to auto-indent the entire file

You can learn more about auto-indent here

Much better parsing of cpp files

Squint now correctly recognises the range of values possible in cpp files and will no longer give spurious warnings for lines such as

value=#path\sound.ogg,db+10;

*Edit* the cpp changes fix the bug that WoodyUK was seeing - ie named objects in the mission.sqm file were not being imported into the project namespace.

Edited by sbsmac

Share this post


Link to post
Share on other sites

hey mac, just wanna say great updat, auto-indent is far better than it was :D Same goes for the cpp changes mate way to go! :D

However i have found an an exception error which gave this in the details part of the error message... This occurs when i right-click any file on the left hand window... it doesnt even bring up the menu to remove files from project etc.

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
  at squint.Form1.dataGridView1_MouseDown(Object sender, MouseEventArgs e)
  at System.Windows.Forms.Control.OnMouseDown(MouseEventArgs e)
  at System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs e)
  at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.DataGridView.WndProc(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
   CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
System
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 built by: RTMRel
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
squint
   Assembly Version: 1.0.0.0
   Win32 Version: 1.0.0.0
   CodeBase: file:///C:/Users/SamuelMacPC/AppData/Local/Apps/2.0/K8BR9RVV.GCX/GL0TAQ50.L56/squi..tion_3d804d6cf9fd5b6a_0001.0000_08f68adcc8d4c93d/squint.exe
----------------------------------------
System.Windows.Forms
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 built by: RTMRel
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 built by: RTMRel
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Mac.Arma.FileFormats
   Assembly Version: 0.0.0.0
   Win32 Version: 0.0.0.0
   CodeBase: file:///C:/Users/SamuelMacPC/AppData/Local/Apps/2.0/K8BR9RVV.GCX/GL0TAQ50.L56/squi..tion_3d804d6cf9fd5b6a_0001.0000_08f68adcc8d4c93d/Mac.Arma.FileFormats.DLL
----------------------------------------
System.Deployment
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll
----------------------------------------
System.Core
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 built by: RTMRel
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Configuration
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 built by: RTMRel
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Accessibility
   Assembly Version: 4.0.0.0
   Win32 Version: 4.0.30319.1 built by: RTMRel
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
mac.XML
   Assembly Version: 1.0.0.0
   Win32 Version: 1.0.0.0
   CodeBase: file:///C:/Users/SamuelMacPC/AppData/Local/Apps/2.0/K8BR9RVV.GCX/GL0TAQ50.L56/squi..tion_3d804d6cf9fd5b6a_0001.0000_08f68adcc8d4c93d/mac.XML.DLL
----------------------------------------
304f4ud4
   Assembly Version: 1.0.0.0
   Win32 Version: 4.0.30319.1 built by: RTMRel
   CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
   <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Hope that helps identify error :D

Edited by WoodyUK

Share this post


Link to post
Share on other sites

Yep - that was very useful, thank you ! V113 now out :blush:

Share this post


Link to post
Share on other sites

No problems :D Glad to help someone who is putting hard work into an application for everyone. :D Cant wait for your release that checks named objects in mission.sqm that should clear up the windows. I'll keep checking for bugs and i'll let you know if i see any more :D

Share this post


Link to post
Share on other sites

*You can now use SHIFT-TAB to auto-indent the entire file

Could that be made a different combination please? All editors I've ever used use SHIFT+TAB for un-indent selection by one level.

Share this post


Link to post
Share on other sites

Do you have a suggestion for an alternate ? I'd prefer to keep it based on TAB but the space is a little crowded....

CTRL-(SHIFT)-TAB - will be use to cycle between tabs (like firefox)

ALT-TAB - cycles applications

TAB - indent current line (stolen from emacs)

Unindent doesn't really have meaning (yet) in squint.

Really it would be nice to allow users to assign their own keybindings but that's another layer of grubbiness I'm not desperate to get into.

Share this post


Link to post
Share on other sites

In most editors I would prefer SHIFT-TAB for indenting. However since you can't really indent anything with several TAB-presses I don't see the point an unindent.

CTRL+SHIFT+I for all indent if it is that big of a problem.

Share this post


Link to post
Share on other sites

Hey sbsmac,

I've quite enjoyed the latest version of squint. It seems to make things neater somehow... however i forgot to address a slight issue from an earlier version of squint that is still apparent the in latest version. Forgive me if this has already been address by someone.

Ok here it is...

lets say i have a code like this...

just a tip... highlight the code below and you will see the spaces at the end of each code

[color="#2e8b57"]//Changes behaviour of each unit[/color]
{_x setBehaviour "danger"} forEach units ld1;  
{_x setCombatMode "red"} forEach units ld1; 

sleep 4; 
{_x setUnitPos "auto"} forEach units ld1;
{_x setSpeedMode "auto"} forEach units ld1;

After each semi-colon (except the last 2 lines at the bottom) there is maybe a space or two (im referring to "spacebar" presses). No problem i finished script for the night.... cool. Im proud of what i have done. So i wake up do something for the next day then come home to continue scripting... er.. whats going on... the code above now looks like this...

[color="SeaGreen"]//Changes behaviour of each unit {_x setBehaviour "danger"} forEach units ld1;  {_x setCombatMode "red"} forEach units ld1; sleep 4; {_x setUnitPos "auto"} forEach units ld1; [/color]
{_x setSpeedMode "auto"} forEach units ld1;

I'd have to go through the new commented out code, at the end of each semi-colon, delete the white space to join up the code then press enter to put it on a new line. Sometimes it doesnt always work.

I dont know if this is formatting problems, however i have had this issue mainly in longer scripts. Such as the one in the mission i sent you via PM sbsmac, check start.sqf and you may spot it.

Edited by WoodyUK

Share this post


Link to post
Share on other sites

This looks suspiciously similar to what Muzzleflash was reporting. Have you any idea when the linefeeds get lost ? Is it the result of saving or loading the file or do you think this is happening as you edit the file ? I'll continue to try to reproduce this here but haven't been able to yet :-(

*edit* Another-question -does this only happen after a comment or is that just the particular example you picked ? I'm struggling to see how the line-endings could be selectively messed up for a few lines - is is possible this section of code has been pasted from another file ?

*edit again* Actually it's just possible the RTF renderer could eat the odd new line in unusual circumstances I suppose though it's hard to figure out what they would be. I'm looking at writing my own richtextbox equivalent in any case so hopefully this problem will go away.

Edited by sbsmac

Share this post


Link to post
Share on other sites

Just had this problem a couple times again today. It is exactly the same problem that Woody describes.

Share this post


Link to post
Share on other sites

Hmm - still mystified. I know it's hard but anything you can spot that seems be relevant to recreating this would be helpful. As I say though I've pretty much made the decision to rewrite my own richtextbox from scratch which wil probably eliminate this problem (and, no doubt, introduce others!).

Share this post


Link to post
Share on other sites

Hi sbsmac,

I have been trying hard to reproduce the problem i had with this script... (thought i'd post it lol) but i cannot seem to do it. It feels like to me that it's just a problem that happens...

//Once upon a time, a guy who came up with the idea for the application called "Squint" needs help to identify errors and issues   
sbsmac sideChat "Someone tell me what the problem with this script is!!!";   
sleep 5;    
WoodyUk sideChat "Sure... just copy this code into squint and save it to your desktop";    
sleep 6.2; 
sbsmac sideChat "Ok I will"; 

waitUntil {(unitReady sbsmac)};   
sbsmac sideChat "Darn it! I can see the problem!! I need to get my weapon... i call it 'CodingHands' "; 

sleep 7.1;  
sbsmac addWeapon "Coders_Hand_Gold"; 
sbsmac addMagazine "Coders_Knowledge_Gold";  

sleep 3;
sbsmac action ["fix squint"];

waitUntil {(unitReady sbsmac)};
sbsmac sideChat "There isnt actually a problem with this... i could not fix what i cant see... It could be that these are issues that just... happen";
exit; 

Copy and paste this and it seems to be fine. The script example i posted in the previous post is not the only one however. There have been a few times that has happened... in the same script from the code above and in other scripts. I cannot seem to work it out. Could it be related to the use of block comments?

Using /* isdjgodsjgnosdngsdkjnsdkngnksgndk */ could cause codes inside it to join up? Again i have not been able to reproduce this at all... but the same issue has happened inside block comments...

---------- Post added at 01:11 ---------- Previous post was at 01:10 ----------

I have come to a slight conclusion...

"It just happens"

(of course there has to be a reason, but i have yet to find it)

Share this post


Link to post
Share on other sites

Heya Mac.... you want a mind-blowing out-of-the-box idea? :)

Have squint, either via a right click or button or something, make a pbo of the current project? ;) Or, be able to right click on a folder and make it a pbo. :D

(Maybe even be able to specify where it makes the pbo, so that it might automatically put it in the right addon folder for testing.) ;)

Share this post


Link to post
Share on other sites

That's a cool idea - and the really good news is that it is only about 5 lines extra lines of code :) Similarly it's trivial to turn an existing pbo into unpbo'd files on disk. I'll drop this into the next release...

Actually there's a few questions about the semantics of this... if you have a bunch of files on disk which you want to turn into a pbo, would you want squint to change the project to refer to files in the new pbo or should it still treat the source files as the master copies.

For them moment I'm thinking that a "Make pbo from project" is the right way to go - this would create a new pbo file but would otherwise leave your project unchanged.

Edited by sbsmac

Share this post


Link to post
Share on other sites

For them moment I'm thinking that a "Make pbo from project" is the right way to go - this would create a new pbo file but would otherwise leave your project unchanged.

Yeah - that. :)

Would you also be open to some model-data editing? I'm not sure how this would really work, but like changing the distances on certain lods, or changing paths of textures/materials, those kinds of things. Like, in O2, there's a 'Mass texture rename' tool. Something like that. :)

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  

×