View Single Post
  #4  
Unread 06-07-2009, 07:02 PM
EQAditu's Avatar
EQAditu EQAditu is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Permafrost
Posts: 256
Default

Sure they can be declared. When you write something in UI scripting, it first checks to see if it was a valid variable. It also considers the XML attributes of that node as variable names. In my above example, I use Prog and ProgColor as variables. ProgColor I actually assign a value to in scripting and Prog I assume has a value. If EQ2 can't find an assigned variable(or XML attribute) of that name, it treats it as a string. It also likes to treat things as arithmetic when possible.

Conversely you can assign XML attributes values in scripting as if they were internal variables.

Lemme just throw some of the things you want to do together in a simple way instead of speaking abstractly.
Code:
<Progressbar Color="#FF0000" DynamicData="/GameData.Group.Group_1.HealthPercent" Name="HealthBar" Progress="1.000" />
<Text DynamicData="/GameData.Group.Group_1.HealthPercent" Name="Percent" OnTextChanged="
ProgColor=#FF0000
ISGREATER=Parent.HealthBar.Progress > 0.5
ProgColor=ISGREATER ? #FFFF00 : ProgColor
ISGREATER=Parent.HealthBar.Progress > 0.9
ProgColor=ISGREATER ? #00FF00 : ProgColor
Parent.HealthBar.Color=ProgColor" />
You have the health bar and the health text percentage of group member 1. Obviously they belong nested inside of some other stuff in the group window. When the text changes from say, 100% to 80%, the OnTextChanged event should be raised and the script checks the progress bar's values against my two simple checks. It starts red, evaluates as true on the next line(turning it yellow) and evaluates as false on the next line(keeping it what it was). The last line of the script set's the progress bar's color to the result obtained in the short script. If you were going to do this 5-6 times for a group window or 24 times for a raid window there are definitely more elegant ways to code it at least to the point of a smaller file size.

Last edited by EQAditu : 06-08-2009 at 12:17 AM.
Reply With Quote