I recently made a new ticket on the trac - http://wiki.neurohack.com/transcendence/trac/ticket/619
This one covers the issue I found recently whereby " doesn't work in all situations, most notably ones such as (scrSetDesc gScreen.
I eleborate more on it with the Ticket, and some examples are provided.
[Closed] New Scripting Bug - "
- ThePrivateer
- Militia Captain
- Posts: 943
- Joined: Tue Oct 12, 2010 5:12 am
- Location: Starton Australia
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
As far as I remember you can use escaped quotes in those situations.
Like:
Not that it would not be nice to have entities behave the same across the board.
Like:
Code: Select all
"Two guys walk into a bar. One guys says \"I'm thirsty.\" So the second guy orders the first guy a drink."
- ThePrivateer
- Militia Captain
- Posts: 943
- Joined: Tue Oct 12, 2010 5:12 am
- Location: Starton Australia
I've starting using escaped quotes now (updating Hell's Trinity).alterecco wrote:As far as I remember you can use escaped quotes in those situations.
Like:
Not that it would not be nice to have entities behave the same across the board.Code: Select all
"Two guys walk into a bar. One guys says \"I'm thirsty.\" So the second guy orders the first guy a drink."
But it would be nice for entities to work everwhere -- also, %name% doesn't work in the same situations, but I didn't make a ticket for that. x_x
- ThePrivateer
- Militia Captain
- Posts: 943
- Joined: Tue Oct 12, 2010 5:12 am
- Location: Starton Australia
Odd. Is that the right syntax? It's not working for me -- I get a "no binding for symbol" error again.alterecco wrote:As far as I remember you can use escaped quotes in those situations.
Like:
Not that it would not be nice to have entities behave the same across the board.Code: Select all
"Two guys walk into a bar. One guys says \"I'm thirsty.\" So the second guy orders the first guy a drink."
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
Part of the problem is that there are two parsing steps:
1. XML is parsed into C++ structures. In this step, we convert " into the double-quote character.
2. C++ structure is parsed into TransLisp. In this step, we need a back-slash to escape quote characters.
So imagine something like:
<SomeEvent>(dbgOutput "He said, "Wow" and ran.")</SomeEvent>
In step #1, the above will be parsed as:
<SomeEvent>(dbgOutput "He said, "Wow" and ran.")</SomeEvent>
In step #2, we try to parse the above as TransLisp and get stuck: the double-quote right before Wow closes the string and we end up with an invalid token (Wow) outside of the quotes.
Always follow these rules:
1. Inside of an attribute, use "
name="A Man called "Jayne""
2. Inside of TransLisp, use a backslash:
(dbgOutput "A Man called \"Jayne\"")
Hope that helps.
1. XML is parsed into C++ structures. In this step, we convert " into the double-quote character.
2. C++ structure is parsed into TransLisp. In this step, we need a back-slash to escape quote characters.
So imagine something like:
<SomeEvent>(dbgOutput "He said, "Wow" and ran.")</SomeEvent>
In step #1, the above will be parsed as:
<SomeEvent>(dbgOutput "He said, "Wow" and ran.")</SomeEvent>
In step #2, we try to parse the above as TransLisp and get stuck: the double-quote right before Wow closes the string and we end up with an invalid token (Wow) outside of the quotes.
Always follow these rules:
1. Inside of an attribute, use "
name="A Man called "Jayne""
2. Inside of TransLisp, use a backslash:
(dbgOutput "A Man called \"Jayne\"")
Hope that helps.
- ThePrivateer
- Militia Captain
- Posts: 943
- Joined: Tue Oct 12, 2010 5:12 am
- Location: Starton Australia
Thanks George!
So is there no way of getting around that then? Should I just remove the Ticket, or do you think that TransLISP might get modified at some point to cope with this?
So is there no way of getting around that then? Should I just remove the Ticket, or do you think that TransLISP might get modified at some point to cope with this?
Nevermind, it was my own fault -- I forgot to have an extra (") after the last (\") of someone's sentance.alterecco wrote:can you post the snippet you are working with (including surrounding xml)
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
From what I understand of xml parsing there is no sane way around it.ThePrivateer wrote:So is there no way of getting around that then? Should I just remove the Ticket, or do you think that TransLISP might get modified at some point to cope with this?
Also, thanks George for lining it out so simply... I feel a bit embarrassed, because it is so obvious once you think of it! (Ergo, I should start thinking?!?)
- Ttech
- Fleet Admiral
- Posts: 2767
- Joined: Tue Nov 06, 2007 12:03 am
- Location: Traveling in the TARDIS
- Contact:
I don't do much scripting in the game, never good with lisp type dialects, however, in certain languages to get a different quote you could use 'Hello there "Tom"!' and it would work or use double quotes with a single quote within. but using html special chars would seem to work just as well.