Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: ThunderStorm on Sat 01/11/2003 16:33:46

Title: bug with closing brace in script editor
Post by: ThunderStorm on Sat 01/11/2003 16:33:46
Alright, here is a small problem with the script editor that sometimes drives me crazy:

If a string contains the cloing brace '}', the script editor seems to take it as the end of the function and hides everything that is written after it if it's called from the interaction editor.

For example, take the following script for 'look at hotspot':

MoveCharacterToHotspot(EGO,1);
DisplaySpeech(EGO,"I am displaying {these} braces");
DisplaySpeech(EGO,"And I'm talking on and on.");

The next time the 'run script' interaction is double-clicked in the interaction editor, the script editor only displays:

MoveCharacterToHotspot(EGO,1);
DisplaySpeech(EGO,"I am displaying {these

This example looks rather weird, but I have replaced the SCI code for the closing brace with the special character "ü", which I use more frequently.

Is there any chance this could be fixed?
Title: Re:bug with closing brace in script editor
Post by: Scummbuddy on Sat 01/11/2003 19:48:55
What if you put %{, and %}   ?
Title: Re:bug with closing brace in script editor
Post by: ThunderStorm on Sat 01/11/2003 23:16:50
Ah, I didn't realize you could use the % character for braces as well. I'll try and see what happens. Thanks for your idea in the first place.
Title: Re:bug with closing brace in script editor
Post by: ThunderStorm on Sun 02/11/2003 09:41:31
Hmm, I tried using %} yesterday, but the problem still occurs. In fact, it looks like AGS tries to display it as two signs, so it doesn't seem to be designed for that purpose.
Title: Re:bug with closing brace in script editor
Post by: Ishmael on Sun 02/11/2003 10:25:04
then try "\}". It works for quotemarks (").
Title: Re:bug with closing brace in script editor
Post by: Kweepa on Sun 02/11/2003 11:30:31
I'm using AGSEdit v2.56d, and that doesn't happen for me.
I did as you said, and put
 DisplaySpeech(EGO, "I am displaying {these} braces.");
into a look at hotspot interaction, and I just cut and pasted this from the editor window after reopening it.

So maybe you have an old version? (Help->About)

Steve
Title: Re:bug with closing brace in script editor
Post by: ThunderStorm on Sun 02/11/2003 16:13:23
I am using the same version, but I can see why it doesn't happen with the script line I used as an example: There is a pair of braces - "{these}", just as they would occur in an if- or while structure, so they are recognized correctly by AGS. Sorry, this was my fault.

The error occurs when there is only a closing brace without a preceding opening one, such as in

DisplaySpeech(EGO,"This } is a closing brace.");

As I said - my guess is that AGS doesn't check whether the braces are part of a string or not, which is why "\}" doesn't make a difference - I just tried it.

Of course I could simply replace another character with the one I want to use, but I feel this could cause problems under different circumstances a well.
Title: Re:bug with closing brace in script editor
Post by: Spyros on Sun 02/11/2003 19:16:06
I'm sure it won't work but you can try something like this:

string brace="}";
DisplaySpeech(EGO,"This %s is a closing brace.", brace);

Title: Re:bug with closing brace in script editor
Post by: Pumaman on Sun 02/11/2003 19:54:01
Good point, well spotted, I'll get it fixed.
Title: Re:bug with closing brace in script editor
Post by: After on Wed 05/11/2003 08:38:44
Quote from: TK on Sun 02/11/2003 10:25:04
then try "\}". It works for quotemarks (").
Hmm... and what about "\n", or ascii codes? I'll have to search again for the the regex section in the helpfile.
It has a "c-like scripting language", but the actual list of legal operators eludes me.
I saw some post involving structs too.
Can I pass arrays? I'll have to code it and see.

I wonder how much needlessly ugly scripting arises from using only what the manual covers.
Title: Re:bug with closing brace in script editor
Post by: Gilbert on Wed 05/11/2003 08:51:17
"\n" always works, for specific ascii characters, I think you can use:

char a = 131;
Display("The character with ASCII 131 is %c",a);

(I think the following may work too:
Display("The character with ASCII 131 is %c",131);
)