ID:178110
 
im trying to make a grind for skate, to do this i have started by making turfs for every direction, because i belive it will be easier to make a grind that works in only one direction
This is my code so far its for a horizonal going right.

railright
icon = 'Characters.dmi'
icon_state = "GrindR"
density = 0
Entered()
if src.icon_state = "Ollie"
set src.icon_state = "50-50"
usr.move =0 //the referance file says that this should make it stop yet it doesnt seem to
walk(1,WEST,Lag=0.1) // it claims there is only 1 argument
...()
any help please?
Never put usr in Entered(). turf.Entered() takes two arguments: The atom that entered, which is not necessarily the same as usr, and the atom's old location. Usually the second argument is ignored, but there's almost no use for Entered() that would ignore the first.

Lummox JR
In response to Lummox JR
so how could i do this without using usr? src instead?
In response to mazarot
mazarot wrote:
so how could i do this without using usr? src instead?

No, src is the turf.

Again, Entered() takes two arguments, the first of which is the atom that entered. That's what you need. Look up Entered() in the reference.

Lummox JR
In response to Lummox JR
so it would be like
Entered(turf)
?, cos i dont get the reference, im trying :)
In response to mazarot
mazarot wrote:
so it would be like
Entered(turf)
?, cos i dont get the reference, im trying :)
turf
Entered(atom/movable/A)
...

Lummox JR
In response to Lummox JR
Your logic seems a little fuzzy after I looked up Entered() in the reference. The very first example they post looks like so:

turf/pit
Entered(O)
usr << "OUCH. You fell in a pit!"

Now, I do not know why it is that you say that nobody should EVER use usr in Entered(), but if Dantom does it, I don't see what's fundamentally wrong with it. For my sake, could you clarify?

-LoW
In response to Lord of Water
Lord of Water wrote:
Your logic seems a little fuzzy after I looked up Entered() in the reference. The very first example they post looks like so:

turf/pit
Entered(O)
usr << "OUCH. You fell in a pit!"

Now, I do not know why it is that you say that nobody should EVER use usr in Entered(), but if Dantom does it, I don't see what's fundamentally wrong with it. For my sake, could you clarify?

This is obviously a flaw in the reference. Thanks for pointing it out, though, because I'm sure they'll want to fix it. The problem in this particular example is that the message should be sent to O, not usr.

The reason why you should never EVER use usr inside Entered() is because usr isn't necessarily the thing that used Move(). You could call Move() to move around another item, or it would be called if a monster walks around or if an obj is moved. The value of usr is going to be the last player who provided input to the game, via a verb or a mouse proc or some such. I believe that from a verb it should remain stable even if you sleep(), but in outside procs (not called by a verb or anything) there's just no guarantee what usr is going to be.

So, using usr in Entered() will only work for you if you play a single-player game with no monsters or objs moving about. Obviously this might be the case for many a game in single-player testing, but will fail in multiplayer--and not necessarily in a way that's easy to figure out.

Lummox JR