PDA

View Full Version : Error in script overriding



psicodelix
July 10th, 2011, 02:31
Hi,

I'm creating an skin extension for a ruleset. This extension has a script file that overrides the onInit function of the combattracker_window class.

I want to place a command in this script to change the static bounds of a control inside the combattracker_window, as follows:

namelabel.setStaticBounds(60,15,40,10);

when this sentence is executed in the original script of the ruleset it works fine. Although if I move the sentence to the overriding script of the extension it throws this error:

Script Error: [string "scripts/combattracker_init.lua"]:8: attempt to index global 'namelabel' (a nil value)

Is there any problem in the secuence of creating objets and executing scripts between rulesets and extensions?

Thank you.

Moon Wizard
July 10th, 2011, 08:25
When re-defining any part of a script file, you also have to redefine the object that uses the script.

For example, if you are overriding the combattracker_entry.lua script, you have to overwrite the combattracker_entry windowclass.

Regards,
JPG

psicodelix
July 10th, 2011, 11:19
hmmm... I would like to bypass the overwriting of the windowclass...

Nervermind, thank you moon_wizard.