Page 1 of 1

[Closed] New Scripting Bug - "

Posted: Thu Mar 10, 2011 9:36 am
by ThePrivateer
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.

Re: New Scripting Bug - "

Posted: Thu Mar 10, 2011 3:41 pm
by alterecco
As far as I remember you can use escaped quotes in those situations.

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."
Not that it would not be nice to have entities behave the same across the board.

Re: New Scripting Bug - "

Posted: Fri Mar 11, 2011 1:59 am
by ThePrivateer
alterecco wrote:As far as I remember you can use escaped quotes in those situations.

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."
Not that it would not be nice to have entities behave the same across the board.
I've starting using escaped quotes now (updating Hell's Trinity).

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

Re: New Scripting Bug - "

Posted: Fri Mar 11, 2011 2:45 am
by alterecco
ThePrivateer wrote:%name% doesn't work in the same situations
If you want to use %name%, then use the function plyComposeString, that will handle those special variables for you.

Re: New Scripting Bug - "

Posted: Fri Mar 11, 2011 2:52 am
by ThePrivateer
alterecco wrote:As far as I remember you can use escaped quotes in those situations.

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."
Not that it would not be nice to have entities behave the same across the board.
Odd. Is that the right syntax? It's not working for me -- I get a "no binding for symbol" error again.

Re: New Scripting Bug - "

Posted: Fri Mar 11, 2011 4:07 am
by alterecco
can you post the snippet you are working with (including surrounding xml)

Re: New Scripting Bug - "

Posted: Fri Mar 11, 2011 4:26 am
by george moromisato
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.

Re: New Scripting Bug - &quot;

Posted: Fri Mar 11, 2011 4:40 am
by ThePrivateer
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?
alterecco wrote:can you post the snippet you are working with (including surrounding xml)
Nevermind, it was my own fault -- I forgot to have an extra (") after the last (\") of someone's sentance. :roll:

Re: New Scripting Bug - &quot;

Posted: Fri Mar 11, 2011 4:50 am
by alterecco
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?
From what I understand of xml parsing there is no sane way around it.

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?!?)

Re: New Scripting Bug - &quot;

Posted: Fri Mar 11, 2011 4:56 am
by Ttech
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.