View Single Post
04/04/14, 07:05 AM   #6
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
That was a big help I do not have any errors showing up any more, and I think I have a bit of a grasp on the functions now... maybe... let me know if any of my commenting or anything looks off.

However, I cant get the slash command to work. haven't gotten past that point yet.

having "SLASH_COMMANDS[addonCommand] = addon_slash" in the init function doesn't work anymore, and it wont work if moved to any of the other functions....

Sorry to be such a noob on all this, and thanks again for the help.

Lua Code:
  1. local addonName = "MMOUI"
  2. local addonCommand  = "/mmo"
  3. local addonVersion  = 0.01
  4. local addonData = {}
  5.  
  6. -- Default Saved settings
  7. addonData.defaults = {
  8.     -- Bag
  9.     overideBag = true  
  10. }
  11.  
  12. -- Initialize addon data
  13. local function init_addondata()
  14.    
  15.     -- Slash command handler
  16.     SLASH_COMMANDS[addonCommand] = addon_slash
  17.    
  18.     -- Load saved variables
  19.     mmoVars = ZO_SavedVars:New( 'MMOUI_VARS' , math.floor( addonVersion * 100 ) , nil , addonData.defaults )   
  20.  
  21. end
  22.  
  23. -- Addon is active and can call runtime functions
  24. local function addon_activated( eventid )
  25.     -- do stuff
  26.     --if (mmoVars.overideBag == true) then
  27.         --mmo_bag()
  28.     --end
  29.  
  30. end
  31.  
  32. -- Load addon
  33. local function addon_loaded(eventid, addon)
  34.    
  35.     -- if addon is for this script trigger init_addondata
  36.     if addon == addon_name then init_addondata()
  37.         -- trigger player activated passes this eventid to addon_activated function
  38.         EVENT_MANAGER:RegisterForEvent(addonName,EVENT_PLAYER_ACTIVATED,addon_activated)
  39.     end
  40.        
  41. end
  42.  
  43. local function addon_slash( text )
  44.     d( "You are using ".. addonName .. " version " .. addonVersion )
  45.     d( addonName .. " configuration settings are in the game settings interface!" )
  46. end
  47.  
  48. -- trigger addon_loaded function, passes this eventid to function
  49. EVENT_MANAGER:RegisterForEvent(addonName,EVENT_ADD_ON_LOADED,addon_loaded)

Last edited by tiomun : 04/04/14 at 07:08 AM.
  Reply With Quote