Object visible check not working

I have an scenery object that is invisible and after a certain action it is made visible. I am trying to check whether it is visible later but the check always returns invisible even when I have set the object to visible.

I added code straight after it is set to visible, to check it and print out whether it is visible or invisible - it sets it visible and then prints out that it is invisible! Any idea what I am doing wrong? The object isn't in the same location as where the player is when the script is run.

Thanks in advance for any help

Simon


How are you checking its visibility? How are you making it visible?

I'd assume that one of those pieces of code is wrong, but can't tell you what's wrong with it unless you show the code.

I assume you're using the GUI script editor? If so, you can switch to code view just to copy the code, and paste it into the forum for us to check. Put a line of three backticks (```) above and below the code so that the forum doesn't mangle it with formatting.


I have code like the following, entered via the GUI :

if ( <condition> ) {
  MakeObjectVisible (entrance)
  if (ListContains(ScopeVisible(), entrance)) {
    msg ("entrance is visible")
  }
  else {
    msg ("entrance is not visible")
  }
}

OK… you're setting the entrance to be visible, but then testing if it's in the list of objects the player can see. That's not quite the same thing.

That test ListContains(ScopeVisible(), entrance) checks that entrance:

  1. Is an object
  2. Is in the inventory or in the same room as the player
  3. Is visible
  4. Isn't in a closed container
  5. Isn't in a dark room

Not sure if there's anything else it checks. But if one of those isn't true, that'll be your problem.

If you just want to test if an object is visible, rather than testing if the player can see it right now, the line would be if (GetBoolean (entrance, "visible")) {


I just wanted to check for it being visible, so I will use the "if (GetBoolean (entrance, "visible")) { " check.

Thank you so much for your answer.

Simon


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums