Thanks for your replies...
Writing a plugin is a little too advance at the moment.
I have found a solution - pass variables between HTML and C2 using javascript. The variables values will be the commands.
Then I can use TextBox.onTextChange event and Textbox.comparevalue to initiate further actions within the game.
Example is shown here to pass data to and from HTML and C2 (using javascript):