ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Help/Support (https://www.esoui.com/forums/forumdisplay.php?f=164)
-   -   New to the API. Already got stuck. (https://www.esoui.com/forums/showthread.php?t=6038)

step1step2 01/26/16 09:30 AM

New to the API. Already got stuck.
 
Are only addons uploaded to this website supported by the client? I've tried quite a few things to get started but nothing works so far. Even code of your wiki doesn't work. My first guess was that the wiki might be outdated but this code seems to work for other addons as well so wtf.

Do you have a Slack channel? The IRC channel is dead. I dislike creating threads to ask. I have 1 question every 10 minutes. I doubt you want me to spam your forums.

Any help is very much appreciated.

One of many attempts (I didn't save them all):
https://gist.github.com/anonymous/2976abea033cb77b120f
The code is based on CombatIndicator. An addon that does seem to work.
I was hoping to receive an exception at least. But I'm getting ignored.

votan 01/26/16 09:45 AM

Hi and welcome :)

Watch out the version number in the right corner. If there is no version number (currently 2.2.4) it is "out-dated". It may still works, but it's likely not a good example to start with.

Try http://www.esoui.com/downloads/info934-HelloWorld.html

And yes, keeping tutorials up-to-date is work, too :D

Later on, you may check the "Developer Utilities" category: http://www.esoui.com/downloads/cat35.html

sirinsidiator 01/26/16 10:17 AM

Welcome!

If you do not see any output or errors at all, it might be an issue with your meta file which prevents your addon from getting loaded.
Check if the addon is in the list of loaded addons ingame and if it is, put only error("test") in your file to see if the file is even loaded.

Also don't worry about asking many questions on the forums. That's what they are here for. :D
Haven't used Slack until now and don't think we have a Slack channel, but maybe someone could create one as an alternative to the more or less failed plan of making an ingame guild for exactly the same purpose? :rolleyes:

haggen 01/26/16 11:10 AM

Your code has holes all over it. :P

Also d() doesn't work at startup because (I think) the chat isn't available at that point (d() prints at the chat window).

Are you sure you're putting the add-ons in the correct folder? I don't mean to be rude I'm just checking.

I'd suggest you start with something even smaller, like a slash command that prints a message and then go from there in small steps. When you get the hang of it you'll naturally increase the size of each step.

This, for instance:

Code:

local function OnAddOnLoaded()
    SLASH_COMMANDS["/myaddon"] = function()
        d("Hey oh!")
    end
end

EVENT_MANAGER:RegisterForEvent("MyAddOn", EVENT_ADD_ON_LOADED, OnAddOnLoaded)

Put it in a file called MyAddOn.lua with another file called MyAddOn.txt with this content:

Code:

# APIVersion: 100013
# Title: MyAddOn

MyAddOn.lua

Both files go in a folder called MyAddOn, and that folder you put in MyDocuments\Elder Scrolls Online\live\AddOns\.

If you're in European server change "live" to "liveeu".

Log in the game and see what happens when you type /myaddon.

coolmodi 01/26/16 12:42 PM

Quote:

Originally Posted by haggen (Post 25657)
Also d() doesn't work at startup because (I think) the chat isn't available at that point (d() prints at the chat window).

To still output things after "start" you can use the EVENT_PLAYER_ACTIVATED, at least that's what I did.

Lua Code:
  1. local function OnPlayerActive()
  2.     d("sdghskdg")
  3. end
  4.  
  5. EVENT_MANAGER:RegisterForEvent("MyAddOn", EVENT_PLAYER_ACTIVATED, OnPlayerActive)

step1step2 01/26/16 12:53 PM

Quote:

Originally Posted by votan (Post 25655)
Hi and welcome :)

Watch out the version number in the right corner. If there is no version number (currently 2.2.4) it is "out-dated". It may still works, but it's likely not a good example to start with.

Try http://www.esoui.com/downloads/info934-HelloWorld.html

And yes, keeping tutorials up-to-date is work, too :D

Later on, you may check the "Developer Utilities" category: http://www.esoui.com/downloads/cat35.html

Thank you very much. It helps.

Quote:

Originally Posted by sirinsidiator (Post 25656)
Welcome!

If you do not see any output or errors at all, it might be an issue with your meta file which prevents your addon from getting loaded.
Check if the addon is in the list of loaded addons ingame and if it is, put only error("test") in your file to see if the file is even loaded.

Also don't worry about asking many questions on the forums. That's what they are here for. :D
Haven't used Slack until now and don't think we have a Slack channel, but maybe someone could create one as an alternative to the more or less failed plan of making an ingame guild for exactly the same purpose? :rolleyes:

https://gist.github.com/anonymous/32...aneuver-lua-L4
Didn't do anything. Is there something like a debug console I need to enable?
The addon seems to be loaded:



Quote:

Originally Posted by haggen (Post 25657)
Your code has holes all over it. :P

Also d() doesn't work at startup because (I think) the chat isn't available at that point (d() prints at the chat window).

Are you sure you're putting the add-ons in the correct folder? I don't mean to be rude I'm just checking.

I'd suggest you start with something even smaller, like a slash command that prints a message and then go from there in small steps. When you get the hang of it you'll naturally increase the size of each step.

This, for instance:

Code:

local function OnAddOnLoaded()
    SLASH_COMMANDS["/myaddon"] = function()
        d("Hey oh!")
    end
end

EVENT_MANAGER:RegisterForEvent("MyAddOn", EVENT_ADD_ON_LOADED, OnAddOnLoaded)

Put it in a file called MyAddOn.lua with another file called MyAddOn.txt with this content:

Code:

# APIVersion: 100013
# Title: MyAddOn

MyAddOn.lua

Both files go in a folder called MyAddOn, and that folder you put in MyDocuments\Elder Scrolls Online\live\AddOns\.

If you're in European server change "live" to "liveeu".

Log in the game and see what happens when you type /myaddon.

Your code didn't work. I have tried to use brackets of the Hello World template tho. Unfortunately it didn't help either.
https://gist.github.com/anonymous/323b5dc4352df3cfb43e

sirinsidiator 01/26/16 01:03 PM

If the error never shows up, it means the file does not get loaded. Can you upload the whole thing somewhere so we can see your addon manifest and folder structure?

Randactyl 01/26/16 01:15 PM

Quote:

Originally Posted by sirinsidiator (Post 25656)
Haven't used Slack until now and don't think we have a Slack channel, but maybe someone could create one as an alternative to the more or less failed plan of making an ingame guild for exactly the same purpose? :rolleyes:

Neither have I, but I went ahead and made esouidevs.slack.com. I don't know if it will fare any better than IRC, but I suppose it's worth a shot :rolleyes:. I think it would actually be convenient if it gets traction.

haggen 01/26/16 01:21 PM

Quote:

Originally Posted by step1step2 (Post 25661)
Your code didn't work. I have tried to use brackets of the Hello World template tho. Unfortunately it didn't help either.
https://gist.github.com/anonymous/323b5dc4352df3cfb43e

You changed the code and introduced a bug. :P No worries I'll walk you through it:

When you defined the #Initialize method you used the dot notation, so "self" doesn't exist in there.

Either you give that method the correct "self" object or you use the colon notation:

Code:

function Maneuver:Initialize(...)
Which works exactly like if you had done this:

Code:

function Maneuver.Initialize(self, ...)
But when you call this method you have to give it the "self" it is expecting so you either do this:

Code:

Maneuver:Initialize(...)
Or this:

Code:

Maneuver.Initialize(Maneuver, ...)
Because the way you did "self" in there is the eventCode thrown by EVENT_ADD_ON_LOADED, so the test "... == self.name" will never work.

Also no need for "GetEventManager()". That's exactly what was assigned to the global EVENT_MANAGER, so you can just use it.

A big pro tip that worked really great for me was to read A REALLY LOT of the source code for the stock UI, you can find it here: http://esodata.uesp.net/current/src/luadir.html

Just explore the folders and files reading randomly or search for something you'd like to see, you'll learn TONS of stuff about the API and Lua (and the methodologies and background of the developers at ZOS :banana:).

EDIT.
There, fixed it for you: https://gist.github.com/haggen/d5672ea740eb4ae326a0

haggen 01/26/16 01:21 PM

Quote:

Originally Posted by Randactyl (Post 25664)
Neither have I, but I went ahead and made esouidevs.slack.com. I don't know if it will fare any better than IRC, but I suppose it's worth a shot :rolleyes:. I think it would actually be convenient if it gets traction.

Why not just ESOUI?

Randactyl 01/26/16 01:29 PM

Quote:

Originally Posted by haggen (Post 25666)
Why not just ESOUI?

I picked what I thought I remembered was the IRC channel name (it was actually #esouidev).
But it doesn't really matter. I made esoui.slack.com too, so I guess vote for what you guys want :cool:

PS, sorry for being slightly off topic :D:banana:

haggen 01/26/16 01:33 PM

Quote:

Originally Posted by Randactyl (Post 25667)
I picked what I thought I remembered was the IRC channel name (it was actually #esouidev).
But it doesn't really matter. I made esoui.slack.com too, so I guess vote for what you guys want :cool:

PS, sorry for being slightly off topic :D:banana:

You're forgiven. Now invite me there [email protected] :D

sirinsidiator 01/26/16 01:54 PM

Guess I need an invite too: [email protected] :D

step1step2 01/26/16 03:57 PM

Thank you very much everyone!
I want an invite as well :banana:
[email protected]

SnowmanDK 01/26/16 04:07 PM

Quote:

Originally Posted by step1step2 (Post 25675)
Thank you very much everyone!
I want an invite as well :banana:
[email protected]

Sidenote:
Lua Code:
  1. d("blabla")
will NOT work until you have made a function for it:
Lua Code:
  1. local function d(...)
  2.     CHAT_SYSTEM:AddMessage(...)
  3. end
;)

haggen 01/26/16 04:18 PM

Quote:

Originally Posted by SnowmanDK (Post 25677)
Sidenote:
Lua Code:
  1. d("blabla")
will NOT work until you have made a function for it...

Actually it will. "d()" is defined globally here: http://esodata.uesp.net/100013/src/l...ls.lua.html#36

step1step2 01/26/16 04:18 PM

Quote:

Originally Posted by SnowmanDK (Post 25677)
Sidenote:
Lua Code:
  1. d("blabla")
will NOT work until you have made a function for it:
Lua Code:
  1. local function d(...)
  2.     CHAT_SYSTEM:AddMessage(...)
  3. end
;)

Oh wow. I was assuming it is part of the API :eek:

step1step2 01/26/16 04:28 PM

Quote:

Originally Posted by haggen (Post 25679)
Actually it will. "d()" is defined globally here: http://esodata.uesp.net/100013/src/l...ls.lua.html#36

It still seems to work this way. Do I need to include a lib?

Randactyl 01/26/16 04:45 PM

Final off topic post:

I think Haggen and I have settled on Gitter for quick communication. See his post here - http://www.esoui.com/forums/showthre...5676#post25676

haggen 01/26/16 04:49 PM

Quote:

Originally Posted by step1step2 (Post 25681)
It still seems to work this way. Do I need to include a lib?

Absolutely not. Everything you find here http://esodata.uesp.net/100013/src/l...es/luadir.html or here https://github.com/ESOUI/ESOUI (which are the same code base by the way) is the actual source bundled by the game so you have access to everything that's global (and not protected: http://wiki.esoui.com/Protected_and_Private_functions).


All times are GMT -6. The time now is 11:18 PM.

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