Jump to content

Billy

Members
  • Posts

    15
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

846 profile views

Billy's Achievements

Newbie

Newbie (1/10)

1

Reputation

  1. Billy

    Polygon Area

    import org.osbot.script.rs2.map.Position; import org.osbot.script.rs2.model.Entity; import java.awt.*; /** * Created with IntelliJ IDEA * User: Anthony * Date: 3/23/2014 */ @SuppressWarnings("serial") public class PolygonArea extends Polygon { public PolygonArea(Position... positions) { super(retrieveXPoints(positions), retrieveYPoints(positions), positions.length); } public boolean contains(Entity entity) { return contains(entity.getX(), entity.getY()); } public boolean contains(Position position) { return contains(position.getX(), position.getY()); } private static final int[] retrieveXPoints(Position[] positions) { int[] xPoints = new int[positions.length]; for (int i = 0; i < positions.length; i++) xPoints[i] = positions[i].getX(); return xPoints; } private static final int[] retrieveYPoints(Position[] positions) { int[] yPoints = new int[positions.length]; for (int i = 0; i < positions.length; i++) yPoints[i] = positions[i].getY(); return yPoints; } } No idea why you extend polygon then use a local variable polygon. Also no idea why the hell my indents were removed when I pasted this here...
  2. 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.
  3. Looking forward to being able to script for this bot.
×
×
  • Create New...