ID:2380617
 
(See the best response by LordAndrew.)
I have a issu with my movement i know that i need to put set instant = 1 to maybe fix the problem but i want to know how it work. like i just put set instant in my code or i need to do something else ?

i can show code if needed.
thanks you
Best response
It's hard to get a grasp at what your issue is without seeing some code. Could you please post it and describe the issue in more detail?
yeah sure the issu is that when i move it feel like i lag but it just not instant.

this is the code
Code:
    verb 
moveNorth()
set instant = 1
// set instant=TRUE
set hidden = 1
set waitfor = 0
var/GAME_MOB/p = usr
p.holding_key = TRUE
p.n_press = 1
p.dir = NORTH
/proc
movement(GAME_MOB/mob, var/dir, var/speed) ///move proc
set instant = 1
// set instant=TRUE
//set waitfor = 0
if(usr.cantmove==1) return 0
if(mob)
if(mob.holding_key)
if(mob.spin == TRUE || mob.moving == TRUE || mob.dead || mob.defending || mob.shop_open || mob.using_jutsu != null || mob.in_bind || mob.charging == TRUE || mob.CantMove == TRUE)
return
if(!speed)speed = mob.step_size
if(!dir)return
//mob.moving = TRUE
step(mob,mob.dir,speed)
if(mob.swimming)
mob.running = FALSE
mob.step_size = 12
// if(!mob.using_jutsu1 || !mob.using_jutsu2)
// mob.Run()
// mob.ActivateAI()
// CHECK_TICK()
//spawn(world.tick_lag)
//mob.moving = FALSE
//if(mob.holding_key)global.Movement(mob,mob.dir,speed)


client /// the client
North()
set instant = 1
var/GAME_MOB/M = mob
if(M.dead)return
if(M.in_bind == 1)
return
if(M.key_pressing == TRUE)
M.key_pressed = "Up"
M.JutsuPress()
return
M.dir = NORTH
return ..()
It looks like you're trying to stitch several systems together without really understanding what it is you need.

The set instant=1 line has no place in /proc/movement, because that isn't a verb. Nor does usr, for the exact same reason--usr has no place in a proc.

The client/North verb is already defined, so overriding its flags with instant=1 won't do anything IIRC. Also you don't want that to be instant at all.

The most reliable and smooth way to handle movement is with a move loop. This comes in three parts:

1) The client has a list of held keys and a current movement dir.
2) The client has a verb to handle keydiwn/keyup events and alters the list when that happens, then recalculates the move dir. This verb has set instant=1.
3) There is a global proc that runs in a loop and looks at each client, calling Move() on its mob if the client's move dir is set.
i already have a movement loop and i have a movement release too.but i did not know for the set instant go only with verb
i
Code:
        movementRelease() //verb
set instant = 1
// set instant=TRUE
set hidden = 1
set waitfor = 0
var/GAME_MOB/p = usr
p.holding_key = FALSE

northUp() //verb
set instant = 1
// set instant=TRUE
set hidden = 1
set waitfor = 0
var/GAME_MOB/p = usr
p.n_press = 0
if(!p.n_press&&!p.s_press&&!p.e_press&&!p.w_press)p.holding_key = FALSE
movementLoop() ///proc
// set instant=TRUE
set waitfor = 0
spawn()
while(world)
for(var/PLAYER/p in global.PlayersOnline)
if(p)global.movement(p,p.dir)
sleep(world.tick_lag)