EQ2Interface.com
Search Downloads


Go Back   EQ2Interface > Developer Discussion > XML Modification Help & Info

Reply
Thread Tools Search this Thread Display Modes
  #1  
Unread 02-26-2008, 02:47 PM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Send a message via AIM to Drumstix42 Send a message via MSN to Drumstix42 Send a message via Yahoo to Drumstix42
Default How to convert decimals to integers

I wanted to follow up with a slight work-around for the problem I explained above:

Quote:
Originally Posted by Drumstix42 View Post
With the new "Top" "Height" "Left" and "Width" values, I've been messing around with some trigger events to try to change the size of other objects.
The problem is if I try to do any math, I'll get the 3 trailing decimals, ie 147.000
I tried manually putting in 147.000 into the "Height" property, and it wouldn't accept it. It just kept the previous value in there.

I guess my request is that these fields be updated to accept decimal inputs, and just trim off the trailing decimals.

*edit* My work around was to just set a nonvisable object the same size as the original, with the same pack size/location properties. (I'm changeing the size of a frame depending on certain conditions). This way I could change the size back and forth, without doing the simple math equations.
I've used my solution in my Info Center, because I needed to use simple math to properly display my drop-down list in the tree-view. I have to add several values together to position them correctly when each expands/collapses. I also had to change the scroll length each time.

While the "Top" "Height" "Left" and "Width" do not support trailing decimals, the comma delimited (IE: Location, MinimumScrollExtent) values will. It will trim off the decimals automatically. I forget where I first saw this mentioned, but I tried it for myself in the UIBuilder a while ago.

Code:
Parent.Parent.Parent.Parent.Select.MinimumScrollExtent=('146' ## ',' ## SUM) SUM=(Parent.Parent.SETTINGS.SizeCollection) + (Parent.Parent.SETTINGS.SizeTotal)
Parent.Parent.HQ.Location=('0' ## ',' ## ADD) ADD=(Parent.Parent.Collection.Top) + (Parent.Parent.Collection.Height)
Hope this helps.
__________________
"I'm afraid you're guilty of thought-crime. Don't bother getting the door, we'll let ourselves in..."
<Donate to DrumsUI> < [DrumsUI] Updater > < [DrumsUI] Full Interface> < Drumstix42 on Twitch.tv
>
Reply With Quote
  #2  
Unread 02-26-2008, 02:57 PM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

Quote:
Originally Posted by Drumstix42 View Post
While the "Top" "Height" "Left" and "Width" do not support trailing decimals, the comma delimited (IE: Location, MinimumScrollExtent) values will. It will trim off the decimals automatically. I forget where I first saw this mentioned, but I tried it for myself in the UIBuilder a while ago.

Code:
Parent.Parent.Parent.Parent.Select.MinimumScrollExtent=('146' ## ',' ## SUM) SUM=(Parent.Parent.SETTINGS.SizeCollection) + (Parent.Parent.SETTINGS.SizeTotal)
Parent.Parent.HQ.Location=('0' ## ',' ## ADD) ADD=(Parent.Parent.Collection.Top) + (Parent.Parent.Collection.Height)
Hope this helps.
You sir are officially my new hero, as - assuming your code works - you found the way to convert any floating point value into an integer, the holy grail of eq2 interface modding. lol.

Strange thing is I could have sworn I had unsuccessfully tried assigning floating point values to both location and size, in particular location, because I wanted to automatically align elements. Maybe it's because you used a variable and I probably didn't, or because you used brackets? Or maybe this was recently changed.

Anyway, take these:
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
  #3  
Unread 02-26-2008, 03:10 PM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Send a message via AIM to Drumstix42 Send a message via MSN to Drumstix42 Send a message via Yahoo to Drumstix42
Default

Well it worked about 20+ times in the Info Center


Just thinking about it more in my head...
You could use dummy pages and do just about any mathematical equation and set it into the page's location (or whichever). This would then update the "Top", etc values which could then be easily used anywhere else in the UI.

Now I can update my Resist average value with a real, non-floating decimal, number.
__________________
"I'm afraid you're guilty of thought-crime. Don't bother getting the door, we'll let ourselves in..."
<Donate to DrumsUI> < [DrumsUI] Updater > < [DrumsUI] Full Interface> < Drumstix42 on Twitch.tv
>
Reply With Quote
  #4  
Unread 02-26-2008, 03:17 PM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

Exactly, that's what you got the nanas for.
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
  #5  
Unread 02-27-2008, 09:27 AM
lordebon lordebon is offline
Fetish Core author
This person is a EQ2Map developer.
Featured
 
Join Date: Jun 2005
Server: Crushbone
Posts: 2,667
Default

Ohhh.

Float -> Int has been like the holy grail.

You sir do indeed deserve 'nanas and more.

I dub thee Drumstix42, Lord of Floating Integers!
Reply With Quote
  #6  
Unread 02-27-2008, 12:07 PM
dragowulf's Avatar
dragowulf dragowulf is offline
A man among men
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Nagafen
Posts: 934
Send a message via AIM to dragowulf Send a message via MSN to dragowulf
Default

Quote:
Originally Posted by lordebon View Post
Ohhh.

Float -> Int has been like the holy grail.

You sir do indeed deserve 'nanas and more.

I dub thee Drumstix42, Lord of Floating Integers!
I'm confused....what exactly does drum's code do????
__________________
May Jesus Have Mercy On Us
Reply With Quote
  #7  
Unread 02-27-2008, 12:41 PM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

It creates beautiful INTEGERS out of the ugly and mean numbers having a decimal point that every scripted mathematical outputs, and we want integers since no UI element (except those that Drumstix discovered) accepts non-integer numbers as values (unless it's as text of course).
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
  #8  
Unread 02-27-2008, 01:25 PM
dragowulf's Avatar
dragowulf dragowulf is offline
A man among men
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Nagafen
Posts: 934
Send a message via AIM to dragowulf Send a message via MSN to dragowulf
Default

Quote:
Originally Posted by gm9 View Post
It creates beautiful INTEGERS out of the ugly and mean numbers having a decimal point that every scripted mathematical outputs, and we want integers since no UI element (except those that Drumstix discovered) accepts non-integer numbers as values (unless it's as text of course).
Why would you want non-integer numbers as values???
__________________
May Jesus Have Mercy On Us
Reply With Quote
  #9  
Unread 02-27-2008, 01:42 PM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

Well you don't, that's the whole point, but previously we had no way to obtain integers, since every mathematical operation in eq2 ui scripting adds a decimal point.
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
  #10  
Unread 02-27-2008, 01:43 PM
dragowulf's Avatar
dragowulf dragowulf is offline
A man among men
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Nagafen
Posts: 934
Send a message via AIM to dragowulf Send a message via MSN to dragowulf
Default

Quote:
Originally Posted by gm9 View Post
Well you don't, that's the whole point, but previously we had no way to obtain integers, since every mathematical operation in eq2 ui scripting adds a decimal point.
So exactly why would this help us?
__________________
May Jesus Have Mercy On Us
Reply With Quote
  #11  
Unread 02-27-2008, 01:45 PM
lordebon lordebon is offline
Fetish Core author
This person is a EQ2Map developer.
Featured
 
Join Date: Jun 2005
Server: Crushbone
Posts: 2,667
Default

You don't, you want integers.

But if I do 5+6 the game gives 11.0 (a float) and then if I try to put that in somewhere it gets upset because it only wants to take intergers and not floats.

But with this you can put in a float which will be converted to an integer and then can be read and put into those fields that only take integers.
Reply With Quote
  #12  
Unread 02-27-2008, 01:55 PM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

Maybe an example helps.
A=1
B=3
If you do
C=A+B
D=B-A
you end up with
C=4.0000
D=2.0000
Now if you do
Location=C,D
you get
Location=4,2
which equals
Left=4
Top=2
Tada, you have your integers and can assign them to something else, eg
IconSize=Left
This allows you to assign the output of the mathematical operation A+B to, for example, IconSize, which you cannot do directly because of the decimal point.
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.

Last edited by gm9 : 02-27-2008 at 02:48 PM.
Reply With Quote
  #13  
Unread 02-27-2008, 02:33 PM
dragowulf's Avatar
dragowulf dragowulf is offline
A man among men
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Nagafen
Posts: 934
Send a message via AIM to dragowulf Send a message via MSN to dragowulf
Default

I get it. That's going to be really helpful Drums.

Nice work....lol and thanks for explaining it to me.
__________________
May Jesus Have Mercy On Us
Reply With Quote
  #14  
Unread 02-28-2008, 04:56 PM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Send a message via AIM to Drumstix42 Send a message via MSN to Drumstix42 Send a message via Yahoo to Drumstix42
Default

It works well.
I used it in my recent Persona window upload for the Average resist value. Feel free to split these posts into maybe a sticky for future reference.
__________________
"I'm afraid you're guilty of thought-crime. Don't bother getting the door, we'll let ourselves in..."
<Donate to DrumsUI> < [DrumsUI] Updater > < [DrumsUI] Full Interface> < Drumstix42 on Twitch.tv
>
Reply With Quote
  #15  
Unread 03-05-2008, 01:19 PM
Zonx's Avatar
Zonx Zonx is offline
A Green Troll
This person is a EQ2Map developer.
Featured
 
Join Date: Dec 2004
Server: Blackburrow
Posts: 2,221
Send a message via Yahoo to Zonx
Default

Hehe, I had hoped this would work when I saw the post from SOE about adding the seperated size and location atributes. The comma seperated values have delt with float all along, the problem was getting the converted number out of the comma string

FYI there are some controls that expect float, progress bars for example.
Reply With Quote
  #16  
Unread 03-05-2008, 01:33 PM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

You are right Zonx, I actually went through an old project of mine that has lots of dummy windows to save arbitrary values and it used that property of the size attribute as well. In that case I was using it to cut of the part after a comman in another size attribute. Say you have SizeA=100,20 and SizeB=200,30 then SizeC=SizeA,SizeB will be => SizeC=100,200. The things you forget...
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Forum Jump


All times are GMT -5. The time now is 01:53 AM.


Our Network
EQInterface | EQ2Interface | WoWInterface | LoTROInterface | ESOUI | MMOUI