Interpreter commands as in:
class Interpreter
def add_text(string)
# fancy code
end
end
Cuz yeah, I'm going to do that. The way I did this is just load the commands into an array and fire them off one-by-one depending on the window's state:
MSG_IDLE = Nothing is happening. You can't see the message window at all.
MSG_RUN = Force the window to update and perform its commands.
MSG_DRAW = Currently drawing text.
MSG_WAIT = Stops the window from firing off the next command.
MSG_SWAP = Same as WAIT but this only occurs when the face graphic or the window itself are sliding on/off screen.
The instance you call 'add_text', the window will be put into the MSG_RUN state. On the next frame, Graphics.update is called, which in turn calls this window's update method. I use Array#shift to get the first command. If the command is a string, I can go right on ahead and draw the text. If it's an Array, I call another method that evaluates the array's contents, similar to how RMXP's Interpreter 2 works. From there, it's nothing but a bunch of other methods being called and variables keeping track of the animations (i.e. animation frame counters, if moving up/down, if closing window).
The main reason I aliased Graphics#update is so that I could create a global instance of this object and make calls to it regardless of the scene. And also to make it easier for development, not having to worry about creating an instance, having to remember to update it, etc.