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?
What if you put %{, and %} ?
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.
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.
then try "\}". It works for quotemarks (").
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
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.
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);
Good point, well spotted, I'll get it fixed.
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.
"\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);
)