Thread Tools Display Modes
04-18-09, 02:45 PM   #1
Aeragon
A Kobold Labourer
Join Date: Oct 2008
Posts: 1
Question 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?

Last edited by Aeragon : 04-18-09 at 02:54 PM.
  Reply With Quote
04-19-09, 01:13 AM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
This code is absolutely working as expected.

Is the addon really loaded?
Are the LUA error messages activated?
  Reply With Quote
04-19-09, 01:00 PM   #3
Exawatt
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 36
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")

Last edited by Exawatt : 04-19-09 at 01:05 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » how to call a function from xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off