Error with a switch script

The error is:

Error running script: Error evaluating expression 'ListCount (CAPA Maps) > 0': ListCount function expected list parameter but was passed 'Object: CAPA Maps'

This is the code:

if (ListCount (CAPA Maps) > 0) {
  ShowMenu ("What map?", maps, true) {
    switch (result) {
      case ("Tutorial Map") {
        picture ("Tutorial Map.png")
      }
    }
  }
}
else {
  msg ("You don't have any maps.")
}

This is for a more immersive map system than what quest offers, an app for a laptop I gave the player.


The problem here is your use of the ListCount function in the first line.

ListCount tells you the number of items in a list. You're using it to get the number of objects in the list CAPA Maps.

But CAPA Maps isn't a list; it's an object.

Perhaps you meant:

if (ListCount (maps) > 0) {

(I assume that maps is a list, because you use it as a list in the next line)


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

Support

Forums