Thread: Math help
View Single Post
  #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