EQ2Interface

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

Drumstix42 11-28-2007 03:09 AM

Variable question
 
Is it possible to use a variable inside of a location string?

ie:
Code:

Parent.Parent.(OBJECT).visible=true  OBJECT=name
Where OBJECT=name is getting the name of the current, say, button. And activating a page with the same name, in a different part of the XML tree.

So far I've managed to crash the UIBuilder, or have nothing happen :)

*edit*
My workaround for now, which works fine, is to just use a slightly different method. Original Info Center uses a slew of buttons that each hide every related page, and then unhide the appropriate one. This is just way too many lines of script.
So, I decided to just make a hidden button that does this same thing, which when activated hides all the pages, then deactivates itself. This way, all buttons only need to set a variable with the correct name, and then activate the hidden button.

ShadowProwler420 11-28-2007 11:01 AM

Anything is 'possible' if you put your mind to it, Drum! ;)

Talyns 11-28-2007 01:08 PM

1 Attachment(s)
Quote:

Originally Posted by Drumstix42 (Post 67119)
Is it possible to use a variable inside of a location string?



Here's an example where a visible page gets hidden when another page is shown.. I'm not sure if thats what you're trying to accomplish but I'm pretty sure this is what you're looking for:

Code:

<?xml version="1.0" encoding="utf-8"?>
<Page Name="PageContainer" Visible="true">

<Button Name="HideActivePage" OnActivate="Activated=false" Visible="false"></Button>

<Page Name="Page1" OnShow="Parent.HideActivePage.activated=true
Parent.HideActivePage.onactivate=(&apos;Parent.&apos;)##(name)##(&apos;.visible=false Activated=false&apos;)" Visible="false"/>

<Page Name="Page2" OnShow="Parent.HideActivePage.activated=true
Parent.HideActivePage.onactivate=(&apos;Parent.&apos;)##(name)##(&apos;.visible=false Activated=false&apos;)" Visible="false"/>

</Page>


Drumstix42 01-14-2008 04:36 AM

I've been trying to mess with your example Talyns, but I can't seem to get it to work.

I tried a simple:
OnActivate=('Parent.')##(name)##('.visible=false')

... in attempt for an object to hide itself, but it wouldn't work. I was trying at first to set a variable in another object, but thought I'd first see if I can do something basic. Is my syntax incorrect?

I have a feeling you can only set a property using a variable, but not navigate the XML tree with a variable.
I may have a work-around to what I'm currently working on, but it's no big deal.
Looking at the code again, I see how I could set where I want to go in the tree as the variable in an object, and then execute it using the onActivate. Ugh, so many steps just to do something with a variable ;)

Drumstix42 01-14-2008 05:05 AM

Yeah, I definitely over complicated what I was trying to do, but your example may still be able to help in some other ideas I have :rolleyes:

gm9 01-14-2008 05:36 AM

Quote:

Originally Posted by Drumstix42 (Post 68521)
I have a feeling you can only set a property using a variable, but not navigate the XML tree with a variable.

I'm not entirely sure what you are trying to do, but your issue may be that you can always just resolve one variable per step. You are trying to do two in one.

The first step is to resolve your (name). Once you have that done, you can then resolve the XML path and address the visible parameter.

As an example an excerpt from my curing code which pulls the cure spell name from a file based on several variables. This is a three step process where I first "build" the correct location in the XML tree for the name, then create a script to pull the name into another variable and finally execute that script:

<Button Name="Configure"/>
<Button Name="GetSpellLocation" OnPress="SpellLocation=&apos;Parent.ProfitUI_Cures.&apos; ## (Parent.Parent.Parent._HUD.ProfitUI_SubclassDetector.Subclass) ## &apos;.&apos; ## (Parent.CureName) ## &apos;Cure&apos;
Parent.Configure.OnPress=&apos;Parent.Cure=&apos; ## (SpellLocation)
Parent.Configure.Press=true"/>

Drumstix42 01-14-2008 02:11 PM

Indeed. I totally overlooked the basis of it. I understand it now, and got it working. But in the end, I didn't need to use it. But I'm sure I'll use this new knowledge soon enough :nana:


All times are GMT -5. The time now is 09:24 AM.

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