Wednesday, June 27, 2012

First Script

Weapon M ran its first scripts this week. It's still not very useful, as the only event a script can register for is a major prompt. But the foundation has been laid.

I'm using Brian Clapper's Java Utility Library to find and load scripts. It saved me a lot of work finding classes and building a class loader from a user-supplied classpath. I'd recommend using it in any application that needs to load plugins.

So far, the Scripts menu provides the only means of loading and unloading scripts or seeing what scripts are loaded. Each script found in the script classpath is associated with a JCheckBoxMenuItem, which is checked when the script is loaded. I like the elegant simplicity of this interface, and I think I'll keep it even after I add a more comprehensive script control center.

Scripts will eventually be able to add configuration options to the control center. There will also be a simple means by which a script can display an options dialog each time it is loaded, similar to SWATH's Parameter system. More advanced scripts can display their own custom Swing dialog.

There will be no arbitrary limits to what a user script can do. All the helper's stock scripts, like auto-haggle and basic cashing and building scripts, will be built on the user script system. Weapon M will truly be the master scripter's ultimate weapon.

No comments:

Post a Comment