Oh yeah! that atom/movable/Move() was part of an earlier suggestion i completely forgot about.
Yeah, my suggestion. :P But that isn't how it's supposed to be used. If you look at my originally posted sample code with the for() loop, the comments and all, you will see I commented that the 'step()' proc is a kind of shortcut for the Move(). So that's how you should of used it, not just sticking the proc path in the object definition.
Jp wrote:
Kaioken has some idea of what he's doing, but that code won't work. I'm surprised it compiles.
Eh? It does work perfectly well, and obviously, of course, compiles, there's nothing wrong with it - I even tested it, after he said he had problems with it, and it did work (as you can see above, he made 2 mistakes when adding it). Your code isn't that much of an improvement. Please don't accuse code to not work or be bad when YOU have no idea about it...
Added comments to your original code (directly after your comments, separated by another //).
> mob/npc //This type path can be the ancestor of all NPCs in the game. //Yes, ideally. I already offered him to make it like this; point remains he doesn't have his game structured like that.
> var/delay=10 //By default, NPCs will wait 10 ticks (approx 1 second) between each step. Change delay for individual NPCs to change that //Yes, but he didn't hint he wanted variable delays at all, and if he doesn'T, this is a waste of memory
> proc
> Wander() //All NPCs should have the Wander() proc
> while(src) // The line for() shouldn't do anything, as far as I'm aware. while(src) will keep looping while the mob exists.
/*'for()' creates an infinite loop, and is equivalent for 'while(1)'. from the DM reference entry for 'for()':
Init and Inc may be omitted. If Test is omitted, the loop will continue forever (unless a break, goto, or return instruction is used to get out of the loop).
Note that using 'while(src)' or 'if(!src) break' is pointless; when an object is deleted, all running procs that have it set as src are automatically stopped*/
> step(src,pick(NORTH,SOUTH,EAST,WEST)) //This line is fine
> sleep(delay) //This way, we can have a variable delay with different NPCs //see definition for delay var
> New()
> ..() //Always a good idea to call the parent proc //yep, it usually is. Not ALWAYS good and not always essential, though.
> spawn() Wander() //Call Wander(), make sure it's in a different call stack. Always good to make sure New() returns //Yeah, you should do this,though for now I omitted it to keep things simpler for the guy, he probably doesn't know about stuff this "deep" and may confuse him now.
> Old_Man //Defines an Old Man NPC
> icon = 'old_man.dmi'
> icon_state = "normal"
>
Well, i'm not sure where this argument is going, but... thanks, this works great now.