Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Fabiano on Fri 06/08/2004 15:36:17

Title: error in script using character[].room and getglobalint
Post by: Fabiano on Fri 06/08/2004 15:36:17

if (IsKeyPressed(65)&&(GetGlobalInt(25)>0)) {

character[GetGlobalInt(25)].room=character[0].room
character[GetGlobalInt(25)].x=character[0].x
character[GetGlobalInt(25)].y=character[0].y
SetGlobalInt(25,0);
LoseInventory((GetGlobalInt(25)));
}


i guess im missing something here. Can anyone shed me a light?
Title: Re: error in script using character[].room and getglobalint
Post by: Radiant on Fri 06/08/2004 16:34:28
What you're missing is an explanation of what you're trying to do and what actually happens.

At a guess, making a variable (GlobInt #3) refer to both a character and an inventory item may get you confused as they don't necessarily line up.
Also, where exactly are you putting this? Because the correct place would be on_key_press and then you'd be checking for keycode, not IsKP.
Title: Re: error in script using character[].room and getglobalint
Post by: Fabiano on Fri 06/08/2004 17:13:25
uh...sorry :\

This part of the repeated execute is meant to say:

if you press key A and the global int 25 > 0, then the character X (meaning x is the number put on golbal int 25) appears in the same location as the character 0.

I'm using for a script that uses a key (a) to get and drop objects, each obj has a character (like, character 3 = inventory obj 3), but the ags always say (error parser in expression near "character") that is theÃ, 

"character[GetGlobalInt(25)].room=character[0].room"

so I'm doing something wrong, but i cannot find out what.
Title: Re: error in script using character[].room and getglobalint
Post by: strazer on Fri 06/08/2004 17:45:00

character[GetGlobalInt(25)].room=character[0].room
character[GetGlobalInt(25)].x=character[0].x
character[GetGlobalInt(25)].y=character[0].y


Are the semicolons missing in your script as well?
Title: Re: error in script using character[].room and getglobalint
Post by: Fabiano on Sat 07/08/2004 04:02:59
hehe... see? that happens when u focus on other things =)
thanks strazer