ID:140168
 
Code:
mob/verb/challenge(mob/M)
if(src.ingame == 0)
if(M.ingame == 0)
M << "<b>Info</b>:<i>[src] has challenged you to a duel</i>."
sleep(10)
var/response
input(M,"Do you accept","[src] has challenged you to a duel",response) in list("Yes","No")
if(response == "No")
src << "<b>Info</b>:<i>[M] has Declined the challenge.</i>"
return
if(response == "Yes")
src << "<b>Info</b>:<i>[M] has Accepted the challenge. You have 30seconds to equip before the fight.</i>"
M << "<b>Info</b>:<i>You has Accepted the challenge. You have 30seconds to equip before the fight.</i>"
sleep(200)
src <<"<b>Info</b>:<i>10 seconds left...</i>"
M <<"<b>Info</b>:<i>10 seconds left...</i>"
sleep(100)
battle(src,M)


Problem description:
doesnt do anything neither shows any messages
itss meant to let you challenge someone and then if u accept or not it will continue.
You are not actually using the result of that input() call in any way. Look it up in the Reference.
In response to Garthor
yet it still doesnt work. it doesn't even send the message saying you have been challenged by [src]
In response to XnathanielX
Reread Gathor's statement, this is what you are doing
var/result = null
(input result returned here, not used/stored anywhere)
if(result... which is still null since you didn't define what its new value is)


As for the message not being sent... are you sure that variable equals 0? Not null, not "" but 0 (because that is what you are looking for).
In response to GhostAnime
ah thanks it was actually not setting it to 0. i thought null would auto make it zero =/
In response to XnathanielX
null is null, not a numerical value of 0.

Remember that == looks for a specific value.

Now if you wanted to look for the three FALSE values in BYOND (which are 0, null and "" [FALSE is 0 as well]), you can do this:
if(!var)
world << {"This variable contains a FALSE value (either 0, null or "")"}

if(var)
world << "This variable contains a TRUE value, any value except for the false values"


var/test = 0
if(test)
world << "This is TRUE"
else
world << "This is FALSE" // This will be outputted

var/dance = 1
for(var/i = 1 to 10)
world << "Step [dance?"in":"out"]"
dance = !dance // alternates between 1 (TRUE) and 0 (FALSE)


If you are wondering what X?Y:Z is about, think it as a mini-if statement.

X?Y:Z

// Same thing as saying

if(X)
Y
else
Z

world << "Hi there " + (src.name == "John" ? "John" : "Impostor") // If your name is not john, you're an Impostor!