mob
var/tmp/list/DKeys = list()
var/tmp/list/Keys = list()
Login()
..()
winset(client, "north", "parent=macro;name=north;command=keydown+north")
winset(client, "north+up", "parent=macro;name=north+up;command=keyup+north")
winset(client, "west", "parent=macro;name=west;command=keydown+west")
winset(client, "west+up", "parent=macro;name=west+up;command=keyup+west")
winset(client, "south", "parent=macro;name=south;command=keydown+south")
winset(client, "south+up", "parent=macro;name=south+up;command=keyup+south")
winset(client, "east", "parent=macro;name=east;command=keydown+east")
winset(client, "east+up", "parent=macro;name=east+up;command=keyup+east")
winset(client, "T", "parent=macro;name=T;command=keydown+Shoot")
winset(client, "T+up", "parent=macro;name=T+up;command=keyup+Shoot")
spawn move_loop()
spawn skill_loop()
proc/move_loop()
set instant = 1
if(KB || Actives["Gathering"] || Actives["Meditate"] || Actives["Train"] || Talking)
goto restart
if(world.time >= move_time)
if(!step(src, (DKeys["South"] && (SOUTH || DKeys["South"])) | (DKeys["North"] && (NORTH || DKeys["North"])) | (DKeys["West"] && (WEST || DKeys["West"])) | (DKeys["East"] && (EAST || DKeys["East"]))))
if(!step(src, (DKeys["South"] && (SOUTH || DKeys["South"])) | (DKeys["North"] && (NORTH || DKeys["North"]))))
step(src, (DKeys["West"] && (WEST || DKeys["West"])) | (DKeys["East"] && (EAST || DKeys["East"])))
restart
spawn(world.tick_lag) move_loop()
proc/skill_loop()
set instant = 1
if(Keys["Shoot"])
Shoot()
spawn(world.tick_lag) skill_loop()
verb/keydown(k as text)
set hidden = 1
set instant = 1
if(k == "north") DKeys["North"] = 1
if(k == "west") DKeys["West"] = 1
if(k == "south") DKeys["South"] = 1
if(k == "east") DKeys["East"] = 1
if(k == "Shoot") Keys["Shoot"] = 1
verb/keyup(k as text)
set hidden = 1
set instant = 1
if(k == "north") DKeys["North"] = 0
if(k == "west") DKeys["West"] = 0
if(k == "south") DKeys["South"] = 0
if(k == "east") DKeys["East"] = 0
if(k == "Shoot") Keys["Shoot"] = 0
When I try to use them both at the same time my character stops, shoots and then moves. What am I doing wrong here?
Should be like this:
if(k == "Shoot") Keys["Shoot"] = 0
EDIT:
Couldn't u just do something like this:
you could check in the player's movement built-in proc if the Shoot key is pressed. If it is then the player shoots
You shouldn't be using goto and perhaps you would want to make the keydown/keyup procs instead of verbs (but that is my personal opinion, there is no problem leaving them as verbs I just think that it would be cleaner and more efficient)