Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: taryuu on Mon 22/09/2003 22:58:53

Title: Scripting help
Post by: taryuu on Mon 22/09/2003 22:58:53
so after a conversation is run,  a character at 190,190 is set to room -1.    so i'm trying this script.

what's wrong?

Player enters screen after fadein

if (GetCharacterAt (190,190) == -1) {
RestoreWalkableArea(2);
}  

else {RemoveWalkableArea(2);}

it just restores the walkable area even if teh character is there.

Title: Re:Scripting help
Post by: Gilbert on Tue 23/09/2003 03:11:52
Because it should be:

if (character[BLAH].room == -1) {
RestoreWalkableArea(2);
}
else {RemoveWalkableArea(2);}

replace BLAH by the appropiate character script ID.

GetCharacterAt() returns the charid of whoever would be there in the current room, not the room number where a character's in.
Title: Re:Scripting help
Post by: taryuu on Tue 23/09/2003 08:45:54
well according to the manual, getcharacterat should return a -1 int value if it's not there.
Quote
GetCharacterAt (int x, int y)

Checks if there is a character at SCREEN co-ordinates (X,Y). Returns the character number if there is, or -1 if there is not. See the description of GetLocationName for more on screen co-ordinates.
NOTE: Any characters with the "No interaction" flag set will not be seen by this function.

Example:

GetCharacterAt(124,200);

will get the character’s number standing at co ordinates 124,200 or -1 if no character is there.

am i reading this wrong?

however your script works gilbert buddy. thanks!
Title: Re:Scripting help
Post by: Gilbert on Tue 23/09/2003 08:53:07
Your script may work, provided that if the character was there, he's stationary and that corresponding pixel of him is not a transparent pixel (if pixel perfect clicking is on I think).

Since what you really need to check is whether that character is in that room, checking what room he's in seems to be a more direct way.
Title: Re:Scripting help
Post by: taryuu on Tue 23/09/2003 08:56:23
and a more logical way.  thanks again.