Download
(5 Kb)
Download
Updated: 05/22/20 09:18 PM
Pictures
File Info
Compatibility:
Greymoor (6.0.5)
Harrowstorm (5.3.5)
Dragonhold (5.2.5)
Scalebreaker (5.1.5)
Elsweyr (5.0.5)
Updated:05/22/20 09:18 PM
Created:05/27/18 12:46 PM
Monthly downloads:34
Total downloads:7,326
Favorites:14
MD5:
Categories:Developer Utilities, Utility Mods
New Addon Template  Popular! (More than 5000 hits)
Version: 1.29
by: Phuein [More]
Gift me @phuein in-game, if you have extra crowns and appreciate my addons. (Can even ask which DLC I missed.) Thank you!

This is not a game addon and it does nothing meaningful.

Requirements:
  • LibAddonMenu-2.0 >= 28

This is a template for new addons. I often use these features when making or upgrading an addon. It is intended to be a "blank slate" to work with quickly and efficiently. Easier to remove a few code blocks, than it is to write them from scratch.

Included in this template are the following:
  • Manifest.
  • Keybinding.
  • LibAddonMenu-2.0 with all the default menu options.
  • Multiple language support.
  • Chat output, an animated announcement (center), and an alert (top-right.)
  • A slash command: "/newaddon".
  • Colors.
  • XML UI elements.
  • Notification when loaded for the first time.
  • Events handled: EVENT_ADD_ON_LOADED, EVENT_PLAYER_ACTIVATED, zo_callLater() [which uses RegisterForUpdate().]
  • Toggle savedVars per character or account-wide.

More useful features can be added in time. I welcome all code input, improvements, and requests. I suggest opening all of the project's files together (except the external libraries,) to see how they interact; from language, to hotkeys, to menus.

Writing addons shouldn't be about hunting for code online, but rather focusing on functionality and aesthetics.
1.29
- Added the AddOnVersion identifier, for other addons to match against if needed.

1.28
- Removed included LibStub and LibAddonMenu. Those are now external requirements.

1.27
- Updated the slash commands autocomplete.

1.26
- Fix.

1.25
- Minor tweaks.
- Added support for character/account savedVariables, with a toggle in settings.

1.23
- Minor tweaks.

1.2
- Settings code is easier to modify and improved.

1.1
- Bugfixes.
- Separated Settings menu to its own file.
- Changed some code format for readability.

1.0
- Core functionality for most addons. Full list in the description page.
Optional Files (0)


Archived Files (10)
File Name
Version
Size
Uploader
Date
1.28
5kB
Phuein
05/21/20 07:33 PM
1.27
50kB
Phuein
02/24/20 08:35 PM
1.26
50kB
Phuein
07/15/19 11:57 AM
1.25
50kB
Phuein
06/15/19 09:22 PM
1.23
48kB
Phuein
03/28/19 04:00 AM
1.22
48kB
Phuein
03/26/19 02:58 PM
1.21
48kB
Phuein
03/25/19 09:54 PM
1.2
48kB
Phuein
08/16/18 12:42 PM
1.1
48kB
Phuein
06/09/18 01:08 AM
1.0
47kB
05/27/18 12:46 PM


Post A Reply Comment Options
Unread 09/15/18, 12:14 AM  
RavenMind
 
RavenMind's Avatar

Forum posts: 6
File comments: 391
Uploads: 0
Nice work! I've been thinking about learning LUA & trying my hand at addons, and this template looks to be very useful! Thank you for taking the time to post it!
Report comment to moderator  
Reply With Quote
Unread 09/15/18, 10:31 PM  
Phuein
 
Phuein's Avatar
AddOn Author - Click to view AddOns

Forum posts: 132
File comments: 268
Uploads: 16
Originally Posted by RavenMind
Nice work! I've been thinking about learning LUA & trying my hand at addons, and this template looks to be very useful! Thank you for taking the time to post it!
I enjoy others' addons, so go ahead!
Report comment to moderator  
Reply With Quote
Unread 06/16/19, 04:40 AM  
kesoapa
 
kesoapa's Avatar

Forum posts: 0
File comments: 8
Uploads: 0
Second that @RavenMind

This might just be the push to take the leap.

Thanks for your great work @Phuein
Report comment to moderator  
Reply With Quote
Unread 06/16/19, 09:38 AM  
Phuein
 
Phuein's Avatar
AddOn Author - Click to view AddOns

Forum posts: 132
File comments: 268
Uploads: 16
Originally Posted by kesoapa
Second that @RavenMind

This might just be the push to take the leap.

Thanks for your great work @Phuein
Glad to hear that! Enjoy!
Report comment to moderator  
Reply With Quote
Unread 07/15/19, 11:27 AM  
SkidBrain
 
SkidBrain's Avatar

Forum posts: 0
File comments: 1
Uploads: 0
Thanks for the template! It's quite helpful and has encouraged me to start poking at things.

I just needed to change "Junkee" on line 84 to "NewAddon" and was good to go.

Cheers.
Report comment to moderator  
Reply With Quote
Unread 07/15/19, 11:56 AM  
Phuein
 
Phuein's Avatar
AddOn Author - Click to view AddOns

Forum posts: 132
File comments: 268
Uploads: 16
Originally Posted by SkidBrain
Thanks for the template! It's quite helpful and has encouraged me to start poking at things.

I just needed to change "Junkee" on line 84 to "NewAddon" and was good to go.

Cheers.
Whoops! Thanks for informing me, updating now to fix that.

Enjoy!
Report comment to moderator  
Reply With Quote
Unread 05/19/20, 02:39 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5988
Uploads: 78
Hi,

please remove the LibStub dependency in your addon AND the embedded libraries!
Ppl are using this template and create new addons based on wrong and outdated data.
If you include the libs include them with their txt files properly please and do not hardcode them from your example addon's txt file.
New devs cannot see that this is wrong and rely on your code here

LibStub is obsolete and IF it is used it is used within the libraries txt files, not your addon's manifest.

e.g.
wrong:
Code:
 ## DependsOn: LibStub LibAddonMenu-2.0
correct:
Lua Code:
  1. ## DependsOn: LibAddonMenu-2.0>=28
-> >=28 means it will need version 28 or higher of the library to assure the global variable of the lib exists, see below.

Read this please:
https://wiki.esoui.com/Libraries

And the calls to the libraries should not be done via LibStub anymore but the global variable of the libraries:
https://www.esoui.com/forums/showthr...hlight=LibStub

e.g.
wrong:
Code:
 local LAM = LibStub("LibAddonMenu-2.0")
correct:
Lua Code:
  1. local LAM = LibAddonMenu2

Many thanks
Last edited by Baertram : 05/20/20 at 04:25 AM.
Report comment to moderator  
Reply With Quote
Unread 05/19/20, 10:11 PM  
Phuein
 
Phuein's Avatar
AddOn Author - Click to view AddOns

Forum posts: 132
File comments: 268
Uploads: 16
Originally Posted by Baertram
Hi,

please remove the LibStub dependency in your addon AND the embedded libraries!

Hey Baertram, thanks for the reminder. I'm glad to hear people are encouraged to make new addons using this template. I'll definitely review the dependencies for the next release.

EDIT: I went ahead and removed the old dependencies, instead using the new external dependency format. If it looks good to you, I can apply this to my other addons in the future.
Last edited by Phuein : 05/21/20 at 07:34 PM.
Report comment to moderator  
Reply With Quote
Unread 05/22/20, 10:41 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5988
Uploads: 78
Looks good to me, thanks.

Hint:
I'd have added the ## AddOnVersion: tag to the txt file to show the new devs it exists but this is minor and most likely needed only if your addon would be a lib or another addon depends on a special version of it.
Report comment to moderator  
Reply With Quote
Unread 05/22/20, 09:18 PM  
Phuein
 
Phuein's Avatar
AddOn Author - Click to view AddOns

Forum posts: 132
File comments: 268
Uploads: 16
Originally Posted by Baertram
Looks good to me, thanks.

Hint:
I'd have added the ## AddOnVersion: tag to the txt file to show the new devs it exists but this is minor and most likely needed only if your addon would be a lib or another addon depends on a special version of it.

Excellent. And that's a good idea, added just now. Thanks.
Report comment to moderator  
Reply With Quote
Unread 05/23/20, 04:33 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5988
Uploads: 78
Thanks.
I'll link it in the ESOUI Wiki if this is ok for you?

Top right side:
https://wiki.esoui.com/Main_Page

https://wiki.esoui.com/AddOn_templates
Last edited by Baertram : 05/23/20 at 04:33 AM.
Report comment to moderator  
Reply With Quote
Unread 05/23/20, 06:52 PM  
Phuein
 
Phuein's Avatar
AddOn Author - Click to view AddOns

Forum posts: 132
File comments: 268
Uploads: 16
Originally Posted by Baertram
Thanks.
I'll link it in the ESOUI Wiki if this is ok for you?

For sure, it's there to help others. Thanks.
Report comment to moderator  
Reply With Quote
Unread 06/27/20, 06:45 AM  
Soulbull

Forum posts: 0
File comments: 1
Uploads: 0
Getting LibAddonMenu-2 Error when changing global variable name

So I changed the global variable name NewAddon to mine for my Addon but after that, everything broke.
I only changed names and other changeable variables.
Here is a Screenshot of the Error Code in LibDebuggerLog.lua


Settings.lua changed




I'm new to lua and Addon Programming with lua but I have programming experience. Already tried a lot of methods and different way to create the menu but everything failed. If you need more Information, let me know. Thanks in advance
Report comment to moderator  
Reply With Quote
Unread 07/03/20, 08:54 AM  
Phuein
 
Phuein's Avatar
AddOn Author - Click to view AddOns

Forum posts: 132
File comments: 268
Uploads: 16
Post Re: Getting LibAddonMenu-2 Error when changing global variable name

Originally Posted by Soulbull
So I changed the global variable name NewAddon to mine for my Addon but after that, everything broke.
I only changed names and other changeable variables.

It's hard to say without seeing the whole project. You might want to already put it up on ESOUI for review and feedback. Or in a repository like Github. My first guess would be anything related to filenames and NewAddon.txt being renamed correctly. Anything more would require access to the code.
Report comment to moderator  
Reply With Quote
Unread 07/09/20, 05:13 AM  
DarkPhalanx
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 31
Uploads: 2
Thanks for the template I created my first addon with it, mentioned you in the description !
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: