ID:264516
 
Code:
client/Center()
for(var/atom/a in get_step(src.mob,src.mob.dir)) //look for an atom they're facing, this loop fails for some reason and nothing past it happens
src<<"A" //test message. This doesn't get displayed.
a.Action(src.mob) //this also doesn't happen, but I thought that might be obvious due to the above test message not happening either.
atom/proc/Action(atom/a)
turf/tester
Action(atom/m)
m<<"It worked!"


Problem description:
Nothing after the for() loop in Center() happens, it just... cancels, or something.


Get step returns a turf, so you're looping through the contents of the turf. My guess is that the turf doesn't have anything in it.
In response to Skyspark
That didn't really make much sense. Where, exactly, am I looping through the contents of the turf (or obj or another mob...)? I'm trying to find an (a)tom (a is in parenthesis because I'm obviously not looking for an area >_>) that the client's mob is facing.
> client/Center()
var/turf/T = get_step(src.mob,src.mob.dir)
T.Action(src.mob)
> for(var/atom/a in T) //look for an atom they're facing, this loop fails for some reason and nothing past it happens
> src<<"A" //test message. This doesn't get displayed.
> a.Action(src.mob) //this also doesn't happen, but I thought that might be obvious due to the above test message not happening either.
> atom/proc/Action(atom/a)
> turf/tester
> Action(atom/m)
> m<<"It worked!"


Like SkySpark said, get_step returns a turf. You were checking a turf's contents for the turf itself which wouldn't work obviously.

So you need to trigger the Action proc on the turf itself and then check for atoms in it if you want to do so.
In response to Vic Rattlehead
client/Center()
world<<"Center"


Try getting that to work because its failing for me. x3
In response to Chowder
Sarcasm. Nice.
In response to Vic Rattlehead
No joke. No matter how many times I try it wont work for me. x.x
Although it works fine if I macro center to another key o.o


I think its not working because get_step is returning the turf because the turf is not in itself it is failing.

client/Center()
world<<"Center"
var/atom/B=get_step(src.mob.loc,src.mob.dir)
B.Action()
atom/proc/Action()
turf/tester
Action()
world<<"WABAM"

Here's the evidences :o
In response to Chowder
After thoroughly re-reading my previous code and what Skyspark said, it made sense. for(var/atom/a in get_step(...)) is looping through the turf/whatever I'm facing for an atom inside it.
In response to Vic Rattlehead
Or you could have, you know, checked my post that was made about 20 minutes ago. [link]