[Closed] New Scripting Bug - "

These are old bug reports that have been closed.
Locked
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

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.
User avatar
alterecco
Fleet Officer
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:

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.
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

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
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

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.
User avatar
ThePrivateer
Militia Captain
Militia Captain
Posts: 943
Joined: Tue Oct 12, 2010 5:12 am
Location: Starton Australia

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.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

can you post the snippet you are working with (including surrounding xml)
george moromisato
Developer
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.
User avatar
ThePrivateer
Militia Captain
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?
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:
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

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?!?)
User avatar
Ttech
Fleet Admiral
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.
Image
Image
Locked