ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Tutorials & Other Helpful Info (https://www.esoui.com/forums/forumdisplay.php?f=172)
-   -   simple questions new to this api. (https://www.esoui.com/forums/showthread.php?t=2417)

justinbarrett 11/09/14 02:05 PM

simple questions new to this api.
 
I am simply trying to get the screen size in X to pass on to my exp bar background for dynamic ui scaling, but cannot seem to find it(the way to return screen size) anywhere...
can anyone help?
I did look on the wiki but saw no clear answer...and the wiki is not the easiest to navigate if you are new to this kind of coding.

circonian 11/09/14 04:39 PM

Quote:

Originally Posted by justinbarrett (Post 13120)
I am simply trying to get the screen size in X to pass on to my exp bar background for dynamic ui scaling, but cannot seem to find it(the way to return screen size) anywhere...
can anyone help?
I did look on the wiki but saw no clear answer...and the wiki is not the easiest to navigate if you are new to this kind of coding.

Try:
Lua Code:
  1. GuiRoot:GetWidth()  -- for the width
  2. GuiRoot:GetHeight() -- for the height

justinbarrett 11/09/14 05:10 PM

ty for your response.
using this..
Code:

local screensizex = GuiRoot:GetWidth()
UI_BackgroundWindowBackdrop:SetValue(screensizeX)

I get this error
"attempt to index a nil value stack traceback"(then pointing to the function)
GetWidth() is expecting a value maybe dimension.x or something?
or is there a better place to ask such beginner questions?

circonian 11/09/14 05:30 PM

Quote:

Originally Posted by justinbarrett (Post 13128)
ty for your response.
using this..
Code:

local screensizex = GuiRoot:GetWidth()
UI_BackgroundWindowBackdrop:SetValue(screensizeX)

I get this error
"attempt to index a nil value stack traceback"(then pointing to the function)
GetWidth() is expecting a value maybe dimension.x or something?
or is there a better place to ask such beginner questions?

Lua is case sensative
Lua Code:
  1. --Lua is case senstaive on the first line you have screensizex
  2. local screensizex = GuiRoot:GetWidth()
  3. --but on the second you use screensizeX
  4. UI_BackgroundWindowBackdrop:SetValue(screensizeX)
  5.  
  6. -- That wont work make them match somehow, for example change the first line to:
  7. local screensizeX = GuiRoot:GetWidth()

I don't know what: UI_BackgroundWindowBackdrop is, I'm assuming a backdrop control, so I'm guessing your trying to resize that control to be the width of the screen?
So your probably wanting to do:
Lua Code:
  1. -- This:
  2. UI_BackgroundWindowBackdrop:SetWidth(screensizeX)
  3. -- Instead of this:
  4. UI_BackgroundWindowBackdrop:SetValue(screensizeX)


The General Authoring Discussion forum: General Authoring Discussion
Or Lua/XML Help forum: Lua/XML Help

justinbarrett 11/09/14 05:39 PM

I am aware of the case sensitivity, that was a typo on my part. I still have the error...I will poke around some more , and if I am just spinning my wheels I will head over to the lua/xml help forum. thanks a lot...I've never used lua or xml...so this is all a bit odd coming from a C coding background. but in a sense it is a lot easier also....anyway ty.

circonian 11/09/14 05:55 PM

Quote:

Originally Posted by justinbarrett (Post 13130)
I am aware of the case sensitivity, that was a typo on my part. I still have the error...I will poke around some more , and if I am just spinning my wheels I will head over to the lua/xml help forum. thanks a lot...I've never used lua or xml...so this is all a bit odd coming from a C coding background. but in a sense it is a lot easier also....anyway ty.

Ok, well other than that there is nothing wrong with it. I even copy/pasted & tested it in case there is an type-o I wasn't seeing, works fine.

If you don't figure it out though you can post your code & the exact error message the game gives you I'll look at it.

merlight 11/09/14 06:07 PM

If you need to span the whole screen width, you don't need to know it. Use anchors instead.

Lua Code:
  1. UI_BackgroundWindowBackdrop:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, 0, 0)
  2. UI_BackgroundWindowBackdrop:SetAnchor(BOTTOMRIGHT, GuiRoot, TOPRIGHT, 0, 50 --[[ this will be the height]])

edit: regarding the error, I'd say UI_BackgroundWindowBackdrop is nil (operator : is the attempt to index it). If you have that control in XML, make sure you include the .xml file in your manifest.

circonian 11/09/14 07:05 PM

Quote:

Originally Posted by merlight (Post 13132)
edit: regarding the error, I'd say UI_BackgroundWindowBackdrop is nil (operator : is the attempt to index it). If you have that control in XML, make sure you include the .xml file in your manifest.

Ah, good point I didn't think of that, probably.

justinbarrett 11/09/14 11:17 PM

I can manipulate the bar that I have already setup in the gui xml, and there is a backdrop there as well... this is why I am confused....I am positive it is some small error in my code....but I went to sleep after tinkering for a just a bit last night...so I will take another crack when I fresh eyes in a bit.

EDIT: Seems to be working fine now??? typical....once in a while we just need to quit ESO alltogether and reopen files :)
I feel silly...but hey, this stuff happens.


All times are GMT -6. The time now is 02:57 PM.

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