[Bug] script compile errors not shown on load

Post Reply
Lucky24
Posts: 52
Joined: Sun Sep 12, 2010 1:50 am

[Bug] script compile errors not shown on load

Post by Lucky24 »

I'm having a hard time tracking down some compile errors, as they only seem to happen on first load, but mudlet doesn't show the little bug icon on first connect (as the profile hasn't been loaded I assume), and doesn't seem I think it has to do with some variables not being defined or some such, but if I click on the script to compile it, it compiles fine. I don't *see* any undeclared variables in the script, so I'm not sure why it's not compiling.

Anyway, is there a way to see what the compile errors are when the scripts first load?

User avatar
Omit
Posts: 190
Joined: Sun Aug 01, 2010 10:54 pm
Location: Middle Earth
Contact:

Re: [Bug] script compile errors not shown on load

Post by Omit »

my guess is that it is running into some nil values when you load the script the first time... every time after it works because the variable has now been defined. Check the script and look at anything that is outside the functions(if any) and make sure that all your variables are set to something at the head of the script(or function)... if you are calling a function from the body of the script... make sure that function and anything it may depend on is above that function call in the script(including other functions that function may use).....

I hope some of that makes sense.... I have seen this many times

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: [Bug] script compile errors not shown on load

Post by Heiko »

You are talking about runtime errors. Check the runtime errors view (red ! button in the scripts editor). The scripts get run from top to bottom (-> scripts tree view) when the profile is being loaded. Make sure that you define your variables in scripts that get run/compiled before scripts that reference them. The recommended approach is to put your variable definition scripts on top of the tree to make sure that they get run first when the profile is being loaded.

Lucky24
Posts: 52
Joined: Sun Sep 12, 2010 1:50 am

Re: [Bug] script compile errors not shown on load

Post by Lucky24 »

It looks like this is a problem with my saving and loading tables. Apparently table functions aren't saved by the saveVars() function. That's why I'm not getting runtime errors - the scripts are loading fine, but the tables are being overwritten with loadVars(), and losing the function definitions.

Edit: Thanks for letting me know that Mudlet *should* have been posting runtime errors in that spot. I figured since it wasn't something was wrong. But in fact, knowing that the profile was initially loading without errors helped me figure out where I was losing variables :)

Post Reply