Script Problems

Post » Fri May 27, 2011 1:09 pm

I was making a script and on my first test it came up with an error saying "error: EXPRESSION in script "scriptname." Continue running executable?" followed by a simple "Left Eval" message. These show up a lot during my tests, but i don't know what they mean, can anyone explain them?

Also, as the game loads I get a message saying that a certain script has not been compiled. What exactly does compiling a script mean/do, and how do I do it? Thanks for any help.
User avatar
Marta Wolko
 
Posts: 3383
Joined: Mon Aug 28, 2006 6:51 am

Post » Fri May 27, 2011 1:18 pm

It's not compiled if you tried to save it and it failed to compile. When this happens, you need to find your error, fix the script, and recompile it by saving it again.

Left Eval means that the variable, function, or object on the left side of the argument (on one line of code) is causing an error. Often, these aren't caught by the CS compiler, but show up in the game. You need to go through your script thoroughly and debug it in these cases.

So, for example, if you have something like if ( "object_name"->GetDistance "other_object" <= ## ), then it's the first object that's causing the error.
User avatar
Haley Merkley
 
Posts: 3356
Joined: Sat Jan 13, 2007 12:53 pm

Post » Fri May 27, 2011 4:25 pm

Oh, I get it. Quick question... since I made a line that says "if ( getdistance "player" <= 10 ), would that be the left eval because I didn't name an object before the if?
User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am

Post » Fri May 27, 2011 6:14 am

If it's a local script attached to the object, then you don't have to name the first object, only the second one. If it's a targeted global script (that is, you typed "object"->StartScript "ScriptName" or started the script from an NPC's dialogue) you don't need to call the first object either. Though targeted global scripts are in danger of losing their targeting during a reload, so it's best to be cautious with that. You only have to target the first object with "object"-> if it's a free-floating global script, because it's not attached to anything, or if you're calling the object from a script attached to a completely different object.

An illustration of this case would be if you want to check the distance of two actors, but are using a hidden activator type object to do it. The activator has a local script that has "if ( NPC1->GetDistance NPC2 <= 500 )". Whereas, if you put the script on NPC1 then you would only have to do "if ( GetDistance NPC2 <= 500 )".
User avatar
Ana
 
Posts: 3445
Joined: Sat Jul 01, 2006 4:29 am

Post » Fri May 27, 2011 10:32 am

Alright, I think I get it, though I'm still hopelessly lost as to where the problem is with my current script. Oh well, I'll just have to go through it more carefully.

One more quick question: will making a color-changing light cause problems? It's just on a timer that removes and deletes itself after placing a different colored light at its own position.

And thanks for the help.:)
User avatar
Spaceman
 
Posts: 3429
Joined: Wed May 23, 2007 10:09 am


Return to III - Morrowind