More sprintf removal and align episodic events

The plan is to implement a functional version of ApeScript where the
states and events trigger functions to be called if they are
implemented through ApeScript.