now you see it now you dont - help!!!!

Started by dikla, Mon 26/07/2004 20:32:26

Previous topic - Next topic

dikla

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

Gilbert

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?

dikla

thank you very much. indeed i had two items.
dikla

SMF spam blocked by CleanTalk