EQ2Interface.com
Search Downloads


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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Unread 06-07-2009, 01:49 PM
oleega oleega is offline
A Brown Bear
 
Join Date: Apr 2006
Server: Blackburrow
Posts: 11
Default Need Help with Health bar modifcation

Is there a way to change the colors of a health bar so that it turns yellow, orange red sooner than it does now? If there is an easy way to do that, can someone post an example? Thank you so much.
Reply With Quote
  #2  
Unread 06-07-2009, 02:15 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

Assuming there's an appropriate event trigger for ProgressBars(I don't know where there is an up-to-date list). Maybe use the OnTextChanged event for a health label instead.

Anyhow, I expect you'd have to disable EQ2's option to change the color at all so that it remains red. It's an actual game option, but probably a scriptable slash command as well. I'd hope that once it stays red that EQ2's hardcoding doesn't reset it to red on every change or you'll have difficulty.

Depending on which event you handle you'll either have a progress of 0.000 to 1.000 or a text of 0 to 100. You'll have to create a script to compare the current values to the steppings that you want. If you want smoother color transitions, you'll have to add more comparisons.

Sorta like:
Code removed
At the end, you'll end up with a color of red, yellow or green as ProgColor depending on the value of Prog, which you'll have to replace with the actual ProgressBar value or whatever. If you end up using the 1-100, you'll obviously have to use integers not decimals.

So as a short answer, it's not "easy" but not "hard" either. You'd have to calculate your own color transitions and hope EQ2 doesn't override you.

Last edited by EQAditu : 06-08-2009 at 12:17 AM. Reason: Bad code =P
Reply With Quote
  #3  
Unread 06-07-2009, 05:11 PM
oleega oleega is offline
A Brown Bear
 
Join Date: Apr 2006
Server: Blackburrow
Posts: 11
Default

Thank you for your reply. I am not sure how to implement this however - can variables be declared in the xml? I have not found a sample of that and I have been looking through these posts for hours lol.
Reply With Quote
  #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
  #5  
Unread 06-07-2009, 11:24 PM
oleega oleega is offline
A Brown Bear
 
Join Date: Apr 2006
Server: Blackburrow
Posts: 11
Default

I think I understand the idea behind your example. I tried changing the health bar, that did not work, so I tried to change the color in a power bar. The following code snippet does not work. The original color of the progress bar remains. Am I missing something?
Code:
<Page DynamicData="/GameData.Self.Power"  DynamicDataFilter="0001" Location="5,5" Name="PowerBar" PackSize="absolute,fixed" ScrollExtent="200,30" Size="200,30" Visible="true">
        <Image AbsorbsInput="false" Name="Bkg" ScrollExtent="50,30" Size="50,30" SourceRect="317,275,366,296" SourceResource="/images/window_elements_hr.dds" />
        <Image AbsorbsInput="false" Location="50,0" Name="ProgressBkg" PackSize="absolute,fixed" ScrollExtent="150,30" Size="150,30" SourceRect="395,276,487,300" SourceResource="/images/window_elements_hr.dds" />
        <Progressbar AbsorbsInput="false" BackgroundColor="#000000"  Color="#FFFFFF" DynamicData="/GameData.Self.Power" Location="54,3" Name="Bar" PackSize="absolute,fixed" Progress="0.500" ScrollExtent="141,24" Size="141,24" Style="progressBar" />
        <Page AbsorbsInput="false" BackgroundOpacity="1.000" Location="54,2" Name="Frame" PackSize="absolute,fixed" ScrollExtent="141,26" Size="141,26" />
        <Text DynamicData="/GameData.Self.Power"  Name="Percent" OnTextChanged="
		ProgColor=#FF0000
		BlueColor=#0000CD
		PinkColor=#FF1493
		PurpleColor=#8A2BE2
		YellowColor=#FFFF00
		OrangeColor=#D2691E
		ProgColor=Parent.Bar.Progress > .30 ? OrangeColor : ProgColor
		ProgColor=Parent.Bar.Progress > .40 ? YellowColor : ProgColor
		ProgColor=Parent.Bar.Progress > 0.45 ? BlueColor : ProgColor
		ProgColor=Parent.Bar.Progress > 0.55 ? PinkColor : ProgColor
                ProgColor=Parent.Bar.Progress > 0.62 ? PurpleColor : ProgColor
                Parent.Bar.Color=ProgColor"/>
		
    </Page>
Reply With Quote
  #6  
Unread 06-08-2009, 12:16 AM
EQAditu's Avatar
EQAditu EQAditu is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Permafrost
Posts: 256
Default

Apparently I wasn't thinking when I was writing out that code. You can't have the UI scripting evaluate a boolean condition in the same line that it is using it. I apologize and I'll fix my previous code.
Reply With Quote
Reply



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 07:38 AM.


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