Thread Tools Display Modes
03-28-18, 09:14 PM   #1
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
Beginner

Hello community!


Im new to Ouf and i want to start learning and write my own unit frames. Can you help me to get started?

I need some examples of Addon structure (toc/lua files),

and if possible the code to create player frame and clickable overlay over the player frame,with their own width and height.
  Reply With Quote
03-29-18, 04:38 AM   #2
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
I would check out some existing ones.

oUF P3lim / oUF Simple are good ones to help you start.

Look here at all the layouts.
  Reply With Quote
03-29-18, 10:08 AM   #3
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
well... i did that 10 times... i just cannot understand what there is.
  Reply With Quote
03-29-18, 10:22 AM   #4
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
I would highly recommend oUF_p3lim or oUF_Phanx over oUF_Simple.

If you are up to it, you could also try oUF_Layout, which is a layout planned for learning purposes. However it is still work in progress and it lacks review, but most of the planned stuff is already in there. I'm planning a small code guide but am not sure when I'll have the time to finish it. Maybe parts of the code will change and some could get rebased to get a smoother learning curve based on feedback.

You could just follow the commits to see how the layout evolved. The prerequisites are that you know the Lua basics and get along with Github. Just ask here if you have trouble understanding something.
  Reply With Quote
03-29-18, 11:30 AM   #5
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
Seems interesting. So i have to work only in settings.lua? How do i change the color of a bar? The bar are black, and i want to get then from green 100% of HP to red 0% of hp.

I just do not understand how the framework makes everything easier for me?
  Reply With Quote
03-29-18, 01:35 PM   #6
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
The idea is to follow the commit order and recreate the changes locally for yourself.

For example the first commit shows that a file named oUF_Layout.toc was created and some content added to it. You place this file in a folder named oUF_Layout, and this folder itself resides in your WoW addons folder (World of Warcraft\Interface\AddOns). This is the same for every addon and is required for it to be loaded by WoW.

Every commit in Git holds a diff of the current state (the one introduced by the commit) of the repository compared to the previous one. So viewing a commit on Github shows you exactly what was added (green) and removed (red) and where. There is also a short commit message that explains the reason for it. This however means that you should follow the commits in order, if you want to learn and are a beginner.

From the fifth commit onward you will start to see the layout in-game (or rather parts of it). Feel free to change the code and reload the interface to view your changes. Breaking it is part of learning how it works.

So i have to work only in settings.lua?
No. All of it is required. Every piece of code is there for a reason.

How do i change the color of a bar?
Just try to recreate the commits one by one until you reach the one with the message "Add some custom colors". If you can't answer your question yourself by then, ask here again.

The bar are black, and i want to get then from green 100% of HP to red 0% of hp.
Depends on which bars you are referring to. For the health and power bars, oUF has the .colorSmooth option. oUF_Layout uses this for the health bars of the player and target frames.

I just do not understand how the framework makes everything easier for me?
Imagine you want to order some food in a restaurant. You only have to talk to the waiter. You don't have to know how s/he processes your order, how the their payment system works or how and by whom the food is prepared. And further you don't have to adapt if anything in this chain changes - the one who has to adapt is the waiter. A framework is a lot like that.
  Reply With Quote
03-29-18, 01:50 PM   #7
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Please keep in mind that creating a new oUF layout from scratch could be a lot of work, especially if you lack understanding of Lua and how addons in WoW work. It is easier to find a layout you like and try to alter its code to suit your needs.

However, if you want to learn, here are some links that might prove helpful:
The Lua 5.1 Manual
Getting started with writing addons

Also install addons that catch and display Lua errors like !BugGrabber and BugSack.
  Reply With Quote
03-29-18, 02:16 PM   #8
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
i saw them all, but none of them has Texture frames. My idea was to use Texture for the Units.

Like player are black only texture, target, focus etc depends on unitclassification, if rare then silver texture, if elite then gold.


I did my whole interface with WA + many custom code. But very hard to understand how to implement this on native addon.

The reason i want to start doing this, is huge lags causing because of WA.


For some reason, i always get stuttering, if there are many ads spawning.
  Reply With Quote
03-29-18, 03:19 PM   #9
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
You have to invest the time in it, because nobody will do it for you. If you don't like that or don't have the time, then just use a layout of your liking. There is no other way around it
  Reply With Quote
03-29-18, 04:24 PM   #10
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 308
Originally Posted by GreyFox777 View Post
The reason i want to start doing this, is huge lags causing because of WA.
Generally the reason why an addon will cause fps/lag is due to poor/improper coding.

As for oUF.. It's a framework that you have to build off of. If you want your very own layout you're going to have to do exactly what Rainrider suggested and put time into learning how to either build your own from scratch or figure out how things are done by a layout created by someone else.
__________________
AddOns: Tim @ WoWInterface
Characters: Mage, Priest, Devoker, Pally
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
03-29-18, 04:59 PM   #11
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
Originally Posted by Tim View Post
Generally the reason why an addon will cause fps/lag is due to poor/improper coding.

As for oUF.. It's a framework that you have to build off of. If you want your very own layout you're going to have to do exactly what Rainrider suggested and put time into learning how to either build your own from scratch or figure out how things are done by a layout created by someone else.
The reason it laggs, is because wow is poorly made. Everything running singlethreaded. I have tons on addons and WA auras. That all laggs like hell, just because wow cannot handle it. Hopefully DX12 will do something.
  Reply With Quote
03-29-18, 05:05 PM   #12
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 308
Don't be so quick to blame WoW itself for the reasoning you lag or run into fps issues. Just because people release addons or create WA strings doesn't mean they're flawless. I bet if you did a trial and error of loading WoW with 1 addon enabled each time you would find the culprit causing the issues. WA could very well be the offending addon due to once again, improper coding within WA strings.
__________________
AddOns: Tim @ WoWInterface
Characters: Mage, Priest, Devoker, Pally
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote
03-29-18, 05:54 PM   #13
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
Originally Posted by Tim View Post
Don't be so quick to blame WoW itself for the reasoning you lag or run into fps issues. Just because people release addons or create WA strings doesn't mean they're flawless. I bet if you did a trial and error of loading WoW with 1 addon enabled each time you would find the culprit causing the issues. WA could very well be the offending addon due to once again, improper coding within WA strings.
Well... most triggers i have from pros. All other auras are default. But i tried to disable everything that contains custom code. Same stuttering while combat.

I just not understand how can it be laggy, if there are ZERO errors...

Last edited by GreyFox777 : 03-29-18 at 05:56 PM.
  Reply With Quote
03-29-18, 09:56 PM   #14
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Originally Posted by GreyFox777 View Post
Well... most triggers i have from pros. All other auras are default. But i tried to disable everything that contains custom code. Same stuttering while combat.

I just not understand how can it be laggy, if there are ZERO errors...
Just because there are no errors, does not mean the code is optimally written. Code can cause lag without causing an error.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
03-29-18, 11:08 PM   #15
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
Originally Posted by JDoubleU00 View Post
Just because there are no errors, does not mean the code is optimally written. Code can cause lag without causing an error.
Okay, that can be. But how you explain then, my custom code i have it disabled completely. I don't think default wa auras will be laggy as hell.
  Reply With Quote
03-30-18, 01:19 AM   #16
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
If everyone got lag and stuttering there would be a lot more complaints on the forums and the game wouldn't be nearly as popular.

I would disable ALL addons and test from there. Some other info would help, what are you machine specs? What settings are you running at? Have you tried resetting your video settings in game to stock?
  Reply With Quote
03-30-18, 05:44 AM   #17
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
I have tried to disable every aura, one by one, but still lags. Tried to disable the addons one by one. Doesen't help.

So i think it's WA (but what auras?) I have around 700 auras. In raid are ~80 enabled.



My specs are just fine:

i7 6700k @4.60
GTX 1080
16 GB RAM
SSD
  Reply With Quote
03-30-18, 05:49 AM   #18
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
No I mean literally all your addons not all your auras. I assume you're using more than a single addon. So press esc, click on addons and uncheck all of them.

and dude 700 auras? wtf.

Last edited by runamonk : 03-30-18 at 06:21 AM.
  Reply With Quote
03-30-18, 10:26 AM   #19
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
Originally Posted by runamonk View Post
No I mean literally all your addons not all your auras. I assume you're using more than a single addon. So press esc, click on addons and uncheck all of them.

and dude 700 auras? wtf.
I have my whole interface build with WA. It pretty good, it has everything i need

But 700 are not at the same time enabled. Without any addons it work flawlessly. But disabling everything isn't a solution.
  Reply With Quote
03-30-18, 10:33 AM   #20
runamonk
A Theradrim Guardian
 
runamonk's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 61
My guess is doing your whole interface with WA is going to be the issue for sure. Wow man. I don't think that was the original intention of WA hehe. That seems a bit excessive. Well that was easy.

Now the hard part is going to be recreating what you need from your old interface to another addon either oUF as the framework and create your own layout. I would start by grabbing one layout that uses the oUF framework and start messing with it and learning how it works. That's what I did with mine. I started with oUF P3lim and oUF Lumen and I've basically created a whole new layout from using those as starter baseline.

Just get one element/unit working and go from there.

Out of curiosity could you post a screen shot of your UI?
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Beginner

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