Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: He-Man on Sat 19/06/2004 15:15:12

Title: getobjectgrafic. ARGH!
Post by: He-Man on Sat 19/06/2004 15:15:12
This is my script:

function object1_a() {
Ã,  // script for object1: Ext.modes object
Ã,  Ã, if (UsedMode("open")){
if ((GetGlobalInt (1))==1){
DisplaySpeech (EGO,"I can't reach it!");}

if ((GetGlobalInt (1))==2){
Ã, 
Ã,  if (GetObjectGraphic (1)==140){
// if door is closed

SetObjectGraphic (1,141);
RestoreWalkableArea (3);}
Ã,  if (GetObjectGraphic (1)==141){
// if door is open

SetObjectGraphic (1,140);
RemoveWalkableArea(3);}
}Ã,  Ã, 
}
}

I want the the object's grafic to change between open and closed.
The player character just walks to the door and nothing more...

your pal
Niels
Title: Re: getobjectgrafic. ARGH!
Post by: Goot on Sat 19/06/2004 18:58:25
I'm not familiar with some of those scripting commands but I'm not too sure that   if (UsedMode("open")){ works. Have you been able to sucessfully use that command with mode open in other places? That's the only thing in the script that doesn't seem like I it will definately work. Also, when you're doing the global integers, you only need to do if(GetGlobalInt(int)==x){. You had some extra parenthesis in there somewhere. Also, make sure you have the right object number. The first object in the room is object 0, not 1.
Title: Re: getobjectgrafic. ARGH!
Post by: Goot on Sat 19/06/2004 19:00:28
Another point: I don't think you should be using function object 1a. You want to do it under any click on object, I assume you have made a special cursor for open.
Title: Re: getobjectgrafic. ARGH!
Post by: Ashen on Sat 19/06/2004 19:16:22
I guess UsedMode() is a custom function? But shouldn't it be:

if (UsedMode() == open) {

Maybe GetCursorMode() would work, if you've actually created a MODE_OPEN.