Wednesday, November 25, 2015

Scripting

Just had to post a screenshot of my first successfully executed script within the game:

The script was 'showMessage("It worked!");'.  Not very exciting, but it felt pretty good to see it work.
This was executed by building a node over a hotspot.  The scripting language I'm using is Lua via NLua, which wraps around Lua to make it more accessible to .NET.  There is currently only one method within Sever available to Lua: showMessage(string message).  But that's just fine.  The hardest part is behind me.  The next feature I might add to the scripting is the ability to switch to another map.

This is my first experience with scripting, so we'll see how it goes.  Hopefully I don't botch it.

Something tedious ahead of me that I'm not really looking forward to is building upon my current TextBox class to make it support multiple lines.  I have a script editor window with a big textbox, but you can only stay on one line (that's a lot of wasted space).  But I'm not sure if I'll do that now or wait until I have a script that needs it.  We'll see.  In the meantime, I might just add a way to run a script from a file.  That might hold me over.

Anyway, just wanted to share my victory.  Thanks for reading!

clevceo

No comments: