ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Dev Tools (https://www.esoui.com/forums/forumdisplay.php?f=173)
-   -   ZeroBrane Studio - ESOAddonDev Plugin (https://www.esoui.com/forums/showthread.php?t=1820)

farangkao 06/20/14 05:50 AM

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!

farangkao 06/20/14 05:59 AM

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


farangkao 06/20/14 06:12 AM

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)

Cairenn 06/20/14 11:21 AM

Sweet! Nice work farangkao! :)

SkOODaT 06/20/14 12:06 PM

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

farangkao 06/20/14 12:24 PM

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)

Saftsuse 06/21/14 03:44 AM

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 :p

farangkao 06/21/14 05:26 AM

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.

farangkao 06/21/14 10:55 AM

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.

Deome 06/24/14 11:19 PM

Made my day
 
I think the only way I could be happier is if this could be adapted to a Notepad++ plugin.

farangkao 06/24/14 11:23 PM

Quote:

Originally Posted by Deome (Post 9676)
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).

deniz_irgin 07/10/14 03:06 PM

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 :)

farangkao 07/10/14 03:14 PM

Quote:

Originally Posted by deniz_irgin (Post 10415)
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.

farangkao 07/10/14 03:35 PM

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) ;-)

deniz_irgin 07/10/14 04:07 PM

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.

Quote:

Originally Posted by farangkao (Post 10420)
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.

farangkao 07/10/14 04:14 PM

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 :)

deniz_irgin 07/10/14 04:32 PM

Yea you are right. I do more rearch about it :D 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 :)

farangkao 07/11/14 01:50 PM

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 :)

Baertram 12/16/14 09:39 AM

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.

hisdad 12/16/14 09:46 PM

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.


All times are GMT -6. The time now is 03:15 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI