ID:140357
 
Move Question
Code:
mob
Move()
..()
sleep(05)


Problem:
The user doesn't move...at all...

Contacting Admins Question
Code:
mob/verb
ContactAdmin()
input("Please only use this as a last resort!","Continue?","Back")in list("Continue","Back")
if("Continue")
var/tmp/question = input("Enter question:")
for(var/mob/M in admins)
M << "<font color=yellow>QUESTION\nKEY:[usr.key]\nNAME:[usr.name]\n[question]"
if("Back")
return


Problem:
1) Even when they select "Back" it still asks them to enter their question.
2) It doesn't send the message to any admin...


Please help! Thanks!!
Hi1 wrote:
Move Question
Code:
> mob
> Move()
> ..()
> sleep(05)
>


Check to see that you don't override Move() elsewhere. Also, get rid of the 0 in front of your 5, and get out of the habit of prefixing numbers with zeros. This is interpreted in the compiler as an octal number, meaning:
world << 05   // 5
world << 010 // 8
world << 08 // error: bad number


Contacting Admins Question
Code:
> mob/verb
> ContactAdmin()
> input("Please only use this as a last resort!","Continue?","Back")in list("Continue","Back")
> if("Continue")
> var/tmp/question = input("Enter question:")
> for(var/mob/M in admins)
> M << "<font color=yellow>QUESTION\nKEY:[usr.key]\nNAME:[usr.name]\n[question]"
> if("Back")
> return
>

input() returns a value. You don't do anything to store that value anywhere.

if(x) tests if x evaluates to a true value (not null, zero, empty string) and, if so, executes its corresponding block of code. Here, x would be your "Continue" string which is neither null, zero, or an empty string, and so the block of code belonging to it will always be executed. Incidentally, this also applies to if("Back").

If you want to test the result of input(), you should store its return value in a variable and test against that. If you have further questions, read the DM Guide.
In response to Kuraudo
Kuraudo wrote:
If you want to test the result of input(), you should store its return value in a variable and test against that.

Or based on the syntax he's using, encase the input() in a switch() and indent the if statements. (Which I assume is what he was actually attempting to do, but forgot to use switch() and proper indentation.)

And considering if("Back") does nothing but put a return statement, it can be omitted completely.