Thread Tools Display Modes
11/09/14, 02:05 PM   #1
justinbarrett
Join Date: Nov 2014
Posts: 25
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.
  Reply With Quote
11/09/14, 04:39 PM   #2
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by justinbarrett View Post
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
  Reply With Quote
11/09/14, 05:10 PM   #3
justinbarrett
Join Date: Nov 2014
Posts: 25
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?
  Reply With Quote
11/09/14, 05:30 PM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by justinbarrett View Post
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

Last edited by circonian : 11/09/14 at 05:34 PM.
  Reply With Quote
11/09/14, 05:39 PM   #5
justinbarrett
Join Date: Nov 2014
Posts: 25
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.
  Reply With Quote
11/09/14, 05:55 PM   #6
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by justinbarrett View Post
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.
  Reply With Quote
11/09/14, 06:07 PM   #7
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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.

Last edited by merlight : 11/09/14 at 06:12 PM.
  Reply With Quote
11/09/14, 07:05 PM   #8
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
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.
  Reply With Quote
11/09/14, 11:17 PM   #9
justinbarrett
Join Date: Nov 2014
Posts: 25
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.

Last edited by justinbarrett : 11/09/14 at 11:29 PM.
  Reply With Quote

ESOUI » Developer Discussions » Tutorials & Other Helpful Info » simple questions new to this api.

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