On loop stopped working

I started learning Pulp a few days ago on my laptop, but when I started working on my project on my desktop the on loop PulpScript event stopped working. I've tried using on loop on the player and on different item tiles, and with nothing but a log statement in it, but it seems like it's just not being called at all. Is there a setting or anything that I should change to fix this?

I'm also not using "say" or "menu" at all, which seems like the only things that would block loop according to the documentation.

I was working more on my project after posting this but I think I reloaded the browser tab and now it seems like all my progress from today has been erased. Is there any way I can get it back? I definitely clicked the save button and ran the player a lot more recently than where it's at now.

For whatever it's worth, on loop is not working on my laptop anymore either.

I found kind of a workaround by putting "emit 'loop'" in the player tile's on draw event handler. That's definitely not how the engine is supposed to work though, right? How do I fix this?

The loop event is only called on the "game" script, not on other scripts, so you do need to manually call it on players and tiles from there, eg.

on loop do
  tell event.player to
    call "loop"
  end
  tell event.room to
    call "loop"
  end
end

(Typing from memory here...)

Personally I tend to use a slightly different event name when calling other scripts like this, to keep things clearer as well, such as "game_loop" to indicate it's the loop event being fired by the game script.

I'm not sure about the state of your browser though, I'm afraid. I've heard of others experiencing similar things, but not encountered it myself. Yet.

1 Like

Oh thank you so much!Yes it works if it's in the game script.

1 Like

Great! Glad to hear it worked. For reference, you can see which scripts can handle which events in their entries at Playdate PulpScript - I find myself checking this quite a bit still :slight_smile: