Error with a switch script
Atokrad
08 Mar 2021, 08:01The 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.")
}
Atokrad
08 Mar 2021, 08:03This is for a more immersive map system than what quest offers, an app for a laptop I gave the player.
mrangel
08 Mar 2021, 10:07The 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)