ibot script skeleton

From WebHostingNeeds.com
Jump to: navigation, search

A public class makes it a class and then, you could compile it into a class file to be used by the java machine.

It would look like something like this.

First you start with a class body.

public class ClassNameHere
{

} 

Then you add a a extends keyword to the ColorScript class identifying this script as a script and usable by neXus also giving you TONS of methods at hand ready to use. Note: If you want your script to use paint, which is basically for posting progress reports, add an implements AutoPaint

public class ClassNameHere extends ColorScript implements AutoPaint
{

} 

Then followed by a constructor which is basically a method that's called when you do new ClassNameHere(parameters..); Don't forget the ColorBot.

public class ClassNameHere extends ColorScript implements AutoPaint
{

	public ClassNameHere(ColorBot c)
        {
		super(c);
	}
	
} 

Then add the unimplemented methods in there that you have to add in order for it to compile and work.

//imports
public class ClassNameHere extends ColorScript implements AutoPaint
{

	public ClassNameHere(ColorBot c)
        {
		super(c);
	}
	
	public void script()
        {
		try
                {
			//What the script does here..
		}
                catch(Exception e)
                {
			log(e.getMessage());
		}
	}
	
	public void paint(Graphics g)
        {
		//How the paint will look like..
		//Do
		//g.drawString("Tutorial", 15, 15);
		//That will draw and make it say
		//Tutorial on the pixel located at 15, 15
	}
	
} 

Congratulations! You have a script skeleton!


Complete iBot neXus Scripting Tutorial by Durenir, Updated by Chen (Monopoly)

ibot