EQ2Interface.com
Search Downloads


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

Reply
Thread Tools Search this Thread Display Modes
  #1  
Unread 02-28-2022, 11:48 PM
Regn Regn is offline
A Young Mystail Rat
 
Join Date: Dec 2013
Server: Everfrost
Posts: 7
Default Math help

I'm trying to figure out why I can't do basic math.

HealthAmount and WardAmount are variables.
WardAmount uses event OnTextChanged.
Test is display.
Code:
<Text Name="HealthAmount" Text="0.000" DynamicData="/GameData.Stats.HealthRange" Visible="false" />
<Text Name="WardAmount" Text="0.000" DynamicData="/GameData.Maintained.Spell_1.AmountRemaining" Visible="false" OnTextChanged="..." />
<Text Name="Test" Text="0.0" ... />
Code:
 Name="WardAmount" OnTextChanged="

	HasHealth = Parent.HealthAmount.Text &gt; 0
	HasWard = Parent.WardAmount.Text &gt; 0

	HealthValue = HasHealth ? Parent.HealthAmount.Text : 0
	WardValue = HasWard ? Parent.WardAmount.Text : 0

	Parent.Test.Text = HealthValue + WardValue"
If I set Parent.Test.Text = HealthValue, I will see my total health.
If I set Parent.Test.Text = WardValue, I will see the ward amount (I must make sure to be unbuffed so that it finds "Spell_1").

If I instead use A="5" and B="6" and OnTextChanged="Parent.Test.Text = (A) + (B)", it works, but I don't know how to use variables in A="" and B="".

Does anyone know whether this is a string conversion, null, or syntax error?

I'm guessing this is because /GameData.Stats.HealthRange contains a comma.

Last edited by Regn : 03-01-2022 at 12:49 AM.
Reply With Quote
  #2  
Unread 03-01-2022, 08:22 AM
Darqwood's Avatar
Darqwood Darqwood is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Aug 2005
Posts: 847
Default

It's worse than that. HealthRange is actually a multi-line string with two values: current health and max health, separated by a CRLF. If you look at the stats sidebar on the Character window for example, current and max health are displayed together in a multi-line label.

You can strip out the current health value with INT(HealthAmount) and it won't have any commas, but manipulating the resulting value is messy. As you get into large current-day health values you may start getting math results in scientific notation. One workaround is to divide the value by 10,000 or 100,000 etc. to get smaller numbers to work with.


.
Reply With Quote
  #3  
Unread 03-01-2022, 05:16 PM
Regn Regn is offline
A Young Mystail Rat
 
Join Date: Dec 2013
Server: Everfrost
Posts: 7
Default

Thanks for the reply, Darq. And long time no see.

The following code seemed to work, with only one creepy hiccup.
Code:
OnTextChanged="
        WardAmount = (INT(Parent.WardAmount.Text) ## ',' ## '0')
        HealthAmount = (INT(Parent.HealthAmount.Text) ## ',' ## '0')
        Parent.Test.Text = WardAmount / HealthAmount"
My Ratonga started to shout "I-I-I-I-I----" until I cancelled the Ward, then he began to repeat the phrase "I'll be just a moment, talks amongst yourselves," indefinitely.

But even if I find a way to solve this creepy bug, I'm not sure if CurrentHealth is enough. What I'm trying to accomplish is to make a ward bar that overlaps the health bar: As the ward (or wards) gets damaged, its progress bar shrinks. This way the ward is a visual cue, and there's no need for a list of wards with icons and text.

The best I can do is probably make the health bar purple when the target is protected by a ward, and display the sum of wards.
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:48 AM.


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