Jump to content

SentyChompys - Chompy Bird Killer


BurritoBug

Recommended Posts

SentyChompys


a chompy bird killer


 


Download: http://uppit.com/ti1v6btak00u/SentyChompys.jar


 


>wear ogre bow and ogre arrows


>walk 2 the place in image


>gimme bugs


>scripters pls tell me anywhere i went retard


 


  1zegmqx.png


 


package sentychompys;
 
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
import java.util.concurrent.TimeUnit;
import org.osbot.rs07.api.Chatbox;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.utility.ConditionalSleep;
 
 
@ScriptManifest(name = "SentyChompys", author = "Sentende", version = 1.0, info = "", logo = "") 
public class SentyChompys extends Script {
    
// NPCS    
int npcSwampToad = 1473;
int npcChompyBirdAlive = 1475;
int npcChompyBirdDead = 1476;
 
// OBJECTS
int objSwampBubbles = 684;
int objBloatedToad = 1474;
 
// ITEMS
int itemOgreBellowsZero = 2871;
int itemOgreBellowsThree = 2872;
int itemOgreBellowsTwo = 2873;
int itemOgreBellowsOne = 2874;
int itemBloatedToad = 2875;
int itemOgreArrow = 2866;
int itemOgreBow = 2883;
 
// AREA
Area areaChompyArea = new Area(2392, 3048, 2402, 3039);
 
// TIMER
private long timeBegan;
private long timeRan;
        
    private enum State {
        FILL_BELLOWS, CATCH_TOAD, PLACE_TOAD, KILL_CHOMPY, IDLE
    };
 
    private State getState() {
        /*
            KILL CHOMPY
        */
        if (npcs.closest(npcChompyBirdAlive) != null){
            return State.KILL_CHOMPY;
        }
        
        /*
            PLACE TOAD
        */
        else if(getInventory().contains(itemBloatedToad) && 
                !myPlayer().isAnimating() &&
                !myPlayer().isMoving()){
            return State.PLACE_TOAD;
        }
            
        /*
            CATCH TOAD
        */
        else if(!getInventory().contains(itemBloatedToad) &&
                !myPlayer().isAnimating() &&
                !myPlayer().isMoving() &&
                bellowsEmpty() != true) {
         return State.CATCH_TOAD;   
        }
        
        /*
            FILL BELLOWS
        */
        else if(bellowsEmpty() &&
                !myPlayer().isAnimating() &&
                !myPlayer().isMoving()) {
            
            return State.FILL_BELLOWS;
        }
            
        
        return State.IDLE;
    }
    
    @Override
    public void onStart() {
        timeBegan = System.currentTimeMillis();
 
    }
    
    @Override
    public void onExit() {
        //Code here will execute after the script ends
 
 
    }
 
    @Override
    public int onLoop() throws InterruptedException {
        switch(getState()){
            case KILL_CHOMPY:
                killChompy();
                break;
            case PLACE_TOAD:
                placeToad();
                break;
            case CATCH_TOAD:
                catchToad();
                break;
            case FILL_BELLOWS:
                fillBellows();
                break;
            default:
                break; 
        }
        return 100;
    }
 
    public void killChompy() throws InterruptedException {
        
        if(inventory.isItemSelected()) {
            mouse.click(false);
        }
        
        if(!npcs.closest(npcChompyBirdAlive).isOnScreen()) {
            camera.toEntity(npcs.closest(npcChompyBirdAlive));
        }
        
        npcs.closest(npcChompyBirdAlive).interact("Attack");
        sleep(random(80, 150));
        
        new ConditionalSleep(4000) {
 
@Override
public boolean condition() throws InterruptedException {
return (myPlayer().getInteracting().getId() != npcChompyBirdAlive);
}
}.sleep();
        
    }
    
    public void placeToad() {
        inventory.interact("Drop", itemBloatedToad);
        
        if(this.chatbox.contains(Chatbox.MessageType.GAME, "There is a bloated toad already placed at this location.")) {
            walking.walk(areaChompyArea.getRandomPosition());
        }
        
        new ConditionalSleep(4000) {
 
@Override
public boolean condition() throws InterruptedException {
return (!getInventory().contains(itemBloatedToad));
}
}.sleep();
    }
    
    public void catchToad() {
        
        if(! npcs.closest(npcSwampToad).isOnScreen()) {
            camera.toEntity(npcs.closest(npcSwampToad));
        }
        
        inventory.interact("Use", getOgreBellowsId());
        npcs.closest(npcSwampToad).interact(getOgreBellowsString() + "Swamp toad");
        mouse.click(false);
        new ConditionalSleep(4000) {
 
@Override
public boolean condition() throws InterruptedException {
return (getInventory().contains(itemBloatedToad) || !myPlayer().isMoving());
}
}.sleep();
    }
    
    public void fillBellows() {
        
        if(! objects.closest(objSwampBubbles).isOnScreen()) {
            camera.toEntity(objects.closest(objSwampBubbles));
        }
        
        inventory.interact("Use", getOgreBellowsId());
        objects.closest(objSwampBubbles).hover();
        mouse.click(false);
        
        if(this.chatbox.contains(Chatbox.MessageType.GAME, "I can't reach that!")) {
            walking.walk(areaChompyArea.getRandomPosition());
        }
        
        new ConditionalSleep(4000) {
 
@Override
public boolean condition() throws InterruptedException {
return (!bellowsEmpty());
}
}.sleep();
    }
    
    public boolean bellowsEmpty() {
        return getInventory().contains(itemOgreBellowsZero);
    }
    
    public int getOgreBellowsId() {
        if(getInventory().contains(itemOgreBellowsThree)) {
            return itemOgreBellowsThree;
        } else if (getInventory().contains(itemOgreBellowsTwo)) {
            return itemOgreBellowsTwo;
        } else if (getInventory().contains(itemOgreBellowsOne)) {
            return itemOgreBellowsOne;
        } else if (getInventory().contains(itemOgreBellowsZero)) {
            return itemOgreBellowsZero;
        } else {
            log("Inventory contains no Ogre Bellows");
            return 0;
        }
    }
    
    public String getOgreBellowsString() {
        if(getInventory().contains(itemOgreBellowsThree)) {
            return "Use Ogre bellows (3) -> ";
        } else if (getInventory().contains(itemOgreBellowsTwo)) {
            return "Use Ogre bellows (2) -> ";
        } else if (getInventory().contains(itemOgreBellowsOne)) {
            return "Use Ogre bellows (1) -> ";
        } else if (getInventory().contains(itemOgreBellowsZero)) {
            return "Use Ogre bellows -> ";
        } else {
            log("Inventory contains no Ogre Bellows");
            return "";
        }
    }
 
    @Override
    public void onPaint(Graphics2D g) {
        Graphics2D gr = g;
        timeRan = System.currentTimeMillis() - this.timeBegan;
        
        g.drawString("Time: " + ft(timeRan), 10, 60);
        g.drawString("State: " + getState().toString().replace('_', ' '), 10, 75);
    }
    
    private String ft(long duration)
        {
                String res = "";
                long days = TimeUnit.MILLISECONDS.toDays(duration);
                long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
                long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
                long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
                if (days == 0)
                {
                        res = (hours + ":" + minutes + ":" + seconds);
                }
                else
                {
                        res = (days + ":" + hours + ":" + minutes + ":" + seconds);
                }
                return res;
        }
    
}




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

Here's a quick tip:

// NPCS    
int npcSwampToad = 1473;
int npcChompyBirdAlive = 1475;
int npcChompyBirdDead = 1476;
 
// OBJECTS
int objSwampBubbles = 684;
int objBloatedToad = 1474;
 
// ITEMS
int itemOgreBellowsZero = 2871;
int itemOgreBellowsThree = 2872;
int itemOgreBellowsTwo = 2873;
int itemOgreBellowsOne = 2874;
int itemBloatedToad = 2875;
int itemOgreArrow = 2866;
int itemOgreBow = 2883;
 
// AREA
Area areaChompyArea = new Area(2392, 3048, 2402, 3039);
 
// TIMER
private long timeBegan;
private long timeRan;
        

Can be turned into 

// NPCS    
int npcSwampToad = 1473, npcChompyBirdAlive = 1475, npcChompyBirdDead = 1476;
 
// OBJECTS
int objSwampBubbles = 684, objBloatedToad = 1474;
 
// ITEMS
int itemOgreBellowsZero = 2871, itemOgreBellowsThree = 2872, itemOgreBellowsTwo = 2873, itemOgreBellowsOne = 2874, itemBloatedToad = 2875, itemOgreArrow = 2866, itemOgreBow = 2883;
 
// AREA
Area areaChompyArea = new Area(2392, 3048, 2402, 3039);
 
// TIMER
private long timeBegan, timeRan;
        
Link to comment
Share on other sites

 

Here's a quick tip:

// NPCS    
int npcSwampToad = 1473;
int npcChompyBirdAlive = 1475;
int npcChompyBirdDead = 1476;
 
// OBJECTS
int objSwampBubbles = 684;
int objBloatedToad = 1474;
 
// ITEMS
int itemOgreBellowsZero = 2871;
int itemOgreBellowsThree = 2872;
int itemOgreBellowsTwo = 2873;
int itemOgreBellowsOne = 2874;
int itemBloatedToad = 2875;
int itemOgreArrow = 2866;
int itemOgreBow = 2883;
 
// AREA
Area areaChompyArea = new Area(2392, 3048, 2402, 3039);
 
// TIMER
private long timeBegan;
private long timeRan;
        

Can be turned into 

// NPCS    
int npcSwampToad = 1473, npcChompyBirdAlive = 1475, npcChompyBirdDead = 1476;
 
// OBJECTS
int objSwampBubbles = 684, objBloatedToad = 1474;
 
// ITEMS
int itemOgreBellowsZero = 2871, itemOgreBellowsThree = 2872, itemOgreBellowsTwo = 2873, itemOgreBellowsOne = 2874, itemBloatedToad = 2875, itemOgreArrow = 2866, itemOgreBow = 2883;
 
// AREA
Area areaChompyArea = new Area(2392, 3048, 2402, 3039);
 
// TIMER
private long timeBegan, timeRan;
        

 

I prefer the first one; much easier to read! (luckily line count isn't a problem)

  • Like 5
Link to comment
Share on other sites

I wish I knew anything about chompy bird hunting. Never done that (even legit). But from reading your code I can tell you are trying to use an inventory item on a game object which is generally done by interacting with the inventory item using the "Use" action and then interacting with the game object using the appropriate action (it's generally "Use" for that too, item name that appears after is not part of the action). The part which is checking for a chatbox message might generate bugs when the player doesn't have the game chat on or is hidden, you should be able to do that by checking if there is an object with the required name at the player position before attempting to drop it. Also using object and npc names instead of ids would simplify your code a lot.

 

:ditto: Good look with the script m8 :ditto:

  • Like 1
Link to comment
Share on other sites

I wish I knew anything about chompy bird hunting. Never done that (even legit). But from reading your code I can tell you are trying to use an inventory item on a game object which is generally done by interacting with the inventory item using the "Use" action and then interacting with the game object using the appropriate action (it's generally "Use" for that too, item name that appears after is not part of the action). The part which is checking for a chatbox message might generate bugs when the player doesn't have the game chat on or is hidden, you should be able to do that by checking if there is an object with the required name at the player position before attempting to drop it. Also using object and npc names instead of ids would simplify your code a lot.

 

VSuShjF.gif Good look with the script m8 VSuShjF.gif

ty, i tried checking if a game object was below me before i drop it but i kept getting npe's

Link to comment
Share on other sites

ty, i tried checking if a game object was below me before i drop it but i kept getting npe's

objects.getAll().stream().filter(obj -> obj.getPosition() == myPosition()).count() > 0

Returns true if there is an object under your player. Replace objects with groundItems if what you want to check is considered a "ground item".

Link to comment
Share on other sites

I prefer the first one; much easier to read! (luckily line count isn't a problem)

It's definitely easier to read lol

For me it just feels cluttered when there's a million different things to define and it's a bit quicker just writing a comma instead of starting a new line

 

int 1;

int 2;

int 3;

 

boolean dildos, notdildos, probablydildos;

int 1, 2 ,3;

Edited by Reminiscence
Link to comment
Share on other sites

It's definitely easier to read lol

For me it just feels cluttered when there's a million different things to define and it's a bit quicker just writing a comma instead of starting a new line

 

int 1;

int 2;

int 3;

 

boolean dildos, notdildos, probablydildos;

int 1, 2 ,3;

 

It really depends on the situation, but often for huge trawling lists of things with very different names, writing them out individually is easier to follow. However in methods where it's often better to have things slightly more compact, for example int x,y; would probably be considered better than int x; int y;.

 

But it's really preference haha! I feel i'm somewhat making a mountain out of a molehill but whatever ;)

 

@senty nice script, im proud of your re-re-release :D

  • Like 2
Link to comment
Share on other sites

It really depends on the situation, but often for huge trawling lists of things with very different names, writing them out individually is easier to follow. However in methods where it's often better to have things slightly more compact, for example int x,y; would probably be considered better than int x; int y;.

 

But it's really preference haha! I feel i'm somewhat making a mountain out of a molehill but whatever wink.png

 

@senty nice script, im proud of your re-re-release biggrin.png

Haha, I completely agree. Definitely more of a preference thing!

mB6ErQK.png

 

I suppose it also depends on how you organize it.

I see how horizontal aligning would get confusing though and become inconvenient.

 

But anyways, I also think we're turning this into more than it should be lol

I personally stopped using ids half-way into my script and started using names instead. I suppose that's something OP should use as well. I read that sometimes Jagex likes to change ID's.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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