ID:160597
 
I've seen a few games where to train, the game gives you a direction to push and you have to press that direction, and then it gives you another direction. So on and so forth.

Is there a tutorial (I've looked, but couldn't find one), or could someone tell me the basics of how to do this?
mob/verb
Test()
usr.canmove=0
:freedom
var/direction = rand(1,4)
if(direction==1)
usr<<"<font color=blue><font size=2>Up"
else if(direction==2)
usr<<"<font color=blue><font size=2>Down"
else if(direction==3)
usr<<"<font color=blue><font size=2>Left"
else if(direction==4)
usr<<"<font color=blue><font size=2>Right"
sleep(20)
if(direction==1&&usr.dir==NORTH)
usr<<"<b><font color=blue><font size=2>Good</b>"
goto freedom
else if(direction==2&&usr.dir==SOUTH)
usr<<"<b><font color=blue><font size=2>Good</b>"
goto freedom
else if(direction==3&&usr.dir==WEST)
usr<<"<b><font color=blue><font size=2>Good</b>"
goto freedom
else if(direction==4&&usr.dir==EAST)
usr<<"<b><font color=blue><font size=2>Good</b>"
goto freedom
else
usr<<"<font color=blue><font size=2>Phail"
usr.canmove=1




M'kay, this was what I was able to come up with. I don't want the mob to move, but I still want directional ability. Does that make sense? >_>
In response to BUProductions
You should override the client/North(), client/South() etc procedures. Look them up. You can then hook into it when a player sends a directional-movement command, and prevent actual movement taking place (if you don't call ..() to do the default action, then they'd end up not moving).

Among the other things you really should do are, as well:
--Search the forums first before making new topic. This, as well as most thread topics, have been discussed and answered before more than once.
--Pretty much, never use goto. If you need to loop, use a looping construct. goto just leads to ugly, bad code.
--Close all of your HTML tags, even if it's in a BYOND output.
--While on the same subject, you don't need multiple <font> tags for multiple attributes. You can put them together in one tag: <font color=blue size=2>TXT</font>
--Use switch() instead of a simple chain of else-if()s. It's easier (ultimately shorter code to type) and much more efficient.

No offense intended if it looks that way. Advice intended. =P
In response to Kaioken
^^ look in code problems i was looking for the same thing and the guys there helped alot, look for post by me and their replies, u just got to edit wut they say a little and bam ur in business
In response to Matthewg11
Ahm, I'd prefer readers to read posted code and enrich their knowledge and then rewrite their own as needed rather than just copy and modify it, but that works as long as the code is suitable (if it's an example, it may not be) and they do read and understand it first instead of copying it blatantly, provided we don't hear about it later (always ironic to see someone copy and use code he doesn't understand then later create a Code Problems topic when he has issues :D). >_>