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.

FuzzyAutoFighter

Featured Replies

FuzzyAutoFighter v1.1



Instructions:

 - Save script as "FuzzyAutoFighter.groovy"  - Place in:   -> %userprofile%/osbot/scripts (Windows)   -> /home/osbot/scripts (Mac/Linux)    - Launch bot   -> Log in   -> Position your character wherever you like    - Open script selector   -> Click "Reload"   -> Select "FuzzyAutoFighter"   -> Click "Start"


Changelog:

 - v1.0   -> Initial release.



Features:

 - Selection GUI   -> User can select NPCs, loot and food (Food currently not working)  // -- No GUI yet -> coming soon (When Java support is added) // - GUI // -> Shows experience and tokkul gained (and average hourly rates)


Planned features:

 - GUI   -> Exp/loot gains with hourly rates - NPC clicking    - Food support   -> Food is selectable by the user (Will be fixed in next client update) - Loot support   -> Looting not currently working, will fix later on

 

 



Known bugs:

- None!

 

Script:

 

import org.osbot.script.ScriptManifestimport org.osbot.script.rs2.map.Positionimport org.osbot.script.rs2.model.GroundItemimport org.osbot.script.rs2.model.Itemimport org.osbot.script.rs2.model.NPCimport javax.swing.*import java.awt.*import java.awt.event.ActionEventimport java.awt.event.ActionListener@ScriptManifest(name = "FuzzyAutoFighter", author = "Fuz", version = 1.0D, info = "Superior AIO Autofighter")public class FuzzyAutoFighter extends org.osbot.script.Script {    private NPC npc;    private Position npcTile;    public int foodId;    public ArrayList<String> npcNames = new ArrayList<String>();    public ArrayList<Integer> itemIds = new ArrayList<Integer>();    private final Filter<NPC> NPC_FILTER = new Filter<NPC>() {	    @Override	    boolean accept(NPC npc) {		    for (String s : npcNames)			    if (npc.getName().toLowerCase().contains(s.toLowerCase()))				    return npc.getFacing() == null;		    return false;	    }    }    private FighterGui gui;    @Override    void onStart() {	    gui = new FighterGui(this);    }    @Override    int onLoop() {	    if (itemIds.size() < 1 || npcNames.size() < 1)		    return 1000;	    if (!client.inventory.contains(foodId))		    stop();	    if (!client.myPlayer.isAnimating() && (client.myPlayer.getFacing() == null || client.myPlayer.getFacing() != npc) && !client.myPlayer.isMoving()) {		    if ((npc = closestNPC(NPC_FILTER)) != null && !npc.isAnimating() && npc.getFacing() == null) {			    npcTile = npc.getPosition();			    if (!selectEntityOption(npc, "Attack") && distance(npc) < 5)				    client.moveCameraToEntity(npc);		    }	    }	    return 500;    }    @Override    void onPaint(Graphics g) {    }    private NPC closestNPC(Filter<NPC> f) {	    NPC npc = null;	    for (NPC n : client.localNPCs)		    if (n != null)			    if ((npc == null || distance(n) < distance(npc) && f.accept(n)))				    npc = n;	    return npc;    }    interface Filter<T> {	    public boolean accept(T element);    }}class FighterGui extends JFrame {    private static final int WIDTH = 180;    private static final int HEIGHT = 20;    FuzzyAutoFighter script;    JPanel panel;    JLabel npcNamesLabel;    JTextField npcNames;    JLabel itemIdsLabel;    JTextField itemIds;    JLabel foodIdLabel;    JComboBox<String> foodIds;    JButton startButton;    public FighterGui(final FuzzyAutoFighter script) {	    this.script = script;	    setTitle("FuzzyAutoFighter");	    this.setDefaultCloseOperation(HIDE_ON_CLOSE);	    panel = new JPanel();	    setContentPane(panel);	    panel.setLayout(new FlowLayout());	    npcNamesLabel = new JLabel("NPC names (Separate with ","):");	    npcNames = new JTextField("goblin,cow");	    npcNames.setPreferredSize(new Dimension(WIDTH, HEIGHT));	    itemIdsLabel = new JLabel("Item IDs (Separate with ","):");	    itemIds = new JTextField("996,4151");	    itemIds.setPreferredSize(new Dimension(WIDTH, HEIGHT));	    foodIdLabel = new JLabel("Food:");	    Vector food = new Vector();	    for (Item i : script.client.inventory.getItems()) {		    if (i != null) {			    String s = i.getId() + " (" + script.client.inventory.getAmount(i) + ")";			    if (!food.contains(s))				    food.add(s);		    }	    }	    final DefaultComboBoxModel model = new DefaultComboBoxModel(food);	    foodIds = new JComboBox<String>(model);	    startButton = new JButton("Apply");	    startButton.addActionListener(new ActionListener() {		    @Override		    public void actionPerformed(ActionEvent e) {			    String SEPARATOR = ",";			    if (npcNames.getText().contains(SEPARATOR)) {				    script.npcNames.add(npcNames.getText());			    } else {				    for (String s : npcNames.getText().split(",")) {					    while (s.startsWith(" "))						    s = s.substring(s.indexOf(" "))					    script.npcNames.add(s);				    }			    }			    if (itemIds.getText().contains(SEPARATOR)) {				    script.itemIds.add(itemIds.getText());			    } else {				    for (String s : itemIds.getText().split(",")) {					    while (s.startsWith(" "))						    s = s.substring(s.indexOf(" "))					    script.itemIds.add(s);				    }			    }			    //script.log(foodIds.getSelectedItem().toString().split(" ")[0]);			    script.foodId = Integer.parseInt(foodIds.getSelectedItem().toString().split(" ")[0]);			    setVisible(false);		    }	    });	    panel.add(npcNamesLabel);	    panel.add(npcNames);	    panel.add(itemIdsLabel);	    panel.add(itemIds);	    panel.add(foodIdLabel);	    panel.add(foodIds);	    panel.add(startButton);	    pack();	    setResizable(false);	    setVisible(true);    }}


Please report any bugs, post proggies (1h+) if possible

 

Edited by Fuz

Groovy's a bitch is it not?

Lol well it is when you are primarily used to Java scripting, but for the time being I think groovy is fine since it is very closely related to Java

Yo fuzzy great script man, my only issue is the constant attack clicking. just looks weird, maybe only have it try an attack every 10 seconds or something? 

Fuzzy,

Great script!

Just a few suggestions, 

I'm currently using this bot to afk slayer while watching netflix..Some things that I've noticed

  • Attacks monsters already being attacked
  • Attempts to attack new monster while in current fight
  • Repeaditively attacks monster you're already attacking
  • EDIT: restarted, food now working

Overall, great start! this would be a good script to use on something where no one else is (experiments)

Edited by xaro

  • Author

Fuzzy,

Great script!

Just a few suggestions, 

I'm currently using this bot to afk slayer while watching netflix..Some things that I've noticed

  • Attacks monsters already being attacked
  • Attempts to attack new monster while in current fight
  • Repeaditively attacks monster you're already attacking
  • EDIT: restarted, food now working

Overall, great start! this would be a good script to use on something where no one else is (experiments)

I just made a quick update, should have fixed most of those problems. Also, how did you get food to work? I haven't added eating :L

Fuz, on 06 Apr 2013 - 18:20, said:

I just made a quick update, should have fixed most of those problems. Also, how did you get food to work? I haven't added eating :L

Yeah I saw it eat a lob and I thought it worked,false alarm...must have misclicked

Edit: Trying out new version, will post update in 1 hr~

Edit #2:

Still attacks other monsters nearby while fighting (I did notice this happens less with update)

Still tries to attack monsters in combat already until they die

.................................................

All in all, great script to slay with while killing basilisks/cockatrices while watching netflix

Edited by xaro

Another quick update, I noticed the target switching while in combat mainly happens after eating food, so should be fixed when food support is added

  • Author

Another quick update, I noticed the target switching while in combat mainly happens after eating food, so should be fixed when food support is added

What on earth? The code for eating isn't there, how can it even be trying to eat? :L

What on earth? The code for eating isn't there, how can it even be trying to eat? :L

Sorry, I meant manual eating

  • Author

Sorry, I meant manual eating

Oh right, that really confused me :L

Guest
This topic is now closed to further replies.

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.