EQ2Interface

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

TalTal 03-09-2011 09:24 PM

Operators
 
hey guys. A little help if you don't mind.

TCOND = (CurrTopVal '>=' 1)
NCOND = (Parent.WC_Backdrop.BarBack.Height == 20)
HCOND = TCOND && NCOND

This code crashes the ui...all variables are set and paths exist.

Basically I have two things to check. I need to make sure they are both true and then do a third thing.

HCOND = TCOND && NCOND

Remove that line and it does not crash anymore (of course I'm screwed without it lol).

Any tips or ideas?

Thanks,
Silat

gm9 03-09-2011 09:58 PM

If you write that directly into the XML, make sure you encode it properly
HCOND = TCOND && NCOND
If that's not the issue, try encasing the operator in single quotes as well, can't hurt and usually helps.

TalTal 03-09-2011 10:13 PM

Tried the single quotes before I posted but it made no difference. Did not think about using the entities will try it and let you know.

Silat

Edit: that was the ticket. Thanks much!

Drumstix42 03-10-2011 12:13 AM

I don't think you need single quotes on this:
TCOND = (CurrTopVal '>=' 1)

Just:
TCOND = (CurrTopVal >= 1)

And I'd wrap parenthesis around this:
HCOND = (TCOND && NCOND)

EQAditu 03-11-2011 04:55 PM

Using XML entities is a mixed bag. I'm pretty sure you have to use & for an ampersand, but for greater than/less than, you do not use </> -- Just leave them as is, regardless of it being bad XML.

I might as well use real examples of my own code that work successfully: (I don't think I've ever used >= or <=, specifically)
MATCH=MATCHNAME &amp;&amp; MATCHTARGET
FORCERESET=Parent.Progress.Bar.Progress < LastProgress

Drumstix42 03-11-2011 05:00 PM

I've usually just used the UIBuilder since it'll save them out properly, and it's less annoying to look at when editing :rolleyes:

TalTal 03-11-2011 05:34 PM

I appreciate the advice guys. I never have used the ui builder. Tried it once and hated it. I edit everything in dreamweaver and then test by /loadui or relogging.

Silat

gm9 03-11-2011 09:33 PM

Quote:

Originally Posted by EQAditu (Post 96189)
Using XML entities is a mixed bag. I'm pretty sure you have to use &amp; for an ampersand, but for greater than/less than, you do not use &lt;/&gt; -- Just leave them as is, regardless of it being bad XML.

IIRC the entities for <> work fine in formulas, however the parse chokes when you start chaining expressions containing them like we are doing here since at one point it stops interpreting them before trying to resolve the expression. But a simple (1 &lt; 2) ? 'true' : 'false' should work.

EQAditu 03-14-2011 08:22 AM

In general I do not do more than one operation per line and still had trouble using &lt;/&gt; in the past. I don't bother with parenthesis outside of string concatenation which is the only place I'll do more than one operation in a single line. I don't like using quoted strings either as they are too much of a headache. If I need a special/reserved character, I'll put it in an XML attribute and concatenate that.

Mostly, I don't trust the parser too far. :)

Drumstix42 03-14-2011 08:34 AM

I've done multiple string comparison in my UI code in several places. You just need to do the check and the result in a different line (at least far as I remember from testing).
boolCheck=(var1 || var 2 || var3 || var 4)
boolResult=(boolCheck ? true : false)
Like I said above, I save my code through UI builder, so it encodes the characters for me, but it definitely works.
If something is crashing me, I take it line by line until I find the problem. I'll even output variables to a chat channel if I need to go as far as debugging it line by line with feedback.

gm9 03-14-2011 11:34 AM

Quote:

Originally Posted by Drumstix42 (Post 96241)
I've done multiple string comparison in my UI code in several places. You just need to do the check and the result in a different line (at least far as I remember from testing).
boolCheck=(var1 || var 2 || var3 || var 4)
boolResult=(boolCheck ? true : false)

You can do as many similar operations as you want, the above should even work in single line, but as soon as you mix operators you're out of luck. used to be like that anyway.


All times are GMT -5. The time now is 05:55 PM.

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