Script System?

Hey, I wanted to know if anyone could recommend me a scripting system or tell me how to accomplish this. Here are the things I need:

  • run Strings - I save a lot of procedures in XML files that describe concrete instances of classes (i.e. I have the Class “Weapon”. I use a self-made editor to create a magical sword that has a script attached which increases the player’s strength by 10. I serialize that to a file and load it dynamically ingame (possibly multiple times in order to get more instances). This achieves easier editing (And I tell ya: I HATE hard code)
  • Change variables from the non-script part, call methods from the non-script part. I have to do this because, even if I don’t like hardcoding, there are system-important things. For example: If I softcode damage/health, I somehow still have to invoke methods on how to handle death. Those are hard coded.

Java has a builtin engine for Javascript (although it is terribly slow). Other languages such as groovy, ruby, python is also easy embeddable and can be used to script java.

Here is some information regarding scripting in java:

Your best bet will be to look at the existing scripting solutions available for Java, find one you like, use that.


Be aware that allowing users to make/distribute this stuff for other players to use is a massive security hole for them. (It’s fine if you are the only on distributing scripts, although you should still be aware that that makes your game easier to hack…if that is something that bothers you).

ok, I already saw the jscript one but kinda didn’t realize you could put local variables - that was my main problem (more or less)
regarding security - no trouble, I’m going to encrypt the files for deployment.