I need an object to "open" and give player an item after a sequential puzzle is completed

Apologies, this is my first time ever using this site! I'm very new to looking at coding languages.
I have a sequential puzzle in my game where you need to put utensils into their correct spot on a table setting before a tea pot will open its lid and reveal the next piece of a key for the player. I made it so that every time a player put the correct utensil in its corresponding spot, the utensil would become invisible and then after all of the utensils become invisible, a message would appear and a key fragment would then be added to the players inventory. I don't how to write a statement that would basically say: If fork(1), fork (2), and fork (3) are invisible then print message and add key to inventory. Else print different message.


If you want to use the editor and do not want to look into the details of effective coding, than you can just nest the blocks:

if((not ListContains(ScopeVisible(), utensil1) {
  if((not ListContains(ScopeVisible(), utensil2) {
    if((not ListContains(ScopeVisible(), utensil3) {
       msg("Puzzle solved text")
       AddToInventory (your_key)
    }
    else
    {
      msg("Different message")
    }
  }
  else
  {
     msg("Different message")
  }
}
else
{
   msg("Different message")
}

Note: This one checks for the visibility of the objects named "utensil1", "utensil2" and "utensil3". You may set up different flags.

A better and more compact version would be using the "and" keyword:

if( (not ListContains(ScopeVisible(), utensil1)) and (not ListContains(ScopeVisible(), utensil2)) and (not ListContains(ScopeVisible(), utensil3)) ) {
  msg("Puzzle solved text")
  AddToInventory (your_key)
}
else
{
  msg("Different message")
}

Thank you so much! From what I can see its working exactly how I wanted it to :D
I had to use the editor since I'm not very good at reading code yet but I managed to implement what you showed me into the game!


You usually can just switch to code vie, copy & paste from here and go back to editor view.