Sample

Simple Setup

string testScript = @"
*This is a comment.
(0:0) when the script is started,
		(5:0) print {Hello World} to the console.
";
Monkeyspeak.MonkeyspeakEngine engine = new Monkeyspeak.MonkeyspeakEngine();
Monkeyspeak.Page page = engine.LoadFromString(testScript);

page.SetTriggerHandler(new Monkeyspeak.Trigger(Monkeyspeak.TriggerCategory.Cause, 0), delegate { return true; });

page.SetTriggerHandler(new Monkeyspeak.Trigger(Monkeyspeak.TriggerCategory.Effect, 0), delegate(TriggerReader reader){
    Console.WriteLine(reader.ReadString());
    return true;
});
//Execute every block containing (0:0)
page.Execute(Monkeyspeak.TriggerCategory.Cause, 0);

Last edited Feb 24, 2012 at 4:17 AM by Squizzle, version 5

Comments

No comments yet.