Hi, I'm having a problem with my game crashing, and I can't understand why. The error message I receive is:
An error has occured. Please contact the game author for support, as this is likely to be a scripting error and not a bug in AGS. (ACI version 3.00.1000)
in "room2.asc", line 290
Error: Cannot display message with extended characters in SCI font
(Accented characters, for example the special French and German e/a/u/i letters cannot be used by default. You need to import a TTF font to do so).
The thing is, I don't WANT to show these accented characters.
Line 290 of my code is:
cTeller.SayBackground(String.Format("$%d", BlockRefund[Clicker1]));}
Would anyone be able to suggest what I need to do to correct this? Thanks :)
Hmmm. What's BlockRefund[Clicker1]? I mean, what is it declares as and what value does it contain?
Hey thanks for responding.
Its a simple int, just declared as int Clicker1;
Its value changes, but when it crashed it would be at 100.
EDIT
Oh, and BlockRefund is an array: int BlockRefund[500];
No, what's BlockRefund[]? Clicker1 has got to be an int since it's used as array index.
Is BlockRefund[] an integer array?
Lol, I realised just after I posted and edited my post.
BlockRefund is an array: int BlockRefund[500];
I'm stumped. Try this:
* Import a TTF Font.
* In the game_start() function, put:
Game.SpeechFont = eFontFont3; // OR WHATEVER THE NEW FONT IS
Then run the game and see what text is displayed when it gets to the erroneous line.
Let us know the result.
Thanks again for the replies.
I switched it to a TTF font, and now its appearing as the symbol þ.
Oh, and a correction, the value is -100, not 100.
Is $-100 code for that symbol in AGS?
The strange thing is, it doesn't happen all the time, only sometimes, even though the code isn't changing.
So BlockRefund[Clicker1] is -100?
Or is Clicker1 itself -100?
And why would an int end up as "þ"?
What does BlockRefund[] contain? And what is it supposed to contain? More info, please.
BlockRefund[Clicker1] is -100.
And I have no idea why it's ending up as þ lol.
I'm not sure what you mean by what it contains?
It's meant to end up with the character saying $-100, and it is doing that most of the time. But every so often it's showing þ instead, even though the information isn't changing.
EDIT
Ok, I've let it run a whole bunch of times, and it turns out its not just the þ appearing. A "J", "G", ">", and one of those square symbols you get on webpages when your browser doesn't have the font has appeared too lol. I'm completely lost why this is happening lol.
he means Clicker1 has a value. Like 69. and then BlockRefund[69] has a SEPARATE value. So,
* What is Clicker1 at the time of the error?
* And what is BlockRefund[Clicker1] at the time of the error?
Clicker1 is changing, but the weird symbols seem to appear/not appear at random regardless of its value (I've tried it with many different values but the weird symbols seem to appear around 10% of the time no matter wha the number is).
BlockRefund[Clicker1] is always -100.
BlockRefund[Clicker1] is probably NOT always -100. When you declare an array, like BlockRefund[500], you have effectively delcared 500 integers.
BlockRefund[0] has a value, BlockRefund[1] has a value, BlockRefund[2] has a value, .... So unless your code assigns each and every one of the those integers to '-100', or Clicker1 is NOT in fact changing, then something else is wrong with your code.
Try changing the line to this:
cTeller.SayBackground(String.Format("$%d", Clicker1));}
And see what it says.
Okay, I changed it to remove the - sign, but the symbols still appear.
I also fixed Clicker1 so that it was always at 100 and didn't change, but the symbols still appeared.
The part I can't understand is that sometimes the symbols appear, at other times they don't, even when the code isn't changing - ie. Clicker1 is staying at 100.
Hmm this does sound like a bug of some sort, because no matter what the value of BlockRefund[Clicker1], it should still just be displaying a number and not any wacky characters.
Would you be able to upload a sample game that demonstrates the error?
Of course :)
I don't want to release all of my code publicly and I'm not too sure how to isolate the problem script from the rest of my game, but I'll upload the files and send you a PM with its URL so you can have a look at it. I'm happy it might not be my amateurish scripting that's the problem lol.
To demonstrate the problem you can just upload the compiled-folder. No scripting in there..
Have you ever cut-and-pasted anything into a script from Microsoft Word?
It changes quotes and hyphens to odd characters that AGS doesn't display.
Quote from: matti on Mon 09/06/2008 13:55:46
To demonstrate the problem you can just upload the compiled-folder. No scripting in there..
Oh heh silly me. Yeah will do.
Quote from: SSH on Mon 09/06/2008 14:05:41
Have you ever cut-and-pasted anything into a script from Microsoft Word?
It changes quotes and hyphens to odd characters that AGS doesn't display.
Nope, I'm pretty sure I haven't. At least looking through the scripts in AGS doesn't show any of the symbols that are appearing.
EDIT
Okay, I've uploaded a demonstration of the problem here: http://disneysneverland.angelfire.com/AGS_Tycoon.rar
To replicate it, just click the construction tab at the top (anyone who's played RCT will recognise my placeholder graphics lol), select the hut, and then basically just keep building huts on the map.
Sometimes it crashes straight away, other times it crashes on the fiftieth attempt at building the hut. It seems random to me so I'm sorry if I can't give any better instructions :-\... basically just keep building them and it'll crash eventually within a couple of minutes.
Could you try replacing the line with this:
String temp=String.Format("$%d", Clicker1);
cTeller.SayBackground(String.Format("DBG: %d %s", temp.Chars[1], temp));}
and then tell us what it says when the money goes negative?
Ah thankyou! It seems to be working now - at least, it's not crashing. It's reading "DBG: 49 100".
What was I doing wrong here? temp.Chars[1] should give the first character of the string if I understand this correctly... how comes its coming up as 49?
temp.Chars[1] is the second character (the first is temp.Chars[0]), plus it's displayed as int, 49 is the ascii code of '1'.
Thanks for uploading the game. I've investigated further and confirmed that this is a bug in AGS related to SayBackground. I'll get it fixed.
Yay it's not my scripting :)
Yeah, it turns out the it isn't fixed as I thought it was, but seen as it's a bug I'll leave it for now and come back to it later. Thanks to everyone for helping out.
This should be fixed in the 3.0.2 Final release, available from the Technical Forum. Would you mind trying it out and making sure that it fixes the problem?
Downloaded it and checked it, and it seems to be working fine now :). Thanks for fixing it!