EQ2Interface.com
Search Downloads


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

Reply
Thread Tools Search this Thread Display Modes
  #1  
Unread 01-12-2006, 03:39 PM
Erahain Erahain is offline
A Crazed Gnoll
 
Join Date: Jan 2006
Server: Antonia Bayle
Posts: 23
Default Operators and conditionals

My second post about this; but this time in a new
thread =P

-

I don't know if this has already been discovered, but I'm
posting it in case of...

While doing some research, I stumbled across the ##
operator. It is used to concatenate strings. However, there
are a few syntax rules that must be followed.

Look at the example below:

Code:
<Button LocalText="Happy" A="Very" B="Happy"
OnPress="LocalText=A ## ' ' ## B"/>
Keep in mind; always space between the property/value
and the ##, unless you put it in a block (...).

This does NOT work:

Code:
<Button LocalText="Happy" A="Very" B="Happy"
OnPress="LocalText=A##' '##B"/>
... but this does...

Code:
<Button LocalText="Happy" A="Very" B="Happy"
OnPress="LocalText=(A)##(' ')##(B)"/>
Reply With Quote
  #2  
Unread 01-12-2006, 07:39 PM
mother9987's Avatar
mother9987 mother9987 is offline
A Griffon
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Dec 2004
Server: Everfrost
Posts: 204
Default

Wow, I love you man... and in the most macho possible way.

Now, if only I could remember what I wanted Concatenate for. There's been so many things and I've just found ways to work around it. But there might be a few things I could still use it for...

Edit: Here's a use for it that I could never get around... Albiet not an earth-shattering use. Mother's Mail now with mail forward button! (Might still be pending approval)
__________________
'Tetht the printhiple, tetht the printhiple,' muttered Igor. 'Thorry, thur, but Igorth do not "tetht the printhiple". Thtrap it to the bench and put a good thick bolt of lightning through it, thatth our motto. Thatth how you tetht thomething.'

Last edited by mother9987 : 01-12-2006 at 08:31 PM. Reason: Insert Link
Reply With Quote
  #3  
Unread 01-12-2006, 08:34 PM
depechenode's Avatar
depechenode depechenode is offline
A Griffon
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Toxxulia
Posts: 584
Default Omg!!!

If this does what it says, I can get my grp window mod a GREAT BIG FACE LIFT!!! THANK YOU!!!!!!!
Reply With Quote
  #4  
Unread 01-13-2006, 06:13 AM
Erahain Erahain is offline
A Crazed Gnoll
 
Join Date: Jan 2006
Server: Antonia Bayle
Posts: 23
Default

Well I'm sure a lot of people will find it usefull =)
Reply With Quote
  #5  
Unread 01-14-2006, 02:36 AM
SOE_Bobble SOE_Bobble is offline
EQII Developer
Yes this person is from Daybreak!
 
Join Date: Aug 2004
Posts: 82
Default

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
Reply With Quote
  #6  
Unread 01-14-2006, 07:26 AM
Erahain Erahain is offline
A Crazed Gnoll
 
Join Date: Jan 2006
Server: Antonia Bayle
Posts: 23
Default

The comparison operators works as they should, but there are a few rules
to this as well.

<=, >=, < and >
The values on either side will be converted to numbers (temporary during
the comparison). If any of the values cannot be converted (i.e. a text or
a poorly formated number) it will become 0.

Example ('a' < 1) is true as 'a' is equal to 0.

Please note that == and != is purely string conversations; this means that
0 == 00 is false, 'a' == 0 is false and 1 == 1 is true.

Good programming practice is to enclose the comparison operators in ''s, as
this is a requirement in order to use <= and >=.
I.e.: a '<=' 1

The above rules that applies for ## is applied here as well.

Another good one is that && and || should have their left and right sides
contained within blocks. But that's ofcourse up to the modder =)

Also remember, no ( ) blocks, or comparisons, at the left side of the &&
or || operators. *UPDATED*

(1 == 1) && (2 == 2)
IS NOT VALID

A note about XML:
Since the &-character is special in XML, doing '&&' will probably just hang
your client. Instead, replace '&&' with '&amp;&amp;'
This should do the trick!

Now to the conditional operators '?' and ':';
Each side on both of the operators must contain real values (or variables),
no special characters, operators or blocks.

(1 == 1) ? yes : no
The above example will not work, as left side of ? contains a block.

So how do we compare? Simple workaround.

Code:
COND ? yes : no COND = (1 == 1)
------------
A side note:

The UI scripting engine interprets the text from top to bottom, and from
right to left; examples below:

COND is set first, then LocalText:
Code:
COND=1
LocalText=COND
Same here, COND is set.. then LocalText:
Code:
LocalText=COND COND=1
------------
Assign (1 == 1) to COND, and use COND as the condition for ? :

And if we want to have some more complicated things to do, we'll
have to put them outside of the condition segment...

Code:
COND = MyGender == male
BROTHER = 'Welcome brother ' ## MyName 
SISTER = 'Welcome sister ' ## MyName
LocalText = COND ? BROTHER : SISTER
Please note this:

If the condition is TRUE - no further text can be appended to the resulting
value, but this doesn't prevent processing through.

Code:
LocalText = (X ? 'Cool' : 'Very' ) ## ' funny'
The above is a good example of this; if X is TRUE, LocalText will be set
to 'Cool' .. ignoring the text after the ( ? : ) block.

If X is FALSE, LocalText becomes 'Very' and ' funny' is appended to the
string.

-

If you have any more questions, please ask =)

Daniel

Last edited by Erahain : 01-14-2006 at 09:17 PM. Reason: additions..
Reply With Quote
  #7  
Unread 01-14-2006, 12:59 PM
Landiin Landiin is offline
Slayer of clock cycles
This person is a EQ2Map developer.
Featured
 
Join Date: Nov 2004
Server: Oasis
Posts: 3,464
Send a message via ICQ to Landiin Send a message via AIM to Landiin Send a message via MSN to Landiin Send a message via Yahoo to Landiin
Default

Dude you rock.. I tried a couple of time to get the conditional to work but gave up, I never once thought to put the condition into a variable
__________________
Landiin's EQ2MAP Updater Discussion Download
Reply With Quote
  #8  
Unread 01-14-2006, 04:10 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

I hereby dub thee... SIR Erahain, Knight of the Script Functions, Duke of the Operators, and my successor.
__________________
If it ain't broke, it needs more features!
Reply With Quote
  #9  
Unread 01-14-2006, 04:22 PM
Erahain Erahain is offline
A Crazed Gnoll
 
Join Date: Jan 2006
Server: Antonia Bayle
Posts: 23
Default

Thank yee
Reply With Quote
  #10  
Unread 01-14-2006, 04:27 PM
Dolby's Avatar
Dolby Dolby is offline
Bacon Eater
Premium Member
EQ2Interface Admin
This person is a EQ2Map developer.
 
Join Date: Feb 2004
Posts: 2,452
Default

Great find Erahain! I cant wait to see what interface authors make with this.

Stickied this thread to the top.

Last edited by Dolby : 01-14-2006 at 04:32 PM.
Reply With Quote
  #11  
Unread 02-25-2006, 04:30 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
Send a message via Yahoo to Zonx
Default

1 minor correction on comparisons...

Text is not converted to 0 if both sides of the comparison are text. I've been using text comparisons against sub-class name to derive Market window menu selections for a while now.

Some of this stuff was experimented with and dicussed in this thread

I suspect the cat opperator was added shortly after that discussion and passed on to us in the semi-recent UIBuilder update. I did discuss this with one of Bobble's colleges around that time.
Reply With Quote
  #12  
Unread 07-21-2006, 12:34 PM
Erahain Erahain is offline
A Crazed Gnoll
 
Join Date: Jan 2006
Server: Antonia Bayle
Posts: 23
Default

Are you sure you are not only talking about the == and != operators
now? They are purely for string comparison if i remember correctly.
I.e. its never converted to numbers.

The operators I suggested converted string to numbers were
>= <= > and <.

This was explained in an earlier post.

It might even be possibe that a string is converted to strlen(string);
thus the length of the string in numbers.

Maybe we should try making a length comparison:
COND1 = 'helloo' > 5
... should in theory return true.

I've not been playing with this for a while.
But I'm gonna do that now.
Reply With Quote
  #13  
Unread 04-21-2007, 12:42 AM
Othesus's Avatar
Othesus Othesus is offline
A Griffon
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Lucan DLere
Posts: 847
Default

Has anyone really gotten a conditional to work or have any actual working examples? I've been trying to use one and it never does anything.

COND ? case1

gives me case1 regardless of what COND is.

COND ? case1 : case2

gives me case2 regardless of what COND is.
Reply With Quote
  #14  
Unread 04-21-2007, 07:07 AM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

Conditionals are great, same as the operators - they allow you to do at least some minimal processing in the code. I use them in several windows. See below for a combination of conditionals and concactenation from my automatic per-character mail signature function:

SignatureLocation=&apos;Parent.&apos; ## Parent.Selfname.LocalText ## &apos;.Signature&apos;
Parent.RetrieveSignature.OnPress=&apos;Parent.AddSignature.SignatureText=&apos; ## (SignatureLocation)
Parent.RetrieveSignature.Press=True
COND=SignatureText == SignatureLocation
Parent.Parent.Body.Text=Parent.Parent.Body.LocalText ## COND ? Parent.Default.Signature : SignatureText


If you want to see heavy use of conditionals, take a look at Mother's timer window, that one is a beast, possibly the most impressive (or excessive? ) example of what you can do with the XML operators that I have seen on here (although Talyns
has excellent examples as well, search for his kills before level up XP window on the forums, for example).

Not sure what may be wrong with your code, maybe the condition isn't set up correctly.
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
  #15  
Unread 04-21-2007, 07:15 AM
Othesus's Avatar
Othesus Othesus is offline
A Griffon
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Lucan DLere
Posts: 847
Default

Thanks, I actually ended up having to backtrack a few hours and use a different approach. The primary browser object has to be at the first level of the browser window for the homepage or /browser <URL> to work. I was trying to leave that primary browser object there as a dummy and then copy the URI text into different tabs but I ran into a time delay problem anyway so I went back to an earlier design idea.
Reply With Quote
  #16  
Unread 04-22-2007, 06:33 PM
Landiin Landiin is offline
Slayer of clock cycles
This person is a EQ2Map developer.
Featured
 
Join Date: Nov 2004
Server: Oasis
Posts: 3,464
Send a message via ICQ to Landiin Send a message via AIM to Landiin Send a message via MSN to Landiin Send a message via Yahoo to Landiin
Default

Quote:
Originally Posted by Othesus View Post
Has anyone really gotten a conditional to work or have any actual working examples? I've been trying to use one and it never does anything.

COND ? case1

gives me case1 regardless of what COND is.

COND ? case1 : case2

gives me case2 regardless of what COND is.
Works

COND=1>2
Visible=(COND?True:False)

Visible=(COND?True:False) COND=1>2

(remember EQ2 exec it's script right to left, top to bottom)

Does not work

Visible=(1>2?True:False)

Here is a snip of the code I use to show class icons in the group window
Code:
<Button eX_Test="false" LocalText="eXtremeClass" Name="ClassControler" OnActivate="
Parent.Paladin.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Paladin)
Parent.Shadowknight.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Shadowknight)
Parent.Berserker.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Berserker)
Parent.Guardian.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Guardian)
Parent.Bruiser.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Bruiser)
Parent.Monk.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Monk)
Parent.Swashbuckler.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Swashbuckler)
Parent.Brigand.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Brigand)
Parent.Dirge.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Dirge)
Parent.Troubador.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Troubador)
Parent.Ranger.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Ranger)
Parent.Assassin.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Assassin)
Parent.Wizard.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Wizard)
Parent.Warlock.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Warlock)
Parent.Illusionist.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Illusionist)
Parent.Coercer.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Coercer)
Parent.Necromancer.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Necromancer)
Parent.Conjuror.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Conjuror)
Parent.Templar.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Templar)
Parent.Inquisitor.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Inquisitor)
Parent.Warden.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Warden)
Parent.Fury.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Fury)
Parent.Mystic.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Mystic)
Parent.Defiler.Visible=(eX_Test ? True : False) eX_Test=(Parent.Class.LocalText==Defiler)
Activated=False">eXtremeClass</Button>
__________________
Landiin's EQ2MAP Updater Discussion Download
Reply With Quote
  #17  
Unread 04-27-2007, 01:40 PM
Syndic Syndic is offline
A Young Mystail Rat
 
Join Date: Dec 2004
Server: Antonia Bayle
Posts: 7
Default

OK sometimes things like this fly right over my head.

I recently returned to EQ2. I found that the /Gamedata.Self.LevelClass has been changed to include the word "Level" at the beginning of it. Now it doesn't fit in the areas I have for it. After finding this thread I thought there might be hope in creating a single text which concats Level + Class together to get the old result again (ie "55 Shadowknight" instead of "Level 55 Shadowknight"), just the examples above seem to concentrate more on conditions than concatenation.

I just can't figure out how or if it is possible to use 2 Gamadatas in one field. I know I could go along and create 2 Texts but the spacing would out. I also tried looking at several UI's to see if anyone has done this but have yet to stumble across it.
Reply With Quote
  #18  
Unread 04-27-2007, 02:38 PM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

You cannot assign two Gamedatas, assign each to a different invisble text field like charlvl and charclass, then have a third text field that you want to display and populate it via an OnShow event like this: Text=charlvl.LocalText ## charclass.LocalText
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
  #19  
Unread 04-27-2007, 03:46 PM
Talyns's Avatar
Talyns Talyns is offline
A Griffon
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Jul 2004
Server: Everfrost
Posts: 604
Send a message via ICQ to Talyns
Default

Quote:
Originally Posted by gm9 View Post
You cannot assign two Gamedatas, assign each to a different invisble text field like charlvl and charclass, then have a third text field that you want to display and populate it via an OnShow event like this: Text=charlvl.LocalText ## charclass.LocalText
you would probably want a space in there too so

Text=charlvl.LocalText ## (' ') ## charclass.LocalText
__________________
Talyns
Reply With Quote
  #20  
Unread 04-27-2007, 10:23 PM
Syndic Syndic is offline
A Young Mystail Rat
 
Join Date: Dec 2004
Server: Antonia Bayle
Posts: 7
Default

Thanks I'll give that a shot.
Reply With Quote
  #21  
Unread 04-29-2007, 09:47 AM
Syndic Syndic is offline
A Young Mystail Rat
 
Join Date: Dec 2004
Server: Antonia Bayle
Posts: 7
Default

OK there is certainly something I'm missing here.

The 3 texts I've listed below, I only seem to be getting the words "Not working" to appear. Anyone able to spot the stupid mistake I'm making?

This is inside the player window btw.
Code:
<Text Visible="False" DynamicData="/GameData.Self.Level" Font="/Fonts.FontZapf15" LocalText="70" Margin="0,0,5,0" Name="advLevel" ScrollExtent="120,15" ShadowStyle="/ShadowStyles.Outline1" Size="120,15" TextAlignment="Right" TextAlignmentVertical="Center" TextColor="#F0D090">70</Text>
<Text Visible="False" DynamicData="/GameData.Self.SubClass" Font="/Fonts.FontZapf15" LocalText="Shadowknight" Margin="0,0,5,0" Name="advClass" ScrollExtent="120,15" ShadowStyle="/ShadowStyles.Outline1" Size="120,15" TextAlignment="Right" TextAlignmentVertical="Center" TextColor="#F0D090">Shadowknight</Text>
<Text AbsorbsInput="false" Font="/Fonts.FontZapf15" LocalText="50 Shadowknight"  OnShow="Text=advLevel.LocalText ## (' ') ## advClass.LocalText" Margin="0,0,5,0" Name="advLevelClass" ScrollExtent="130,15" ShadowStyle="/ShadowStyles.Outline1" Size="130,15" TextAlignment="Right" TextAlignmentVertical="Center" TextColor="#F0D090">Not working</Text>
Reply With Quote
  #22  
Unread 04-29-2007, 08:35 PM
Othesus's Avatar
Othesus Othesus is offline
A Griffon
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Lucan DLere
Posts: 847
Default

I didn't test it but try this:

OnShow="Text=advLevel.LocalText ## (' ') ## advClass.LocalText"

change to

OnShow="Text=Parent.advLevel.LocalText ## (' ') ## Parent.advClass.LocalText"
Reply With Quote
  #23  
Unread 04-30-2007, 07:19 AM
Syndic Syndic is offline
A Young Mystail Rat
 
Join Date: Dec 2004
Server: Antonia Bayle
Posts: 7
Default

Yep did that Othesus, didn't seem to make any difference.

If anyone knows of a mod that actually does this, I could even go there and see what I did wrong.
Reply With Quote
  #24  
Unread 04-30-2007, 07:43 AM
gm9 gm9 is offline
gm10-1
Premium Member
EQ2Interface Super Mod
Featured
 
Join Date: Feb 2006
Posts: 6,479
Default

If it does show your "Not working" all the time that means that your OnShow event is not getting triggered. Try putting your code in the topmost <page> of your window, or if you never hide that window, put it in another window that receives OnShow events. Of course you can also just change it to a OnHoverIn= event or something like that.
__________________
P R O F I T U I ∙ R E B O R N [Auto-Updater] | [Portal] | [F.A.Q.] | [Support Forums]
~ Retired ~
If it does not work, you likely installed it incorrectly. Always try a clean install before reporting bugs.
Reply With Quote
  #25  
Unread 04-30-2007, 09:28 AM
Othesus's Avatar
Othesus Othesus is offline
A Griffon
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Mar 2005
Server: Lucan DLere
Posts: 847
Default

Are you testing the script in the UIBuilder? You can trigger any OnShow script by clicking the eyeball.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:38 PM.


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