Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Tue 16/03/2004 11:09:56

Title: Inventory blues
Post by: on Tue 16/03/2004 11:09:56
I'm almost embarased to ask this, but I have no idea how to actually get the active inventory item to do anything, here's a quick rundown of my problem:

I need to be able to use an item on a character that then takes you to a different room.

here's the scripting I've tried to use:

function character4_a() {
 // script for character4: Use inventory on character
if character[PZY].activeinv (6);
and (GetGlobalInt(6)=1);
Displayspeech (PZY, "here we go");
Fadeout (30)
NewRoomEx (7, 39, 228);
}

and lo and behold, it doesn't work in the slightest, hooray.

sounds pretty simple to me, but I have a very low level of understanding for the scripting, I've only been using AGS for little over a week, so feel free to laugh all you want.
Title: Re:Inventory blues
Post by: Gilbert on Tue 16/03/2004 11:16:25
Well, I'm not experienced in this field, but I think it should be:


function character4_a() {
 // script for character4: Use inventory on character
if ((character[PZY].activeinv==6)&&(GetGlobalInt(6)==1)){
  DisplaySpeech (PZY, "here we go");
  FadeOut (30);
  NewRoomEx (7, 39, 228);
  }
}


Remember also when  doing comparisons you need == other than =. Notice the cases of letters in function names also.
Title: Re:Inventory blues
Post by: on Tue 16/03/2004 11:29:52
ah, there we go, thanks