ID:155030
 
Any reason why this won't work?

var/x = list("yay","nay")

mob
verb
check()
if("yay" in x)
world << "yay."


I was specifically hoping to be able to use the if function, and I don't see any mention in the reference of this not being possible.

Since the IN operator will just check to see if something is in a list, and then return either true or false.
It does work, but the problem you have is variable name related. The check verb is checking to see if a text string is in src.x(even if you didn't specifically type out src.x) and not the list you made called x.

As an option you could type if("yay" in global.x), but you're better off not naming your custom variables the same as built-in ones.
In response to tenkuu
Ah I see, my mistake it completely blanked on me that "x" is a built in variable.

mob
var/ex = list("yay","nay")
verb
check()
if("yay" in ex)
world << "yay."
You should probably use Find() for things like that. Find not only returns true or false but also returns the location of the element.
In response to Ill Im
Ill Im wrote:
You should probably use Find() for things like that. Find not only returns true or false but also returns the location of the element.

Why would he need the index?