WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   how to call a function from xml (https://www.wowinterface.com/forums/showthread.php?t=22443)

Aeragon 04-18-09 02:45 PM

how to call a function from xml
 
Hi,

I have trouble calling a function from the xml file

<Scripts>
<OnLoad>
DEFAULT_CHAT_FRAME:AddMessage("Loading InstaBolt", 255, 0, 0);
InstaBolt_OnLoad()
DEFAULT_CHAT_FRAME:AddMessage("Loaded InstaBolt", 255, 0, 0);
this:RegisterEvent("VARIABLES_LOADED")
</OnLoad>
<OnEvent>
if (event == "VARIABLES_LOADED") then
InstaBolt_Events()
else
InstaBolt_OnEvent(event,...)
end
</OnEvent>
</Scripts>

That code work before 3.1 and now it don't work anymore, the function InstaBolt_OnLoad() isn't call. I can't figure out what I need to do to be able to call function in my lua file.

Can someone help me?

Duugu 04-19-09 01:13 AM

This code is absolutely working as expected.

Is the addon really loaded?
Are the LUA error messages activated?

Exawatt 04-19-09 01:00 PM

Errors in XML can prevent the rest of the file from loading. If there's an XML error above what you posted, then that could be the culprit. Is there anything about it in World of Warcraft/Logs/FrameXML.log?

Unless you're seeing "Loading InstaBolt", in which case there's a problem in InstaBolt_OnLoad(). If you're not seeing Lua error messages, try putting debugging statements such as the following between all major code blocks to narrow down where the error is occuring:
Code:

DEFAULT_CHAT_FRAME:AddMessage("FUNCTION START")
--some code here
DEFAULT_CHAT_FRAME:AddMessage("POINT 1 REACHED")
--code
DEFAULT_CHAT_FRAME:AddMessage("POINT 2 REACHED")
--code
DEFAULT_CHAT_FRAME:AddMessage("FUNCTION END")



All times are GMT -6. The time now is 03:25 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI