Author Topic: Syntax checker discussion...  (Read 7529 times)

0 Members and 1 Guest are viewing this topic.

Scrripty

  • Guest
Syntax checker discussion...
« on: September 19, 2009, 08:52:20 AM »
0
Ok this is just a thought.  I was playing around with ScriptUO, and I LOVE the syntax checker.  But I've had a couple of instances where I've found an imbalance of brackets, but ScriptUO can't tell me WHERE.  I understand it's difficult to search for each and every bracket, but there's GOT to be a way?  What about giving a tool to the developer?  Say, at the beginning of every sub, you type:

Code: [Select]
; start Lightning Strike
sub LS
  code code code
  code code code
RETURN
; end Lightning Strike

Then ScriptUO does a search for the text ; start and anything after will be used as the NAME of the sub.  Then you do a search between those 2 names "start/end" then you could easily find which sub at least has the imbalance of brackets?  I understand the problems with doing something like this, what if the user spells something wrong?  What if its not spaced correctly?  What if the 2 names are spelled wrong?  But I think the benefit far outweighs the possible problems?  If there is a typing error, you could just ignore it, until it finds 2 ;start ;end lines that match with the same name.  Make finding those damn subs with the bad brackets SO easy. :)  Could even do something like have an add sub names command where you just pick a menu item and it auto adds the sub names to those ;start ;end lines for matching subs that match a set criteria.  Like SUB/RETURN SUB/RETURN.    For people who use one sub line and one return line, that would be beautiful.  If that makes any sense? :)  The script would just breeze through and see that there's a bracket missing in sub Lightning Strike, and bam, you go fix it.  I just had to search through 4000 lines of code for one bracket.  I found one, but there's one more... haha

Actually I just had another thought, you dont even need to name the "; end" line as long as you only have ONE "; start" that has the name, then one "; end" after throughout the script.  You could even just use it as a counter, like put them around ANY GROUP of subs you want, as long as you should have a balanced number of brackets between the start/end, it should give you a general idea of where the bracket is...  so you wouldn't even need to enclose subs... you could enclose anything.
« Last Edit: September 19, 2009, 09:00:19 AM by Scripty »

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Syntax checker discussion...
« Reply #1 on: September 19, 2009, 01:02:03 PM »
0
You can tell where the imbalance is by doing an auto-indent, and the seeing where the spacing goes wonky.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: Syntax checker discussion...
« Reply #2 on: September 19, 2009, 01:38:27 PM »
0
You can tell where the imbalance is by doing an auto-indent, and the seeing where the spacing goes wonky.

What about searching between two bookmarks on the side of the script window?  Like you said you had thought of doing some sort of bookmark, what about 2 sliders on the left side, and those are your jump points, then you can also "syntax check" between those 2 bookmarks? :)  I get what you're saying about the line spacing, but I haven't really used the auto indent feature... I was sure it broke my script once... :)  Although it is a nice feature.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Syntax checker discussion...
« Reply #3 on: September 19, 2009, 02:02:29 PM »
0
There's probably a different way to do that without dictating the scripter to format or comment their code in a specific way.  I've thought a bit about it and have a couple ideas,   There's no real way to guard against syntax errors like brace imbalances.  It's easy to install aids to help format, but one quick "DEL" can mess up any thing like that. 

For the indenting, just save your code first before you indent so you won't mess it up since some people don't like the style of indention we use in ScriptUO.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: Syntax checker discussion...
« Reply #4 on: September 19, 2009, 03:50:40 PM »
0
There's probably a different way to do that without dictating the scripter to format or comment their code in a specific way.  I've thought a bit about it and have a couple ideas.

I still like the jump point sliders on the side... :)

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Syntax checker discussion...
« Reply #5 on: September 19, 2009, 03:52:43 PM »
0

I still like the jump point sliders on the side... :)


With this text editor control, I have a limited number of things I can do, so I have to work with the tools in the toolbox.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: Syntax checker discussion...
« Reply #6 on: September 19, 2009, 03:58:17 PM »
0

I still like the jump point sliders on the side... :)


With this text editor control, I have a limited number of things I can do, so I have to work with the tools in the toolbox.

What about adding a script "code word" for a jump point?  And a window on the right that would list them and you could just click to goto that point.  Say you type ";scriptuo1" and it would know that was a jump point and add it to the window?  Would that be easy?  I'd love a feature like that.  Make jumping around easy.  Then anything after the ";scriptuo1" would be ignored but added as naming.  So you could name it ";scriptuo1 Attack Sub"  and it would show up in the window as scriptuo1 Attack Sub or something?

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Syntax checker discussion...
« Reply #7 on: September 19, 2009, 04:00:50 PM »
0
Will just be easier to add the bookmark library that's saved by filename.  That way  one click can delete them instead of having to do any editing.  Either way, a change like that is a way off.
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: