Thread Tools Display Modes
06/20/14, 05:50 AM   #1
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
Cool ZeroBrane Studio - ESOAddonDev Plugin

This is the offical Thread for my Plugin ESOAddonDev for ZeroBrane Studio.

ZeroBrane Studio is a Lightweight IDE for Lua Developers and Open Source

ESOUI: http://www.esoui.com/downloads/info5...DevPlugin.html
GitHub: https://github.com/farangkao/eso-zbs

To start it of some Images to make you interested

ZeroBrane Studio:



Jump to Functions:



API Support added thru ESOAddonDev Plugin:







Debug and Compile Support added thru ESOAddonDev Plugin:







GuiXML Support with Syntax Highlighting and Folding:



Note: While wrong Tags are always marked,
it's currently not possible to mark Attributes if the Case is wrong.
So it shows wrong Attributes ,as long they are differently spelled.
Example : mouseEnabled will be green, museEnabled will be red.
However MouseEnabled will be green as well (and not accepted by ESO)
With Tags it works perfectly, controls will be red, because it should be Controls
Also it's not possible to determine the right Attribute at the Right Tag, so it will accept all known Attributes in every Tag.
Still really helpful to have this Feature!

Last edited by farangkao : 06/20/14 at 02:34 PM.
  Reply With Quote
06/20/14, 05:59 AM   #2
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
Installation Instructions

You will find Instructions to Install the Addon on ESOUI aswell as on Github.

Here again ,but with Pictures


Download and Install ZBS from here: http://studio.zerobrane.com/

Note: ZBS is open source, but please consider to donate for this great project

Download my Files from the Addon's Page on ESOUI

The following Files you will find in the ZIP on ESOUI:
eso-zbo-master\Packages\LuaDist.lua and save the file it to {InstallDir}\Packages
eso-zbo-master\Packages\ESOAddonDev.lua and save the file it to {InstallDir}\Packages

Start Up ZBS.

Type the command inside ZBS on the Local Console: luadist.install "luaxml"


this will install LuaXML Support into ZBS.



Switch the Project Directory to your Addons Directory
(you can either set it directly to your Addon alone, or to the Parent Folder, where you then have all Addons installed to choose from)



Switch the Lua Interpreter in the Menu Project to ESOAddonDev


Last edited by farangkao : 06/21/14 at 05:27 AM.
  Reply With Quote
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
06/20/14, 11:21 AM   #4
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 437
Sweet! Nice work farangkao!
__________________
Co-Founder & Admin: MMOUI
Avatar Image by RaffaeleMarinetti
  Reply With Quote
06/20/14, 12:06 PM   #5
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
this is awesome Ive been using Scite-WOWInterface-0.8 lmao, is their a way to make the font smaller in the program i tried to find it and couldn't i find them a bit large especially with pages of code
  Reply With Quote
06/20/14, 12:24 PM   #6
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
You're welcome, i'm glad i can contribute

A few additional notes:

API Support is currently based on wiki.esoui.com.
I just found out today that there are Notes from the PTS (ESO UI Documentation for API Version 100003
) which i could have used for even better Support. If there is a newer Version for the next Patch let me know.

There is an option to write Descriptions for the Tooltips, currently it's by default just "-" ,if someone provides me with Data (for example an Excel Spreadsheet with Name/Description) i can also integrate that into the next ESOAddonDev Update.

ZeroBrane Studio is very heavy configurable by simple Lua programming (as you can see with my Plugin), this which makes it for me even more the perfect tool for Addon Authors

@SkOODaT

As for the Font Size: There is even Skins you can check out
Simply open the file {InstallDir}\cfg\scheme-picker.lua and see if something is after your taste.
i loved the original theme most

If you wanna modify yourself, check here for more information:
http://studio.zerobrane.com/doc-styl...r-schemes.html

Also you can always change the Font Size by holding down CTRL and using your Mouse-wheel (it's a standard with many applications)
  Reply With Quote
06/21/14, 03:44 AM   #7
Saftsuse
 
Saftsuse's Avatar
Join Date: Apr 2014
Posts: 13
I am doing something wrong, I dont know what this means:

{InstallDir}\Packages

because I understand this:

eso-zbo-master\Packages\LuaDist.lua and save it to {InstallDir}\Packages
eso-zbo-master\Packages\ESOAddonDev.lua and save it to {InstallDir}\Packages

To be this:

C:\Program Files\zbstudio\packages\eso-zbs-master\Packages\LuaDist.lua
C:\Program Files\zbstudio\packages\eso-zbo-master\Packages\ESOAddonDev.lua

So clearly I dont understand where

{InstallDir}\Packages

is supposed to be. In my mind thats the same as (on my PC):

C:\Program Files\zbstudio\packages\

Please give an example.


If its a noob trap, its working

Last edited by Saftsuse : 06/21/14 at 03:56 AM.
  Reply With Quote
06/21/14, 05:26 AM   #8
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
Hi Saftsuse.

Yeah it was a trick to find out who the serious programmers are ;-)

Now for real:
Sorry i wasn't clear enough. the ESOAddonDev.lua and LuaDist.lua need to be copied exactly in the Packages Folder you mentioned.

The Folders in the ZIP File are made automatically by Github, so i left them intact, like they are.

Don't hesitate to ask more questions, i'm glad to help.

Fara.
  Reply With Quote
06/21/14, 10:55 AM   #9
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
As already mentioned, the API is not 100% complete.

So what to do if a Compile Error happens, easy fix inside the Start Code.

In this Example ,i used the SetState() Function of the Button Control.
The GetXML() Function doesn't support it yet automatically (will Update it of course later)

So here is how i fixed it:

Code:
if ESOAddonDev then
  print("We are running inside ZeroBrane Studio Environment")
  ESOAddonDev.ShowCreateControl = true
  ESOAddonDev:GetXML([[MobileBank\MobileBank.xml]]) 

  MBUI_ContainerTitleSwitchAll.SetState = function (self,state) end
  MBUI_ContainerTitleSwitchInv.SetState = function (self,state) end
  MBUI_ContainerTitleSwitchBank.SetState = function (self,state) end
  MBUI_ContainerTitleSwitchGuild.SetState = function (self,state) end
  MBUI_ContainerTitleSwitchRecipes.SetState = function (self,state) end
end
-----------------
As you can see the MBUI_ContainerTitleSwitchAll has just added a dummy function for SetState,
now the lua can be compiled and debugged again.

You can also overwrite existing defintions in the API ,for example to return better Values etc.
  Reply With Quote
06/24/14, 11:19 PM   #10
Deome
 
Deome's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
Thumbs up Made my day

I think the only way I could be happier is if this could be adapted to a Notepad++ plugin.
  Reply With Quote
06/24/14, 11:23 PM   #11
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
Originally Posted by Deome View Post
I think the only way I could be happier is if this could be adapted to a Notepad++ plugin.
Give it a try, i used to write with Notepad++ too ,and i still use it for other stuff, but concerning LUA Scripts, it's unbeatable.

For example it shows you which Variables are already declared before ,which are global variables, etc.
And this directly while Editing, no normal Text Editor could ever do that ,even with a Plugin

ZBS was created especially for Lua Development.

Just to be clear ZBS is not my Product, i just discovered it and made a special ESO-Plugin for it (written all in Lua itself).
  Reply With Quote
07/10/14, 03:06 PM   #12
deniz_irgin
Join Date: Jul 2014
Posts: 6
wxstc is nil

Hi,

Thank you for detailed instructions.

But i think i do something wrong. First i try to debug this code

Lua Code:
  1. if ESOAddonDev then   -- If available we are inside ZBS and need to do some work
  2.  
  3.   ESOAddonDev:GetXML([[Addon-Example\Addon-Example.xml]])
  4.  
  5.   -- More specific Code here (which helps to compile the lua)
  6. end

But i see ESOAddonDev's value is nil in debug time. The reason is wxstc (line :3131 in ESOAddonDev.lua) is nil and ESOAddonDev object cant initiliaze. What i understand wxstc is ZBS's global object for plugins. I think ZBS cant run ESOAddonDev as interpreter for this reason.

Edit :

Im new in lua. I do some research wxstc is part of WxWidgets for lua http://wxlua.sourceforge.net/download.php

I install luaforwindows (https://code.google.com/p/luaforwindows/) but i think wxLua is not part of this. I think i need to instal wxLua some how

Last edited by deniz_irgin : 07/10/14 at 03:22 PM.
  Reply With Quote
07/10/14, 03:14 PM   #13
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
Originally Posted by deniz_irgin View Post
Hi,

But i see ESOAddonDev's value is nil in debug time. The reason is wxstc (line :3131 in ESOAddonDev.lua) is nil and ESOAddonDev object cant initiliaze. What i understand wxstc is ZBS's global object for plugins. I think ZBS cant run ESOAddonDev as interpreter for this reason.
Hi Deniz,

this sounds like you are not using the Lua Interpreter "ESOAddonDev" which main purpose (apart from API Definitions) is to create some Global objects, like ESOAddonDev, or functions like GetNumGuilds()

So double-check if you have selected it.
If it's not available to select ,you might not copied the files into the right folder.
  Reply With Quote
07/10/14, 03:35 PM   #14
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
Just re-read your Question Deniz.

It looks like you are using the right Lua Interpreter.

the wx stuff needs no additional installation.

The ZBS can be just unzipped and run ,it works. (I'm using Version 0.70 of ZBS)

You might have mixed up something? What if you try to reproduce the steps (other installation folder)

Can i ask ,how did you evaluate that wxstc is nil ?

I'm part of the Mailinglists of ZBS, i can ask the Question when you deliever a bit more detail (and i'm sure it's not a simple mistake) ;-)
  Reply With Quote
07/10/14, 04:07 PM   #15
deniz_irgin
Join Date: Jul 2014
Posts: 6
Hi,

Thank you for your quick answer

I think problem is Debugger. When i run script (F6) all codes is running without error but when in debug mode ESOAddonDev is nil. I dont now may br its now available for debugging.

Originally Posted by farangkao View Post
Just re-read your Question Deniz.

Can i ask ,how did you evaluate that wxstc is nil ?
I add ESOAddonDev.lua to project then i just start debugger.

Last edited by deniz_irgin : 07/10/14 at 04:09 PM.
  Reply With Quote
07/10/14, 04:14 PM   #16
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
Okay, did some tests myself, you are right if you Debug (F5) it doesn't know ESOAddonDev.
only with Run (F6) it will work perfectly.

There is something wrong with the Plugin (it worked before, but i might have changed something that it won't work while in debug, i just remember it handles both situation differently)

I will investigate the problem

By the way the reason you got nil with wxstc is probably that that object will only be created when the plugin is loaded, so just adding the file to your project will yield a "nil" ,but it's actually working like intended.

The fact that it works with F6 is proof
  Reply With Quote
07/10/14, 04:32 PM   #17
deniz_irgin
Join Date: Jul 2014
Posts: 6
Yea you are right. I do more rearch about it i think its all about Interpreter, it is interpreters responsbility to create debugging context.

I will use good old print function until you solve the problem

Thank you for your support again

By the way it is a great ESO wrapper
  Reply With Quote
07/11/14, 01:50 PM   #18
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
I've checked out some configuration and i managed to made the Debug include the necessairy pre-definitions, but the debugging itself seems not to work as intended (doesn't stop at Breakpoints?)

I need to investigate further.

Edit: currently in contact with Paul (Creator of ZBS) and working our way towards the solution

Last edited by farangkao : 07/11/14 at 05:44 PM.
  Reply With Quote
12/16/14, 09:39 AM   #19
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,903
If I try to run the command luadist.install "luaxml" in the local console of ZBS I get the following error message:

Code:
Program starting as '"C:\Users\ausername\Documents\Zero Brain Studio\bin\lua.exe" -e "io.stdout:setvbuf('no'); local conf = require 'dist.config'; for k, v in pairs({arch = 'Windows', cache = false, cache_dir = 'tmp\\cache', cache_timeout = 0, components = {'Runtime', 'Documentation', 'Header', 'Library', 'Unspecified'}, dep_cache_file = 'tmp\\cache\\.depcache', distinfos_dir = 'dists', log_file = 'tmp\\luadist.log', manifest_file = 'tmp\\cache\\.gitmodules', root_dir = 'C:\\Users\\ausername\\luadist\\5.1', source = false, type = 'x86'}) do conf[k] = v end; for k, v in pairs({}) do conf.variables[k] = v end; os.exit = function() error('done') end; local s = os.time(); local ok, err = pcall(require('luadist').install.run, [[C:\Users\ausername\luadist\5.1]], {'luaxml'}); if not ok and not err:find('done$') then print(err) end; print('Completed in '..(os.time()-s)..' second(s).')"'.
Program 'lua.exe' started in 'C:\Users\ausername\Documents\Zero Brain Studio' (pid: 9636).
C:\Users\ausername\Documents\Zero Brain Studio\bin\lua.exe: ...\ausername\Documents\Zero Brain Studio\lualibs/luadist.lua:5: module 'dist' not found:
	no field package.preload['dist']
	no file '.\dist.lua'
	no file 'C:\Users\ausername\Documents\Zero Brain Studio\bin\lua\dist.lua'
	no file 'C:\Users\ausername\Documents\Zero Brain Studio\bin\lua\dist\init.lua'
	no file './dist.lua'
	no file './dist/init.lua'
	no file './lua/dist.lua'
	no file './lua/dist/init.lua'
	no file 'C:\Users\ausername\Documents\Zero Brain Studio\lualibs/dist/dist.lua'
	no file 'C:\Users\ausername\Documents\Zero Brain Studio\lualibs/dist.lua'
	no file 'C:\Users\ausername\luadist\5.1\lib\lua/dist.lua'
	no file 'C:\Users\ausername\luadist\5.1\lib\lua/dist/init.lua'
	no file '.\dist.dll'
	no file 'C:\Users\ausername\Documents\Zero Brain Studio\bin\dist.dll'
	no file 'C:\Users\ausername\Documents\Zero Brain Studio\bin\loadall.dll'
	no file 'C:\Users\ausername\Documents\Zero Brain Studio\bin/dist.dll'
	no file 'C:\Users\ausername\Documents\Zero Brain Studio\bin/clibs/dist.dll'
	no file 'C:\Users\ausername\luadist\5.1\lib\lua/dist.dll'
stack traceback:
	[C]: in function 'require'
	...\ausername\Documents\Zero Brain Studio\lualibs/luadist.lua:5: in main chunk
	[C]: in function 'require'
	(command line):1: in main chunk
	[C]: at 0x00402a57
Program completed in 0.06 seconds (pid: 9636).
I donwloaded the ZIP archives and unzipped them into the packages folder, so the folder structure now is:
Zero Brain Studio\Packages\eso-zbs-master
Zero Brain Studio\Packages\eso-zbs-master\packages
Zero Brain Studio\Packages\eso-zbs-master\packages\ESOAddonDev.lua
Zero Brain Studio\Packages\eso-zbs-master\packages\luadist.lua

I've also tried it this way:
Zero Brain Studio\Packages\
Zero Brain Studio\Packages\ESOAddonDev.lua
Zero Brain Studio\Packages\luadist.lua

And this way:
Zero Brain Studio\Packages\eso-zbs-master
Zero Brain Studio\Packages\eso-zbs-master\packages
Zero Brain Studio\Packages\eso-zbs-master\packages\ESOAddonDev.lua
Zero Brain Studio\Packages\luadist.lua

Any1 got an idea how to fix this? Thank you.
  Reply With Quote
12/16/14, 09:46 PM   #20
hisdad
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 33
Not Installing.

I also have this problem.

luadist.install "luaxml"
Running 'install' for Lua 5.1 in 'C:\Users\John\luadist\5.1'.
D:\Zerobrane\bin\lua.exe: (command line):1: module 'dist.config' not found:
no field package.preload['dist.config']
no file '.\dist\config.lua'
no file 'D:\Zerobrane\bin\lua\dist\config.lua'
no file 'D:\Zerobrane\bin\lua\dist\config\init.lua'
no file './dist\config.lua'
no file './dist\config/init.lua'
no file './lua/dist\config.lua'
no file './lua/dist\config/init.lua'
no file 'D:\Zerobrane\lualibs/dist\config/dist\config.lua'
no file 'D:\Zerobrane\lualibs/dist\config.luaC:\Users\John\luadist\5.1\lib\lua/dist\config.lua'
no file 'C:\Users\John\luadist\5.1\lib\lua/dist\config/init.lua'
no file '.\dist\config.dll'
no file 'D:\Zerobrane\bin\dist\config.dll'
no file 'D:\Zerobrane\bin\loadall.dll'
no file 'D:\Zerobrane\bin/dist\config.dll'
no file 'D:\Zerobrane\bin/clibs/dist\config.dllC:\Users\John\luadist\5.1\lib\lua/dist\config.dll'
no file '.\dist.dll'
no file 'D:\Zerobrane\bin\dist.dll'
no file 'D:\Zerobrane\bin\loadall.dll'
no file 'D:\Zerobrane\bin/dist.dll'
no file 'D:\Zerobrane\bin/clibs/dist.dllC:\Users\John\luadist\5.1\lib\lua/dist.dll'
stack traceback:
[C]: in function 'require'
(command line):1: in main chunk
[C]: at 0x00402a57


No idea what to do.
  Reply With Quote

ESOUI » Developer Discussions » Dev Tools » ZeroBrane Studio - ESOAddonDev Plugin

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