Scripting help

Started by taryuu, Mon 22/09/2003 22:58:53

Previous topic - Next topic

taryuu

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.

I like having low self-esteem.  It makes me feel special.
   
taryuu?

Gilbert

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.

taryuu

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!
I like having low self-esteem.  It makes me feel special.
   
taryuu?

Gilbert

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.

taryuu

and a more logical way.  thanks again.
I like having low self-esteem.  It makes me feel special.
   
taryuu?

SMF spam blocked by CleanTalk