Scripting Languages?

What good scripting languages are available that integrate well with Java?

I tried out BeanShell, but because scripts are interpreted, it’s not feasible for my game where every object is bound to a script. BeanShell has everything else I’d like though…

Java?

http://groovy.codehaus.org/

Groovy has a benefit of being more powerful than java in expresiveness (mainly thanks to closures support). Unfortunately it is only compiled statically or dynamically, with no option for interpreting - so if you plan very frequent reloads of same scripts, you will need to work around that.

BTW, AFAIK Beanshell 2.0 has support for compilation of scripts.

[quote]Java?
[/quote]
Everytime scripting comes up someone says this but I’ve yet to see an example of how to do it. Guess I don’t have enough imagination or something…

There are lots of ‘jvm languages’ (google) JLua, Jython, Javascript (rhino). I’ve used rhino and i liked it. I haven’t done a project with extensive scripting yet so I don’t know how it would perform. Most people here say good things about beanshell.

I use DynamicJava which is great because it simply interpret pure Java code :slight_smile: !
So you make scripts in Java language…

http://koala.ilog.fr/djava/

Chman

[quote]Everytime scripting comes up someone says this but I’ve yet to see an example of how to do it
[/quote]
http://java.sun.com/developer/JDCTechTips/2003/tt0722.html#2

[quote]I use DynamicJava which is great because it simply interpret pure Java code :slight_smile: !
So you make scripts in Java language…

http://koala.ilog.fr/djava/

Chman
[/quote]
OK, speaking as an ignorant person here, I’m struggling to find ways that Dynamic Java is anything but an inferior version of beanshell. What am I missing? (I’ve been through the docs and the website etc - noticed a few minor differences e.g. use of multiple package statements in one source…although, TBH, those sound like mucking about rather than a useful feature???)

!!!
;D

Thats pretty cool. But that example sucks because it writes the source to a file then compiles it.

Hehehe, cool :slight_smile:

I’ve been wondering about this forever…

There is a big difference between DJ and beanshell 1.x - in DJ you are able to define new classes, while in beanshell you are just able to implement interfaces using Proxy. AFAIK, in beanshell 2 you have full support for compilation, including defining new classes - so it is a superset of DJ (but DJ is not longer actively developed, is it ?).

Anyway, DJ allowed you to define classes few years before beanshell - and this was a reason for it to exist :slight_smile: Currently, it can probably die silently, forgotten in depths of internet.

For me, there are two scripting choices: Beanshell if you want something small and easy, and Groovy, if you want something with all kinds of expresiveness possible to scripting.

[quote]http://groovy.codehaus.org/

Groovy has a benefit of being more powerful than java in expresiveness (mainly thanks to closures support). Unfortunately it is only compiled statically or dynamically, with no option for interpreting - so if you plan very frequent reloads of same scripts, you will need to work around that.

BTW, AFAIK Beanshell 2.0 has support for compilation of scripts.
[/quote]
It said that on the site but he provided absolutely no documentation for that. I also asked on this site a few weeks ago and nobody answered. Could you point in the right direction for this?

I too asked this a while back a s friend wanted me to build him a mud that he could then as joe immortal, go in and type out scripting and add functionality to the mud, not just content. I will have to review the link above in detail.

pnuts

http://www.beanshell.org/bsh20announce.txt

Documentation on the site is still 1.3, so you need to diff it in your head with info inside announce file.

…although BSH has been at v2 since 2003. Pat (the author) seems to be of the old school of diligence - something that works almost perfectly is marked “beta” until it’s had a year to settle down ;).

e.g. we’ve been using bsh-2 beta in production environments almost since it came out - no errors. There are some significant bugs, but the kind of thing you’d often see in a gold release of normal software (and thankfully not affecting anything we’d been doing with bsh to date…)

Thanks for the explanation; makes sense now :).