More info on built in events in PulpScript docs

Hello, I think it would be beneficial to have more information in the documentation on the default behavior of events that can be overloaded when using pulpscript. It seems that a user overloads a default event, it's important to know what behavior they're getting rid of and how to reimplement it if they are overloading the event for reasons other than getting rid of/changing that particular behavior.

A relatively low impact issue that can arrive from this not being addressed comes from the collect event. It may seem obvious that when an item is "collected" it will disappear. But a user who goes to overload the collect event won't necessarily know how this is achieved, so if they overload collect to add an additional thing that will happen when an item is collected, they may find themselves at a loss as to reimplement the original behavior of collect.

Another example that's less obvious to figure out(at least for me, having not figured out the behavior yet) is the start event. The documentation only says

called once on the game after all rooms and tiles have handled their load event

Upon reading this, I was under the assumption that it would be safe to write the following code block in the game script

on start do
  tell 5,5 to
    call exampleEven
  end
end

In the event that I do this, the web player launches in an unresponsive state, and the console reads

Uncaught Error: Fatal: Unable to get tile, no room is currently loaded (game:29)
    at fatal (bridge.20ddbbb4794f.js?timestamp=1639159046:75)
    at getTile (runtime.40fddf6b45da.js?timestamp=1639159046:727)
    at Object.ActionTell [as tell] (runtime.40fddf6b45da.js?timestamp=1639159046:1150)
    at doAction (runtime.40fddf6b45da.js?timestamp=1639159046:1646)
    at Object.ActionBlock [as block] (runtime.40fddf6b45da.js?timestamp=1639159046:945)
    at doAction (runtime.40fddf6b45da.js?timestamp=1639159046:1646)
    at doEvent (runtime.40fddf6b45da.js?timestamp=1639159046:1662)
    at onDataReady (runtime.40fddf6b45da.js?timestamp=1639159046:2324)
    at loadData ((index):661)
    at (index):702

This behavior is fine, according to the console "no room is currently loaded" so of course I can't tell a tile to do anything. The issue here is that the documentation not only leads you to believe that the start event only occurs once everything is loaded, leading me to assume I can safely use it to perform an actions in the state where my game is ready to start, once you've figured out that is not the case, but it also doesn't provide any info on what needs to be done in the start event(or perhaps after the start event) that we've overwritten(or jumped in before).

I think specific information on exactly what happens in each overloaded event would help a lot when it comes to knowing which events to overload when. Thank you for taking the time to read this!

3 Likes