EQ2Interface.com
Search Downloads


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

Reply
Thread Tools Search this Thread Display Modes
  #1  
Unread 04-08-2005, 04:35 PM
Deathbane27's Avatar
Deathbane27 Deathbane27 is offline
aka Mook
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Jul 2004
Server: Nektulos
Posts: 1,451
Default Working IF statements!

I need to go to work in a few minutes. I leave it to you to do something cool while I'm away.

<Button A="10" B="20" OnPress="Parent.Bool.Visible=(A)<(B)" ...
<Page OnShow="(script)" OnHide="(script)"


Yup, that's how you do IF statements. You set an event-triggering Boolean (aka true/false) property to the true/false value of the statement, and put a script in the object's corresponding event.

Supported operators:

==
<
>



Not supported directly:

!= (Replace with Parent.Bool.Visible=(!(A)==(B))
<= (Replace with Parent.Bool.Visible=(!(A)>(B))
>= (Replace with Parent.Bool.Visible=(!(A)<(B))

(I may be using more parenthesis than I actually need.)

One step closer to world domination!


Attached demonstration Persona window that doesn't do anything useful. And you can see that I stumbled on this while attempting to combine text strings.
Attached Files
File Type: xml eq2ui_mainhud_persona.xml (32.1 KB, 449 views)
__________________
If it ain't broke, it needs more features!

Last edited by Deathbane27 : 04-08-2005 at 04:47 PM.
Reply With Quote
  #2  
Unread 04-08-2005, 04:59 PM
taco-man's Avatar
taco-man taco-man is offline
EQ2MAP Updater Author
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 1,349
Default

omg this is so awesome!!!! sorry i cant help myself
__________________
EQ2MAP Updater Download
EQ2MAP Website
How to Install a custom interface
Reply With Quote
  #3  
Unread 04-08-2005, 05:40 PM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Default

You'll have to explain a bit more with the example, since me finding it on my own would probably take a bit Good find nonetheless if it can be used.
__________________
"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 04-08-2005, 05:42 PM
hirebrand hirebrand is offline
Bellum Aeternus
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Unkown
Posts: 165
Default

So

<Button
A="/GameData.Self.Power"
B="50"
OnPress="Emoter.Bool.Visible=(A)>(B)" }

<Page
Name="Emoter"
OnShow="laugh"
OnHide="cry" }

is the equivalent of

IF GameData.Self.Power > 50
THEN laugh
ELSE cry

?
Reply With Quote
  #5  
Unread 04-08-2005, 06:09 PM
hirebrand hirebrand is offline
Bellum Aeternus
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Unkown
Posts: 165
Default

Guess not. Trying a different way
Reply With Quote
  #6  
Unread 04-08-2005, 06: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
Default

That should prove usefull

Hehe, personally I'd use a button with Activated as the switch.

Hierbrand, other than the flubbed bracket at the end, that should work unless gamedata.self.power returns a string it can't compair to a number.

Last edited by Zonx : 04-08-2005 at 06:24 PM.
Reply With Quote
  #7  
Unread 04-08-2005, 10:10 PM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Default

Hmmm... now to figure out && and || !
__________________
"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
  #8  
Unread 04-08-2005, 10:21 PM
ger's Avatar
ger ger is offline
Steward of the Faithful
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 580
Default

Quote:
Originally Posted by Drumstix42
Hmmm... now to figure out && and || !
Keep in mind that

IF ((A == true) && (B == true)) { DoThis }

is the same as

IF (A == TRUE) { IF (B == true) { DoThis }}

and

IF ((A == true) || (B == true)) { DoThat }

is the same as

IF (A == true) { DoThat }
IF (B == true) { DoThat }

So while it isn't as efficient, we don't need to figure out how to use && and ||.

Edit: while the above would work for IF-THENs, IF-THEN-ELSEs get a bit more complicated. Examples:

For &&:

IF (A == true) { IF (B == true) { DoThis; DoneThis = true }}
IF !(DoneThis == true) { DoTheOther }

For ||:

IF (A == true) { DoThat; DoneThat = true }
IF (B == true) { DoThat; DoneThat = true }
IF !(DoneThat == true) { DoTheOtherOther }

Why do you need the exra flag/test for IF-THEN-ELSEs? The simple answer is that you can't tie it the ELSE to either of the individual IFs or they'll end up triggering when they shouldn't (one IF is false, the other isn't) or they won't trigger when they should (the wrong IF is false.) An example:

IF (A == true) { IF (B == true) { DoThis } ELSE { DoTheOther }}

will only trigger DoTheOther whe B isn't true, not when A isn't true as you'd want an && to.

IF (A == true) { IF (B == true) { DoThis }} ELSE { DoTheOther }

will only trigger DoTheOther when A isn't true, not when B isn't true as you'd want an && to.

IF (A == true) { DoThat } ELSE { DoTheOtherOther }
IF (B == true) { DoThat } ELSE { DoTheOtherOther }

will trigger DoTheOtherOther when either A or B aren't true, when we want it to trigger only if both A and B aren't true.

An alternate to flagging for &&:

IF (A == true) { IF (B == true) { DoThis } ELSE { DoTheOther}} ELSE { DoTheOther }

still not as efficient as a && would be, but it, too, will work.

(Please note that all of this is pseudo-code and would need to be massaged into several different chained objects to be used in an actual UI XML.)
__________________

Last edited by ger : 04-08-2005 at 10:58 PM.
Reply With Quote
  #9  
Unread 04-08-2005, 11:09 PM
ger's Avatar
ger ger is offline
Steward of the Faithful
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 580
Default

Just had a scary thought. It may be possible to create working WHILE loops using this technique. For instance:

<Button Name="Start" OnPress="Parent.Loop.Looping=true Parent.Loop.Press=true"></Button>
<Button Name="Stop" OnPress="Parent.Loop.Looping=false"></Button>
<Button Looping="false" Name="Loop" OnPress="DoStuff Press=Looping" Visible="false"></Button>

FOR loops would work in a similar fashion, except it'd be something like:

<Button Name="Start" OnPress="Parent.Loop.Looping=true Parent.Loop.Press=true"></Button>
<Button Looping="false" Name="Loop" OnPress="DoStuff Looping=(TestArgument < TestCondition) Press=Looping" Visible="false"></Button>

Oh, the implications of it all!
__________________
Reply With Quote
  #10  
Unread 04-08-2005, 11:11 PM
Quib Quib is offline
A Griffon
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Jan 2005
Posts: 720
Default

If we can get while loops working, and if they cause no slowdown during an infinite loop, they could be used to cause active operations occur with the UI. Like a tooltip constantly updated with some odd data that we specify, or hotkey labels that are constantly kept updated rather than OnHoverIn/Out.

Quib

Last edited by Quib : 04-08-2005 at 11:14 PM.
Reply With Quote
  #11  
Unread 04-08-2005, 11:14 PM
ger's Avatar
ger ger is offline
Steward of the Faithful
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 580
Default

Quote:
Originally Posted by Quib
If we can get while loops working, and if they cause no slowdown during an infinite loop, they could be used to cause active operations occur with the UI. Like a tooltip constantly updated with some odd data that we specify, of hotkey labels that are constantly kept updated rather than OnHoverIn/Out.

Quib
{Emphasis added}

Why do I have the feeling we're about to bring every EQ2 server to is knees? Or maybe just the client machines.
__________________
Reply With Quote
  #12  
Unread 04-08-2005, 11:25 PM
ger's Avatar
ger ger is offline
Steward of the Faithful
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 580
Default

So much for that theory. I just tried the following:

Code:
<Page AbsorbsInput="false" Location="8,62" Name="SpellsPage" OnShow="Loop.Press=true" ScrollExtent="570,367" Size="570,367">
<Button Name="Loop" OnPress="Entry0.Name.Text=Entry0.Icon.Tooltip
    Entry1.Name.Text=Entry1.Icon.Tooltip
    Entry2.Name.Text=Entry2.Icon.Tooltip
    Entry3.Name.Text=Entry3.Icon.Tooltip
    Entry4.Name.Text=Entry4.Icon.Tooltip
    Entry5.Name.Text=Entry5.Icon.Tooltip
    Entry6.Name.Text=Entry6.Icon.Tooltip
    Entry7.Name.Text=Entry7.Icon.Tooltip
    Entry8.Name.Text=Entry8.Icon.Tooltip
    Entry9.Name.Text=Entry9.Icon.Tooltip
    Entry10.Name.Text=Entry10.Icon.Tooltip
    Entry11.Name.Text=Entry11.Icon.Tooltip
    Entry12.Name.Text=Entry12.Icon.Tooltip
    Entry13.Name.Text=Entry13.Icon.Tooltip
    Entry14.Name.Text=Entry14.Icon.Tooltip
    Entry15.Name.Text=Entry15.Icon.Tooltip
    Press=Parent.Visible" ScrollExtent="1,1" Size="1,1" Visible="false"></Button>
{Other usual spell page stuff}
</Page>
The second I clicked the 'Spells' tab in my Knowledge window my game froze. About 15 seconds later it crashed silently to the desktop. So it seems we'll neither bring the servers nor the client machines to their knees, just the client application.
__________________
Reply With Quote
  #13  
Unread 04-08-2005, 11:27 PM
Quib Quib is offline
A Griffon
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Jan 2005
Posts: 720
Default

Hehehe, oh well. I was hoping it wouldn't do a true loop and would only run the OnEvent once per frame.

Quib
Reply With Quote
  #14  
Unread 04-09-2005, 01:17 AM
Deathbane27's Avatar
Deathbane27 Deathbane27 is offline
aka Mook
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Jul 2004
Server: Nektulos
Posts: 1,451
Default

Quote:
Originally Posted by hirebrand
So

<Button
A="/GameData.Self.Power"
B="50"
OnPress="Emoter.Bool.Visible=(A)>(B)" }

<Page
Name="Emoter"
OnShow="laugh"
OnHide="cry" }

is the equivalent of

IF GameData.Self.Power > 50
THEN laugh
ELSE cry

?

You can't set a property to DynamicData. Here's how you'd do that:

<Progressbar Name="Power" DynamicData="/Gamedata.Self.Power"...
<Button OnPress="Parent.Trigger.Activated=(Parent.Power.Progress)>0.500"...
<Button name="Trigger" OnActivate="laugh" OnDeActivate="cry"...


Of course you'd actually have to have TWO triggers, one for activate, one for deactivate, because the OnActivate doesn't trigger if it's already activated, etc. But that's relatively minor.




More brainstorming:

Had someone request for a on-screen visual or sound when you are under attack. Best I could do was make it so when anything near you was attacked it brought up a window.

Now we can have that window check to see if your health is less than 100%, and if it is, make trigger some flashing and noise.
__________________
If it ain't broke, it needs more features!
Reply With Quote
  #15  
Unread 04-09-2005, 01:23 AM
ger's Avatar
ger ger is offline
Steward of the Faithful
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 580
Default

Quote:
Originally Posted by Deathbane27
More brainstorming:

Had someone request for a on-screen visual or sound when you are under attack. Best I could do was make it so when anything near you was attacked it brought up a window.

Now we can have that window check to see if your health is less than 100%, and if it is, make trigger some flashing and noise.
Often times when I'm first attacked the attack misses or is resisted. In cases such as these a health<100% check would return false even though I really am under attack. But it's a good start.
__________________
Reply With Quote
  #16  
Unread 04-10-2005, 08:40 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
Default

Text comparisons work!
(fubar)==(fubar)
returns true

If parent.text='fubar'
(parent.text)==(fubar)
is true

Simpler notation
parent.text=='fubar'


AND
(test1)&(test2) returns true if both tests are true
parent.text=='fubar'&1==1
is true
parent.text=='fubar'&1==2
is false

Bitwise
&! and !& appear to do the same as &.

OR and XOR
| and || seam to result in the second test being ignored. Resturns value of the first test. Same for ^

Last edited by Zonx : 04-11-2005 at 07:12 AM.
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 08:27 AM.


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