EQ2Interface

EQ2Interface (https://www.eq2interface.com/forums/index.php)
-   XML Modification Help & Info (https://www.eq2interface.com/forums/forumdisplay.php?f=22)
-   -   Operators and conditionals (https://www.eq2interface.com/forums/showthread.php?t=5406)

Othesus 05-26-2007 12:06 AM

Just a note about the syntax for the ! (negation) operator. It has to be enclosed in single quotes, like:

Parent.ShineyTestButton.Activated='!'Parent.Info.Visible

Genen 11-23-2008 11:42 AM

Can I run counters?

Example:

I have a label displayed on a window. Let's call it 'TotalLabel'

If TotalLabel.Localtext is '0', then I will see a '0' on the window.

How do I increment that by 1?

Does "Parent.TotalLabel.Localtext=Parent.TotalLabel.Localtext + 1" work?

Any existing windows out there I can look at for examples?

gm9 11-23-2008 12:38 PM

Yes. Also see here.

samejima 01-08-2009 06:54 AM

HOW IN GODS NAME DO YOU GET A WORKING AND OR STATEMENT :( I give up! :confused::confused::confused::confused::(:(:(:(

gm9 01-08-2009 07:02 AM

As far as I found you can only ever do one operation at the same time, so you can't do any kind of nested statements including two comparisons. At least I gave up trying as well. So you need to do two separate comparisons.

samejima 01-08-2009 07:06 AM

Quote:

Originally Posted by SOE_Bobble (Post 39464)
Nicely done.

I have access to the code and didn't even know this existed. So I went into the UIScriptEngine code tonight but didn't find any other secrets treasures.

Operators:
= - assignment
== != - comparison
< <= - less than
> >= - greater than
&& || - AND OR
! - negative
+ - * / - math
## - concat
?: - conditional
$ - assignment. calls "/<lhs> <rhs>"


Did anyone ever figure out the syntax for the conditional operator? If not, the spacing rules and () syntax of ## might be a clue.

Bobble

So that doesn't exist or just not working properly? I just want to do if x= y || z

gm9 01-08-2009 07:21 AM

Oh no that works fine. Example:
y=(a == 10)
z=(a == 5)
COND=y || z
x=COND ? true : false
Will be true for values of a = 5 or 10 and false for anything else.

samejima 01-08-2009 07:25 AM

OK I was trying to do stuff like

Cond= a==10 || a==5

with that being said would this be a valid statment


y=(a == 10)
z=(a == 5)
x=(COND ? true : false) COND=y || z

And this?
x=(COND ? true : false) COND=y || z y=(a == 10) z=(a == 5)

trying to keep it all on one line for a change instead of pressing return 1000x

gm9 01-08-2009 07:35 AM

Quote:

Originally Posted by samejima (Post 79549)
OK I was trying to do stuff like

Cond= a==10 || a==5

That's basically what I tried to express above (and what should be mentioned earlier in this thread), you can't combine different operations (here == and ||), the parser doesn't pick it up correctly, you need to put them in separate statements that you reference via variables. You can combine similar operations though, so COND = a || b || c || d works.

Quote:

Originally Posted by samejima (Post 79549)
with that being said would this be a valid statment


y=(a == 10)
z=(a == 5)
x=(COND ? true : false) COND=y || z

And this?
x=(COND ? true : false) COND=y || z y=(a == 10) z=(a == 5)

trying to keep it all on one line for a change instead of pressing return 1000x

I find it easier to read with linebreaks but both ways work, it's purely cosmetic. :)

samejima 01-08-2009 07:37 AM

All my code is normally done with line breaks but for this I just want to keep it on one line, plus I was just curious after trying for so long!!! thanks for the help.

Regn 04-30-2019 10:03 AM

I hope it's ok that I add code examples that I've made work. If you know something I don't in terms of having to be careful with /GameData.General.Time let me know.

Concatenation

Code purpose:
To concatenate the AA Experience string with square brackets, allowing e.g. AA Experience to be displayed in square brackets next to AA Points like so: "173 [43.5%]".

Code example:
Code:

<?xml version="1.0" encoding="utf-8"?>

<Page Name="Main">
 
  <Text Name="AAXPValue" DynamicData="/GameData.Achievement.ExperienceCurrent" />
  <Text Name="Init" DynamicData="/GameData.General.Time" DynamicDataFilter="FFFE" OnTextChanged="Parent.DisplayArea.AAXPDisplay.Text=('[') ## Parent.AAXPValue.LocalText ## (']')" />
 
  <Page Name="DisplayArea">
    <Text Name="AAXPDisplay" LocalText="N/A" />
  </Page>
 
</Page>

Code output:
Code:

[100%]
Code explanation:
  • AAXPValue contains the DynamicData string that we want to concat.
  • Init is an idea that I've borrowed from one of Drums xml files, and edited for a simpler purpose.
  • Init uses the DynamicData called GameData.General.Time for the sole purposes of triggering OnTextChanged, which then makes our desired change to AAXPDisplay.

Code note:
  • You will have to add the required Page and Text properties to Main, DisplayArea, and AAXPDisplay. I removed these properties for the purpose of keeping the code easy to read and understand.
  • Don't swap out the square brackets with parenthesis. Your EQ2 client will crash if you try to run it with parenthesis.
  • AA Points were not added in the code example to avoid confusion.

Drumstix42 05-05-2019 07:31 PM

Pretty interesting that concatenating parenthesis in a string causes the game to crash, LOL. There might be a work around using like an ascii/unicode version of parenthesis instead, but not sure :)


All times are GMT -5. The time now is 05:18 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI