That would be nice... also can I have a short list on the basic mythruna functions like on
Let's call the Linux version the "command line version in Linux package form" just to avoid confusion.
If you download and unzip the linux version just like any other. Open a command prompt, change to the directory where it's installed and type:
java -XX:MaxDirectMemorySize=1024m -Xmx512m -jar Mythruna-20111017.jar
Note: you can also just copy the .sh file to a .cmd and remove the first line.
I'll have to follow up separately with details on the API. I've only added what I needed so if something exists then some script file somewhere uses it... even if it's one of the scripts embedded inside the mythruna.jar.
Quickly, though... the on() function attaches the {} bit of script to one or more events. There are various events like serverStarted, playerConnected, playerJoined, etc.. playerJoined and playerLeft are the only ones that work on both client and server.
so,
on( [playerConnected] ) {
type, event ->
// This code will be called whenever a player connects. type is the event
// type (always playerConnected in this case)
// event is the event data. Mostly you can ignore those.
// There are some variables available in scripts like this such as
// player - the player entity
// connection - only on the server, this is the network connection of the player
// playerData - only on the server right now, this is access to the data in the player's
// player database record. It has their stats, their characters (only one right now)
// the grants they have, last position on logout, etc.
// entities - access to the entity system
// console - console.echo() will echo things to the player's chat console in single or multiplayer.
// world - access to the world database
// ...and more that I probably should document separately.
}
And note: many of those "things" above are only available in the event scripts, ie: the code inside the {} and not in the outer raw script where you see things like:
println '------ water commands version:$Revision: 1473 $';
The .init script is run when the server/client starts and it attaches the {} sections to events to get run later. But at init time, obviously there is no player available, etc..
And are we legally obligated to call it groovy?
No. But leaving a groovy extension makes syntax highlighting editors play nice. Also, the scripting layer I use supports a variety of scripting languages (python, ruby, javascript, etc.) and I'd like to support them someday when I have time to better adapt the API to those languages (not worth doing until it's stable). And in that case, the groovy extension will be really important.
I suppose I could call the groovy ones "mythscript" or whatever to denote them as the standard way but considering the huge groovy community and all the work that has gone into that, it feels slightly pretentious.
~~~EDIT~~~
Also would it be hard to add a declaring function in mythruna, that would tell me what scripts were loaded or... does the Linux version do that?
I think when you run from the command line it prints the scripts that it is loading. Though you will also see printlns like above.
There is no way to get this list from within a script though it would be easy to add.