Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: dikla on Mon 26/07/2004 20:32:26

Title: now you see it now you dont - help!!!!
Post by: dikla on Mon 26/07/2004 20:32:26
i worte a script which works very fine if i test it. but when i try it throu the game it says the opposit.
here is the script:


function hotspot12_a() {
  // script for hotspot12: Use inventory on hotspot
if ((player.inv[26] == 1) &&   (player.inv[21] == 1) &&   (player.inv[22] == 1) &&   (player.inv[18]  == 1)){  //if the player has all this items

LoseInventory (36);//that it does

Display ("Now you can make the medicine");
NewRoomEx (8, 215, 150);
AddInventory (36);
}
else {
  Display ("You don't have all the ingredients!");

  }
 
}
now to try the game i checked all those 4 inventory items   (26,21,18, 22) (player start with those items) and try the game in the specific room. it works ok.
but when i tried the whole game itself, when i got to this room and i do have all the items that i collected in the way it suddenly says: you dont have all the ingredients!.

i checked and doubl checked all the scripts and its ok.
how can it be that when i try only in those 4 items it work ok and when i play all the game it is worng?
pls let me know - i have finished the game!!!
txk
dikla

if so, another question. is someone knows how to make gui slider not appearing in every room of the game?
thx again
dikla
Title: Re: now you see it now you dont - help!!!!
Post by: Gilbert on Tue 27/07/2004 02:41:48
Please use descriptive subject line next time, thank you.

I can't make out much from your code, but is it possible that the character could get more than once of those 4 items ?

For example, if the character got item #26 twice, then player.inv[26] becomes 2, which would not react to your (player.inv[26]==1) condition. A safer way is just to check whether the character has these items (ie. not having exactly one for each):

function hotspot12_a() {
  // script for hotspot12: Use inventory on hotspot
if ((player.inv[26])&& (player.inv[21])&&  (player.inv[22])&& (player.inv[18])){  //if the player has all this items
LoseInventory (36);//that it does
Display ("Now you can make the medicine");
NewRoomEx (8, 215, 150);
AddInventory (36);
}
else {
  Display ("You don't have all the ingredients!");
  }
}

I can't quite get your second problem, can you just put the sliders in a separate GUI and just turn that GUI off when it's not needed?
Title: Re: now you see it now you dont - help!!!! solved
Post by: dikla on Tue 27/07/2004 21:01:53
thank you very much. indeed i had two items.
dikla