Skip to content
Grinch_ edited this page Mar 25, 2022 · 2 revisions

Events are a form of a callback function. When a certain event is triggered ( game start, script termination, etc ) the appropriate function for that gets called.

A common example would be the script termination event. Whenever your script is terminated ( error or exit ), this event is triggered. You can handle any necessary cleanup from there.

import libstd.common as common

# Can be used for necessary cleanup
def on_script_terminate(error_occured: bool):
	if error_occured:
  		print("Script terminated")
	else:
		print("Script exited")

while True:
	if common.key_pressed(0x09):
		break

	common.wait(0)

A full list of events is available here.

Note: Game opcodes may not be called from all events. This is currently a bug and will be dealt with later.

Clone this wiki locally