Thread Tools Display Modes
05/27/15, 01:27 AM   #1
Luxor
 
Luxor's Avatar
Join Date: May 2015
Posts: 7
Question CirconianStaminaBar - Tutorial Help

Hello ESOUI community,

So for the past 48 hrs (with 10hrs sleep) I've been diligently teaching myself lua and xml in order to create an addon.

My learning materials have consisted of this beginners guide, this excellent site (and its crash course + intro) and this particularly well crafted tutorial by Circonian.

So I've followed Circonian's Stamina Bar tutorial meticulously and I managed to get it working up until the "Final Adjustments" section; after altering the code to suit what's mentioned in the Final Adjustments section, my addon fails to start and I get these following errors (source code links posted below images):





Here are my source codes:
-lua file
-xml file
-txt file

The images state that things are going wrong during these lines in particular:

The second event trigger
EVENT_MANAGER:RegisterForEvent(CirconianStaminaBar.name, EVENT_POWER_UPDATE, CirconianStaminaBar.UpdateStamina)
CirconianStaminaBarWindowLabel:SetText(ourName)
CirconianStaminaBar:Initialize()
If anyone can advise me on where I'm going wrong and how I can make this addon functional, I would be eternally grateful.

My thanks in advance!

Last edited by Luxor : 05/27/15 at 04:42 AM.
  Reply With Quote
05/27/15, 01:52 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Hi Luxor,

in Lua the order is important. Things used before declaration are unknown (nil)
You are declaring CirconianStaminaBar.UpdateStamina in line 49. CirconianStaminaBar.UpdateStamina is nil in line 44.
You can move the event EVENT_POWER_UPDATE registration inside Initialize().
Because the event is triggered after parsing the whole file. CirconianStaminaBar.UpdateStamina is known in the moment Initialize is called.
I guess the second error is caused by interupting the parsing process due to the first error.
  Reply With Quote
05/27/15, 02:00 AM   #3
Luxor
 
Luxor's Avatar
Join Date: May 2015
Posts: 7
Originally Posted by votan View Post
Hi Luxor,

in Lua the order is important. Things used before declaration are unknown (nil)
You are declaring CirconianStaminaBar.UpdateStamina in line 49. CirconianStaminaBar.UpdateStamina is nil in line 44.
You can move the event EVENT_POWER_UPDATE registration inside Initialize().
Because the event is triggered after parsing the whole file. CirconianStaminaBar.UpdateStamina is known in the moment Initialize is called.
I guess the second error is caused by interupting the parsing process due to the first error.
Thanks for your quick response! I'll have a look at my code and do as you advised, I'll keep this thread posted on the progress.
  Reply With Quote
05/27/15, 08:00 AM   #4
Luxor
 
Luxor's Avatar
Join Date: May 2015
Posts: 7
Thumbs up

Okay so I wasn't able to successfully build Circonian's Stamina Bar but I did manage to use your advice in order to create a working version of this tutorial.

I have learnt a lot and am now trying to look at other people's addons and trying to see how they made everything work elegantly.

Thanks again!
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » CirconianStaminaBar - Tutorial Help


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