EQ2Interface

EQ2Interface (https://www.eq2interface.com/forums/index.php)
-   XML Modification Help & Info (https://www.eq2interface.com/forums/forumdisplay.php?f=22)
-   -   Possible to reference Objects with spaces in name? (https://www.eq2interface.com/forums/showthread.php?t=14488)

Drumstix42 08-04-2010 10:41 AM

Possible to reference Objects with spaces in name?
 
Has anyone found a way to reference an object that has a space in the name?

I'm trying to work out a project using Item names, but with all of the spaces, I'm finding it impossible to reference them in any manner.
Am I screwed?

Solved below
in reply #4

gm9 08-04-2010 11:10 AM

If you can reference it on the lhs you can use quotes:
'Path.Object Name With Spaces.attribute' = value

Drumstix42 08-04-2010 11:39 AM

I half have working what I want...

I managed to get it to work if I reference the object directly by name, but if I try to use a variable and concatenate them I can't seem to get the desired result. And I would need to do this for my idea to work.
I have an object named Test Object with the text element set to: Testing 123

sTest=('Parent.Test Object.text')
say sTest

The above returns the proper string echoed into chat.

However the following I cannot seem to find a proper method for.

sName=('Long Item Name')
sTest=('Parent.') ## sName ## ('.text')
say sTest

The above returns: Parent.Long Item Name.text
Have tried a few different alterations with how I concatenate them, but with no luck.

I tried setting it to another variable again like: sTest2=('sTest')
... but that did nothing new.

Drumstix42 08-04-2010 11:52 AM

Okay in response to myself, I think I answered my own question. Seems when trying to explain what you're doing helps yourself figure out the solution :)

Basically I just had to get creative with it. I knew I had to do it in 2 steps, but my brain wasn't quite grasping the method at first.

Setup separate objects with the string broken up.

code1's object: sTestObj=('Parent.
code2's object: .text')

Then do this:
sString=('Long Item Name')
Parent.DoCommand.onpress=(code1 ## sString ## code2)
Parent.DoCommand.press=true

However the problem I don't think I can solve.... Items with apostrophes in their names :(

Drumstix42 08-04-2010 01:01 PM

Well despite apostrophes (they might have been manageable), I found out that the Map system doesn't support names with spaces.

You can add a POI with spaces, but you cannot delete it via slash command. I tried using quotes to no avail. I even managed to add a category name with a space using quotes, but still wasn't able to delete it.
One problem solved, blocked by another! :mad:

This would have been so much easier if I could just access item IDs from the Examine window, Lol.

Zonx 08-09-2010 05:16 AM

slash commands that take an input value can often be executed two ways...

/do_something_with foo
or
do_something_with='foo'

You might be able to use the later with a variable containing the concatenation.

foo='something' ## 'somethingelsewithspaces'

do_something_with=foo

Drumstix42 08-09-2010 08:34 AM

Here's the PM I sent to Rothgar. It explains more in detail about the problem I ran into.

Quote:

Hey Rothgar,

I know you're super busy most of the time. I just wanted to bring up a question about a command used for adding a POI to the map in-game.
/map2_add_poi

It's possible to use this to add a POI and save information via UI scripting. For example:
/map2_custom_poi_filename customdata.xml
/map2_add_poi TestCategory 0 0 0

This will make a section in the file with the name TestCategory. I found out if you wrap the first parameter in quotes "Test Category", and then you can successfully add a section with a space in the name and it will work great.

However, the problem is in the second command:
/map2_delete_poi

This command requires the specific POI name, followed by the Section name.
/map2_delete_poi MyPOIname TestCategory

The real problem I'm getting at is it's possible to add a POI with a space in the category name, or even the POI name, but it's impossible to delete it via command.

I was wondering if there was an easy way to change the delete command to support quotes in the POI name and/or category name.

The POI name itself can have spaces cause the window allows it that pops up. But this is also impossible to delete via slash command.

Thanks for your time and any possible response to this.
I did /bug it in game cause it seemed like a bug to me at least :)
I can try to wrap quotes around the delete command parameter(s), but I haven't gotten it to work no matter how I twist it. Weird that the add command supports the quotes, but the delete doesn't (in both parameters).

Drumstix42 08-23-2010 07:00 PM

So we tackled the map system. The delete command supports pipes:
/map2_delete_poi |Poi Name With Lots of Spaces| CategoryName
The above works great. Getting the vertical lines | in the code was annoying, but wrapping them in single quotes worked in the end, it was just combing the code altogether that was a PITA.

So my next question...
Anyone manage to access an element that has both spaces in the name AND an apostrophe?

You can see where this would lead to trouble:
'Parent.Parent.Lord's Amulet.attribute' = blah

Drumstix42 08-23-2010 07:08 PM

LOL... almost every time I ask a question I usually manage to figure it out.

Wrapping it in double quotes worked!

"Parent.Lord's Amulet.attribute" = blah

Brushfire 08-23-2010 07:12 PM

Code:

'Parent.Parent.Lord's Amulet.attribute' = blah
try that

Drumstix42 08-23-2010 07:17 PM

hehe I posted the solution above. The reason I needed to do it the way I posted, is because I'm referencing Item names from the in-game examine window.

They have apostrophe's in their name, and there's no way to edit the apostrophe out via scripting.

Brushfire 08-23-2010 07:18 PM

Quote:

Originally Posted by Drumstix42 (Post 92584)
hehe I posted the solution above. The reason I needed to do it the way I posted, is because I'm referencing Item names from the in-game examine window.

They have apostrophe's in their name, and there's no way to edit the apostrophe out via scripting.

Yeah saw that after I posted it, but might be useful in other circumstances.

gm9 08-24-2010 04:25 AM

Quote:

Originally Posted by Brushfire (Post 92582)
Code:

'Parent.Parent.Lord's Amulet.attribute' = blah
try that

Does that work now? I remember that you needed to wrap single quotes in doubles and the other way around because the parser would decode all entities (like ') before trying to make sense of it.

Brushfire 08-24-2010 06:27 AM

Yeah you're probably right on that. I do know the parser only makes one pass to for escaped characters though. It won't recursively check until they are all resolved.

Drumstix42 08-24-2010 02:06 PM

I usually work in the UIBuilder, so I'm not sure what my above code would look like in XML saved, I'd have to look. Shouldn't really matter though. Long as I go things working, I am happy :D


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

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