How to use the [ character in strings? (SOLVED)

Started by strazer, Sun 11/04/2004 20:09:42

Previous topic - Next topic

strazer

The character [ is normally used to indicate a line break in strings, e.g. "Here comes [ a line break".

But how do I mask the character so it is displayed in dialogs/messages?

\[ doesn't work, nor does \\[ or /[

Edit:

AGS v2.7 Beta 11:
Quote* Added \[ to Display/Say/etc, to enable you to display the [ character rather than it doing a line break.

ElectricMonk

I don't have an answer, but a related question:
How do I display " in a string?

strazer

#2
Display("These are called \"quotemarks\" ");

Check this page for more.

ElectricMonk

Thanks... I must have glanced over the "tidbits & snippets" thread about six times by now, but somehow this bit of info never stuck...

Scorpiorus

QuoteThe character [ is normally used to indicate a line break in strings, e.g. "Here comes [ a line break".

But how do I mask the character so it is displayed in dialogs/messages?
I remember it was a problem for me too when I try to create my own font which actually used that character. I had to replace it with another one. I'm not sure if it's at all possible to display it somehow. I wish AGS broke a line with '\n' :P


SSH

How about Display("Here comes %s a line break", "[");
Does that work? (too lazy to try it, sorry!)
12

ElectricMonk

Nope. The result looks something like

------------------
Here comes
 a line break
------------------


Pumaman

Hmm, good question. I'm not actually sure that it's possible; and it's not a trivial matter to add some sort of  \[  support, because it's the engine's interpretation of the character, not the script compiler, that has the problem.

I suppose adding a special sequence like  %[  could represent the real thing, but that seems to be getting rather messy. Hmm.

strazer

Sorry to bring this up again, but would it be possible to reserve some obscure extended character instead? Since it won't have to be displayed anyway, there should be no problems with SCI fonts.
Just a thought.

Pumaman

Well, I don't want to change the character from [ at this stage, but adding some sort of escape sequence to print a real [ is a possibility.

I suppose %[ would probably do the trick, unless there are any objections?

Goot

The default message for clicking on that question mark icon had a message with a break in it which used [[. That has worked for me, but maybe it doesn't in the new version.

Pod

Quote from: Pumaman on Thu 06/01/2005 20:18:00
Well, I don't want to change the character from [ at this stage, but adding some sort of escape sequence to print a real [ is a possibility.

I suppose %[ would probably do the trick, unless there are any objections?

Why not /[ ? Like /"

TerranRich

I believe that would be a better idea. If anybody ever wanted to end a line with a forward-slash, they could simply use "/ [" with the space in between.
Status: Trying to come up with some ideas...

SSH

Quote from: Pod on Fri 07/01/2005 13:17:50
Quote from: Pumaman on Thu 06/01/2005 20:18:00
Well, I don't want to change the character from [ at this stage, but adding some sort of escape sequence to print a real [ is a possibility.

I suppose %[ would probably do the trick, unless there are any objections?

Why not /[ ? Like /"

If you're going to use a slash for an escape character, please use a backslash, like perl, csh, tcl, lisp, regexps, C, etc.
12

Radiant

Alternatively, use one of the obscure characters such as ~ and edit the font to change its appearance to a [

Pumaman


SMF spam blocked by CleanTalk