You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a pulpscript recursive call (to make some tiles slippery), like this:
on pSlip do
x = event.px
y = event.py
mSr = type x,y
if mSr=="item" then
x += event.dx
y += event.dy
ignore
wait 0.1 then
mSr = type x,y
if mSr!="item" then
mSr = name x,y
if mSr=="floor" then
mSr = "item"
end
end
listen
if mSr=="item" then
remaining++
goto x,y
call "pSlip"
end
end
end
end
After being processed with pulp-to-lula, it doesn't work correctly. The player tile moves through the slippery tiles, but its x,y coordinates are then reset to first tile.
After looking and debugging with the simulator, it looks like it can be possible that something about the wait call may cause to change player.x and player.y coordinates, between the call to smoothMovementBegin and smoothMovementEnd, when PTLE_SMOOTH_MOVEMENT_SPEED is 0.
I have found a possible solution changing the code of smoothMovementEnd from
local function smoothMovementEnd()
local player = pulp.player
player.x = pulp.smooth_true_x
player.y = pulp.smooth_true_y
pulp.PTLE_SMOOTH_OFFSET_X = 0
pulp.PTLE_SMOOTH_OFFSET_Y = 0
end
to
local function smoothMovementEnd()
local player = pulp.player
if pulp.PTLE_SMOOTH_MOVEMENT_SPEED > 0 then
player.x = pulp.smooth_true_x
player.y = pulp.smooth_true_y
end
pulp.PTLE_SMOOTH_OFFSET_X = 0
pulp.PTLE_SMOOTH_OFFSET_Y = 0
end
but i'm not totally sure that it's a good solution (i'm a newbie to lua language).
The text was updated successfully, but these errors were encountered:
kounch
changed the title
Race condition when calling from within a "wait"
Race condition when calling "goto" from within a "wait"
Nov 15, 2022
I have a pulpscript recursive call (to make some tiles slippery), like this:
After being processed with pulp-to-lula, it doesn't work correctly. The player tile moves through the slippery tiles, but its x,y coordinates are then reset to first tile.
After looking and debugging with the simulator, it looks like it can be possible that something about the wait call may cause to change
player.x
andplayer.y
coordinates, between the call tosmoothMovementBegin
andsmoothMovementEnd
, whenPTLE_SMOOTH_MOVEMENT_SPEED
is 0.I have found a possible solution changing the code of
smoothMovementEnd
fromto
but i'm not totally sure that it's a good solution (i'm a newbie to lua language).
The text was updated successfully, but these errors were encountered: