Quantcast ESOUI - View Single Post - ZeroBrane Studio - ESOAddonDev Plugin
View Single Post
06/20/14, 06:12 AM   #3
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
Compile and Debug

To support compiling and debugging your Addon you will need to Modify your Addon,
so it supports the Environment.

Note: you will not get a 100% Debugging ,because it doesn't run inside ESO itself.
But you can "simulate" it.
Of course you can't debug any stuff that needs interactions or events from ESO.
But you can debug your own code if written in an in-depended way.

Shortcuts
F5 = Start Debug ,press Again to run until a Breakpoint or end of the file
F6 = Run (good way to find more errors, shows d("hello") etc.)
F7 = Compile (if there are basic errors they will show up)
F9 = Set Breakpoints in your Code
Shift-F7 = Analyze your Code -- Note: ESO API is not recognized with this (yet)

Here some Example Code:
https://github.com/farangkao/eso-zbs...on-Example.lua

Bascially you need to Register your XML Files at the Start of the Addon


if ESOAddonDev then -- If available we are inside ZBS and need to do some work
ESOAddonDev:GetXML([[Addon-Example\Addon-Example.xml]])
end


At the End of your Addon you will need to Add some Code to properly test your Addon.


if ESOAddonDev then
dofile [[Addon-Example\ZBS\Addon-ExampleTests.lua]] -- Run the Tests to confirm your Code works
end


You will also need to Execute some Commands to Test out more than just the main-lua Code. Also some Errors will only be found if you call the Methods in the Test. Since the OnLoad Method will not be executed thru an Event ,like it would inside ESO. You can write all Test-Code directly inside the Main-Lua, however it might be more useful to create a seperate Lua for this (i put it in a sub-folder "ZBS" since it's not needed when you commit your addon to ESOUI.com)

Test-Lua-Example here: Addon-Example/ZBS/Addon-ExampleTest.lua

Compile Errors

If you get errors ,it might be because some Part of the ESO API are not implemented in ESOAddonDev yet.

Here an Example:

Code:
if ESOAddonDev then
  print("We are running inside ZeroBrane Studio Environment")
  ESOAddonDev.ShowCreateControl = true
  ESOAddonDev:GetXML([[MobileBank\MobileBank.xml]]) 
  -- Fake creation of Elements because XML Controls for Virtual Sub-Elements not working yet...
    for i=1,11,1 do
	    	
      WINDOW_MANAGER:CreateControl("MBUI_Row"..i.."ButtonIcon",MBUI,CT_CONTROL)
      WINDOW_MANAGER:CreateControl("MBUI_Row"..i.."ButtonStackCount",MBUI,CT_CONTROL)
      WINDOW_MANAGER:CreateControl("MBUI_Row"..i.."Name",MBUI,CT_CONTROL)
      WINDOW_MANAGER:CreateControl("MBUI_Row"..i.."StatValue",MBUI,CT_CONTROL)
      WINDOW_MANAGER:CreateControl("MBUI_Row"..i.."SellPrice",MBUI,CT_CONTROL)
      
    end
end
The GetXML() Code has Generated the MB_TemplateRow1, 2,3 etc.

But during the Code a new (virtual) Control is generated.
This Created the MBUI_Row1 object, but the Children like MBUI_Row1ButtonIcon are not (yet)
created automatically.

So what the Code does is to simply create the Controls so that the Compiler will not bring up errors.

Note: this Code is only executed inside the ZBS Environment, not inside ESO
(Because ESOAddonDev is not a known Global)

You can make modifications at the ESOAddonDev.lua ,to have some functionality by default, if
you wanna contribute, contact me (source is on Github)

Last edited by farangkao : 06/20/14 at 07:50 AM.
  Reply With Quote