Indeed, you'd use the function add_event / set_event to create / modify the events. For example:
add_event('e0', 'Time > 30', [['X', '10']]);
Here a new event 'e1' is created that Fires immidiately after time reaches 30 and sets X to 10. So here we use name, trigger expression and event assignments. Additionally delay expressions and priority expressions could be used [1]. If you have a specific event in mind I could give you the basico code for that.
best
Frank