ID:155289
 
Hi all,

Probably a simple fix, but i'm a bit stuck with something at the moment. Essentially what I want, is when the user enters a room, if he hasn't been in there before, it will make the user walk to a location in the room. I've created a turf as the first tile the user enters when going into the room that should trigger the walk_to instruction, but it's not working:

turf
Daedalus
walkto
icon = 'Daedalus.dmi'
icon_state = "floor4"
name = "Cornel Saunders"
Entered()
if(usr.dbrief == 0)
alert("[usr.rank] [usr.name], you're just on time", "[name]")
walk_to(src,/obj/Daedalus/dbriefchair/,5,1)
usr.dbrief = 1

obj
Daedalus
dbriefchair
icon = 'Daedalus.dmi'
icon_state = "consolechair"


Here is a pic i've done so you can get an idea of what I want.

Photobucket

The other issue would be getting the user to face up once he has walked to the chair. Thanks in advance for any help offered :)


usr belongs to the caller of the proc while src to its parent. Your issue is actually this that you are trying to move the turf to the chair, since you are using src. Replacing it with usr will fix the problem.
In response to Hashir
Hmmm you mean this?
turf
Daedalus
walkto
icon = 'Daedalus.dmi'
icon_state = "floor4"
name = "Cornel Saunders"
Entered()
if(usr.dbrief == 0)
alert("[usr.rank] [usr.name], you're just on time", "[name]")
walk_to(usr,/obj/Daedalus/dbriefchair/,5,1)
usr.dbrief = 1

obj
Daedalus
dbriefchair
icon = 'Daedalus2.dmi'
icon_state = "consolechair"


I've just tried that, it pops up with the alert, but then does nothing...
In response to Jadwiseman
Hm..

Try using Entered(O), then walk_to(O,etc).
In response to Hashir
That doesn't seem to work either :(

turf
Daedalus
walkto
icon = 'Daedalus.dmi'
icon_state = "floor4"
name = "Cornel Saunders"
Entered(O)
if(usr.dbrief == 0)
alert("[usr.rank] [usr.name], you're just on time", "[name]")
walk_to(O,/obj/Daedalus/dbriefchair/,5,1)
usr.dbrief = 1

obj
Daedalus
dbriefchair
icon = 'Daedalus2.dmi'
icon_state = "consolechair"
In response to Jadwiseman
Sorry for not noticing before, but actually, I'm kinda sick.

Anyway, try using for() loop to check chairs in user's view() and then walk to them.
In response to Hashir
Sorry to hear that you're sick, thanks for helping anyway :).

Is there any chance that you could put what you just said into a code example using my code? i'm still learning at the moment and it's easy for me to get confused haha :)
In response to Jadwiseman
Example:

for(var/obj/chair/C in view())
walk_to(usr,C)



Read this for more info.
In response to Hashir
That's great! it works :D, thank you. One last thing though, is there a way to make the user face upwards once he reaches the chair?
In response to Jadwiseman
Jadwiseman wrote:
That's great! it works :D, thank you. One last thing though, is there a way to make the user face upwards once he reaches the chair?

Key to success.
In response to Hashir
Awesome! :D. I hate to bug you, but is there a way to make sure the user doesn't cancel the walk_to() instrution by pressing keys? at the moment if they press a directional key it kills the whole process
In response to Jadwiseman
Jadwiseman wrote:
Awesome! :D. I hate to bug you, but is there a way to make sure the user doesn't cancel the walk_to() instrution by pressing keys? at the moment if they press a directional key it kills the whole process

Yes, there is a way.

Just modify the built-in Move() proc and by using variables, you can control when the client is allowed to move.
In response to Hashir
Ah thanks very much, you've been really helpful :). Hope that you start feeling better
In response to Jadwiseman
No problem.