Jump to content

Groovy / Java Script Tutorial


Billy

Recommended Posts

I noticed that a few people have been complaining that the scripts have to be written in Groovy. Groovy is based on the Java Virtual Machine so that means that you can use the same syntax as you could with Java and place it inside the groovy file.

This simply means that you would take a normal Java Class file and create a regular script such as the demonstration below and you would simply change the extension on the file from .java to .groovy.

The downside of this is that you will obviously not be taking advantage of the additional features that Groovy has but Java does not.

The only file that needs to be a groovy file is that file that is a subclass of org.osbot.script.Script.



Below is the old tutorial beacuse I wrote it in two seconds.

 

This will be a simple short tutorial since people are complaining about how we have to write scripts in groovy and blah blah blah.

Groovy uses the Java Virtual Machine so obviously almost ALL Java syntax will work correctly with groovy.

Now basically what you will want to do is create a groovy file.

and have something like this inside of it

 

 

 import org.osbot.script.ScriptManifest;import org.osbot.script.Script; @ScriptManifest(name="ScriptTest", author="Billy", info="An awesome test script.", version=1.0d)public class ScriptTest extends Script {	@Override	public int onRun() {		return 0;	}}

 

You can use normal java syntax and create additional class files that are used inside of it.

The only file that has to be a groovy file is the file that is a sub class of org.osbot.script.Script otherwise it doesn't matter.

Sorry this is in a rush I'll add more to it later.

Edited by Billy
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...