Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Help Requested]First Script; Goblin Killer

Featured Replies

Hello friends!

 

I am trying to write my very first script, yay! I have successfully built the script so that it will locate the closest Goblin and attack. Now, I am trying to add a feature where it will check the loot dropped by the Goblin after it is killed and pick up 'x' item.

 

Here is my current Source Code:

 

import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;
import java.util.Random;

@ScriptManifest(name = "GoblinKiller", author = "WindPower", version = 1.0, info = "", logo = "") 

public class Goblin extends Script {

    @Override public void onStart() {
    		log("Welcome!");

    		   }

    Random rand = new Random();

    @Override public void onExit() {

        //Code here will execute after the script ends

    }
    @Override public int onLoop() throws InterruptedException {

    	NPC goblin = npcs.closest("Goblin"); // Looking for closest goblin
    	if((goblin !=null) && (!myPlayer().isAnimating()) && (goblin.isAttackable())){ //if goblin exists & character is not animating
    		goblin.interact("Attack"); //attack the goblin
    		if(myPlayer().isUnderAttack()) {
    			Position place = goblin.getPosition();
    			   			
    			
    		}
    		
    	}
    	return rand.nextInt(5000) + 1000; //The amount of time in milliseconds before the loop starts over

    }

    @Override public void onPaint(Graphics2D g) {

        //This is where you will put your code for paint(s)

    }

}

 

I believe that I have properly coded & nested this statement to get the current location of a goblin that is currently being fought

if(myPlayer().isUnderAttack()) {
    Position place = goblin.getPosition();
    			

I am just not sure from there how to check that spot upon the goblin's death in search of a specific item(or if there is a better way to do this altogether).

 

Currently: V1.0

  • Attacks Goblins

 

Coming Soon:

  • Pick Up Loot

 

 

Any thoughts are welcome, this is my very first script. I am grateful for any tips or suggestions.

Thank you so much. :)

Edited by WindPower

  • Author
9 hours ago, Juggles said:

Thank you, I've been looking through the API; I'll just have to spend some more time fiddling around with this. I've played around with the basics of the language, but classes and objects and inheritance are all new to me, so I keep getting lost in all the different methods, constructors, etc.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.