ID:261221
 
I was wondering if you could have a "Password" for a mob.
For Example:
turf
Jeremy
verb
Talk()
set src in oview(1)
switch(input("Would you like to guess my password?","Password")in list("Yes","No"))
if("Yes")
input("Whats the number?")
if("20")
usr.Gold += 10000
else
alert("Thats not right!")
if("No")
alert("K")

If you choose to guess the password, no matter what number you put in, you get 10000 Gold. I tried making a number var, but that didnt work, and i tried using, N as number, but i got an error for number being a bad input type. Can somone plz point me in the right direction?
thanx
Wizard of How
The Wizard of How wrote:
I was wondering if you could have a "Password" for a mob.
For Example:
turf
Jeremy
verb
Talk()
set src in oview(1)
switch(input("Would you like to guess my password?","Password")in list("Yes","No"))
if("Yes")
input("Whats the number?")
if("20")
usr.Gold += 10000
else
alert("Thats not right!")
if("No")
alert("K")

If you choose to guess the password, no matter what number you put in, you get 10000 Gold. I tried making a number var, but that didnt work, and i tried using, N as number, but i got an error for number being a bad input type. Can somone plz point me in the right direction?
thanx
Wizard of How
use switch(input("Blablabla")) on both inputs
input("Whats the number?")
if("20")
usr.Gold += 10000
else
alert("Thats not right!")


Well, the if statement will always return true because it's being counted as a text string, so that's your problem. Plus, you're not comparing it to anything. Use switch() here.
[EDIT:

While I'm at it, here.
mob/verb/password()
var/done
while(!done)
var/guess = input("See if you can guess my four-character long password!","Vortezz") as text
world << length(guess)
if(length(guess) > 4)
alert("I told you, it's only 4 digits long!","Vortezz")
else
if(guess == "rock")
alert("You win!","Vortezz")
usr.gold += 10000
else
alert("Wrong password!","Vortezz")
done = 1
     if("Yes")
input("Whats the number?")
if("20")
usr.Gold += 10000
else
alert("Thats not right!")


as far as this chunk goes, try rewriting it like this:

     if("Yes")
var/choice = input("Whats the number?") as num
if(choice == 20)
usr.Gold += 10000
alert("Correct!")
else
alert("Thats not right!")
In response to BurningIce
Thank you all for your input, I really appreciate it.
The always humble,
~Wizard of How