|
08-04-2010, 10:41 AM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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
Last edited by Drumstix42 : 08-04-2010 at 11:56 AM.
|
08-04-2010, 11:10 AM
|
gm10-1
|
|
Join Date: Feb 2006
Posts: 6,479
|
|
If you can reference it on the lhs you can use quotes: 'Path.Object Name With Spaces.attribute' = value
|
08-04-2010, 11:39 AM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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.
Last edited by Drumstix42 : 08-04-2010 at 11:41 AM.
|
08-04-2010, 11:52 AM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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
Last edited by Drumstix42 : 08-04-2010 at 12:20 PM.
|
08-04-2010, 01:01 PM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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!
This would have been so much easier if I could just access item IDs from the Examine window, Lol.
|
08-09-2010, 05:16 AM
|
|
A Green Troll
|
|
Join Date: Dec 2004
Server: Blackburrow
Posts: 2,221
|
|
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
|
08-09-2010, 08:34 AM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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).
|
08-23-2010, 07:00 PM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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
Last edited by Drumstix42 : 08-23-2010 at 07:07 PM.
|
08-23-2010, 07:08 PM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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
|
08-23-2010, 07:12 PM
|
A Forest Scavenger
|
|
Join Date: Dec 2007
Server: Antonia Bayle
Posts: 17
|
|
Code:
'Parent.Parent.Lord's Amulet.attribute' = blah
try that
|
08-23-2010, 07:17 PM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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.
|
08-23-2010, 07:18 PM
|
A Forest Scavenger
|
|
Join Date: Dec 2007
Server: Antonia Bayle
Posts: 17
|
|
Quote:
Originally Posted by Drumstix42
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.
|
08-24-2010, 04:25 AM
|
gm10-1
|
|
Join Date: Feb 2006
Posts: 6,479
|
|
Quote:
Originally Posted by Brushfire
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.
|
08-24-2010, 06:27 AM
|
A Forest Scavenger
|
|
Join Date: Dec 2007
Server: Antonia Bayle
Posts: 17
|
|
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.
|
08-24-2010, 02:06 PM
|
|
A Griffon
|
|
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
|
|
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
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:54 AM.
|
|