Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Edwin Xie on Mon 25/10/2004 04:45:44

Title: Character[]. variables? (SOLVED)
Post by: Edwin Xie on Mon 25/10/2004 04:45:44
I get a problem when trying to type:

curroomnumberint=character[CHARID].room

which gives me this error:
---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was in 'Main script':



Error (line 422): missing ']'



Do you want to fix the script now? (Your game has not been saved).
---------------------------
Yes   No   
---------------------------

The code I gave above is line 422.
Title: Re: Character[]. variables?
Post by: strazer on Mon 25/10/2004 04:49:53
Try adding a semi-colon to the end of the line.
You may also want to change "CHARID" to "GetPlayerCharacter()".
Title: Re: Character[]. variables?
Post by: Edwin Xie on Mon 25/10/2004 04:54:48
Thanks, but following that, there is another problem I would like you to fix:
How do I correct this?:

SetLabelText(11,3,"Enter new room: (in room %d)",curroomnumberint);

There was an error that said there were wrong numbers of parameters for SetLabelText.
Title: Re: Character[]. variables?
Post by: strazer on Mon 25/10/2004 04:59:14
You can't use that %d thing with SetLabelText.
Do this:

string buffer;
StrFormat(buffer, "Enter new room: (in room %d)", curroomnumberint);
SetLabelText(11, 3, buffer);
Title: Re: Character[]. variables?
Post by: Edwin Xie on Mon 25/10/2004 05:50:41
Ah, thanks. ;D