Page 1 of 1

error in script, faster way to fix error

PostPosted: Fri Feb 18, 2011 8:05 pm
by NightOfHorror
When you press ok when done with script and error in script box appears a lot of people are stumped, unless you are Bee, fuzzy, DST, at where error(s) is especially in huge code, and I think all characters (words numbers, signs) should turn a color not used already in script right when error is made so it could save time, even just seconds, on code.

Re: error in script, faster way to fix error

PostPosted: Sat Feb 19, 2011 3:15 am
by Bee-Ant
The current system will give an error information only on it's line number right?
What annoys us is we need to count the given line from the top line one by one.
I think it will be much helpful if ScriptEditor add the line number on the left side window :)

Re: error in script, faster way to fix error

PostPosted: Sat Feb 19, 2011 3:54 am
by skydereign
Well, you don't need to count them exactly. The editor tells you what line you are currently on, so you know pretty much where the error is occurring.

Re: error in script, faster way to fix error

PostPosted: Sun Feb 20, 2011 5:27 am
by NightOfHorror
still, I find it faster method, like in Microsoft Word when there is spelling or grammar error it tells you right away when your wrong

Re: error in script, faster way to fix error

PostPosted: Sun Feb 20, 2011 12:06 pm
by Bee-Ant
NightOfHorror wrote:still, I find it faster method, like in Microsoft Word when there is spelling or grammar error it tells you right away when your wrong

Do you want GE checks the error correction everytime you type the letter of codes?
Wouldn't it just make it to be incredibly slow??? :shock:

Re: error in script, faster way to fix error

PostPosted: Sun Feb 20, 2011 12:29 pm
by Game A Gogo
Adding a "Test check" button would make everyone happy.

Re: error in script, faster way to fix error

PostPosted: Sun Feb 20, 2011 3:57 pm
by DST
Ge error checking is standard, as i would expect to find in any script parser. There are two things that are expected of the user, however, with most languages:

1. You understand the language to an extent that you can understand why it errs.

2. You don't cram too much junk into your lines.

The more junk you cram into one line, the more possible errors you can have there. It is better to declare variables, and set those first, then use them in the code, rather than doing your calculations inside function args.

moveto(player.x-view.x+100-enemy.x/2, 100); <----don't do complex math inside function calls.

int xx=player.x-view.x+100-(enemy.x/2) <----instead, do the math outside in a local variable.
moveto(xx, 100);

And that's just an example, there is much more to it, not just that we do the math outside the function, but that we do the math in segments so we can reuse portions of it. Ever see this?

this->x=x+(width/2); that->x=x+(width/2); <----a lot of possible errors in this line


instead,
int x2=x+(width/2); <----now the error will be specific to the line; you'll know what's wrong instantly.
this->x=x2;
that->x=x2;

This is not only for error checking, but also so you can handle and reuse variables. Sometimes you have to make changes, but the changes you make are nested deep inside a line of math inside a function call and hard to edit or error check or reuse. It's sloppy coding and it hurts you in the long run.

Just for fun, who here can tell me what 'Read Error in invalid memory Area" means? Once you understand what causes that error, it makes complete sense. The error is a perfect description of what's wrong.

Re: error in script, faster way to fix error

PostPosted: Sun Feb 20, 2011 5:45 pm
by Bee-Ant
DST wrote:who here can tell me what 'Read Error in invalid memory Area" means?

viewtopic.php?f=2&t=7193
Just found a topic mentions it.

Anyway, it sounds like array out of bound?

Re: error in script, faster way to fix error

PostPosted: Mon Feb 21, 2011 1:02 am
by NightOfHorror
Bee-Ant wrote:
NightOfHorror wrote:still, I find it faster method, like in Microsoft Word when there is spelling or grammar error it tells you right away when your wrong

Do you want GE checks the error correction everytime you type the letter of codes?
Wouldn't it just make it to be incredibly slow??? :shock:

No Bee, I mean when your fully done with a code line