Jump to content

OSBOTTESTER101

Members
  • Posts

    12
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by OSBOTTESTER101

  1. On 12/5/2018 at 4:48 AM, Ragnar Lothbrok said:

    I've never had this issue myself so I'm not sure. Here's the code I used for interacting with the belt. Might help you get it going as I imagine it's a problem in your code rather than the client.

    
    package furnace.sections;
    
    import org.osbot.rs07.api.model.Item;
    import org.osbot.rs07.api.model.RS2Object;
    import org.osbot.rs07.api.ui.EquipmentSlot;
    import org.osbot.rs07.script.MethodProvider;
    import settings.Settings;
    import utils.Sleep;
    
    import static org.osbot.rs07.api.ui.Skill.SMITHING;
    
    public class Belt extends Section {
    
        public Belt(MethodProvider api, Settings settings) {
            super(api, settings);
        }
    
        public void placeOre() {
            if (!api.getEquipment().isWearingItem(EquipmentSlot.HANDS, "Goldsmith gauntlets")) {
                Item gloves = api.getInventory().getItem("Goldsmith gauntlets");
                if (gloves != null) {
                    if (gloves.interact("Wear")) {
                        Sleep.sleepUntil(() -> api.getEquipment().isWearingItem(EquipmentSlot.HANDS, "Goldsmith gauntlets"), 10_000);
                    }
                }
            } else {
                RS2Object belt = getBelt();
                if (belt != null) {
                    if (belt.interact("Put-ore-on")) {
                        Sleep.sleepUntil(() -> !api.getInventory().contains("Gold ore") || mustPayForeman(), 10_000);
                        if (mustPayForeman()) {
                            settings.setShouldPayForeman(true);
                        } else {
                            Sleep.sleepUntil(() -> !api.getInventory().contains("Gold ore"), 10_000);
                            settings.setXpBeforePlacingOre(api.getSkills().getExperience(SMITHING));
                            if (!api.getInventory().contains("Gold ore")) {
                                settings.setOreOnBelt(true);
                            }
                        }
                    }
                }
            }
        }
    
        private RS2Object getBelt() {
            return api.getObjects().closest(b -> b.getName().equals("Conveyor belt") && b.hasAction("Put-ore-on"));
        }
    
        private boolean mustPayForeman() {
            return api.getWidgets().singleFilter(api.getWidgets().getAll(),
                    widget -> widget.isVisible() && (widget.getMessage().contains("You must ask the foreman's permission before using the blast<br>furnace"))) != null;
        }
    }

    '

    Wow thank you for this, can you give me some advice on the main loop how long you should put the return statement? do you have put it for 10seconds

  2. import org.osbot.rs07.utility.ConditionalSleep;
    
    
    import java.util.function.BooleanSupplier;
    
    public final class Sleep extends ConditionalSleep {
    
        private final BooleanSupplier condition;
    
        public Sleep(final BooleanSupplier condition, final int timeout) {
            super(timeout);
            this.condition = condition;
        }
    
        @Override
        public final boolean condition() throws InterruptedException {
            return condition.getAsBoolean();
        }
    
        public static boolean sleepUntil(final BooleanSupplier condition, final int timeout) {
            return new Sleep(condition, timeout).sleep();
        }
    }
    

     

    this is my sleep method

  3. if (exactLocationOfConveyor.interact(x.getBot(), "Put-ore-on") || exactLocationOfConveyor2.interact(x.getBot(), "Put-ore-on")) {
    
        Sleep.sleepUntil(() -> !x.myPlayer().isMoving() && !x.getInventory().contains("Gold ore"), 5000);
        if (!x.getInventory().contains("Gold ore")) {
            x.getWalking().walk(exactLocationOfBarDispenser);
            Sleep.sleepUntil(() -> getSmithXP < x.getSkills().getExperience(Skill.SMITHING), 3000);
            if (x.getEquipment().isWearingItem(EquipmentSlot.HANDS, "Goldsmith gauntlets")) {
                x.getInventory().interact("Wear", "Ice gloves");
                barDispenser.interact("Take");
            }
        }
    
    
    }

     

    Ok so  I am getting results on my bot up until the lines i wrote in here

     

    the first line works for example it is suppose to click on the conveyor belt and walk to it but for some reason it does do that and when it gets there it spams click instead of sleeping

    i am using a sleep that i found on explvs and it was working for some things but it just does not actaully sleep the way i thought it would

     

    any suggestion?

  4. RS2Object conveyorBelt = x.getObjects().closest("Conveyor belt");
    
    RS2Object barDispenser = x.getObjects().closest("Bar dispenser");
    
    Position barDispenseArea = new Position(1942, 4967, 0);
    
    x.log("Walking to conveyor belt");
    
    if (conveyorBelt.exists() && conveyorBelt != null) {
        x.getWalking().walk(barDispenseArea);
        Sleep.sleepUntil(() -> !x.myPlayer().isMoving(), 1000);
    }

     

    Everytime my player walk to the barDispenseArea it keeps hovering its mouse on the object and trying to click something

     

    I did not specfiy in my code to click anything when it arrives just to sleep.

     

    does my if statement play a role in what is going on?

     

    When I say everytime I mean every time my player goes over to the conveyor belt it tries to click something but for no reason because where did i put in my code to click?

  5. public class Attack {
        private static Script sI;
        NPC npc = sI.getNpcs().closest("Rat");
        public void getAllNpcs(Script sI, String npcsName){
            if(!sI.myPlayer().isUnderAttack()){
                if(npc.exists()){
                    sI.npcs.closest(npcsName).interact("Attack");
                }else{
                    sI.log("Cant find the current NPCS " + npcsName);
                }
            }
        }
    }

    Above is my code and this is only the " ATTACK class, that creates a getAllNpcs  which when is suppose to attack the given String npcsName

    now before I had a collection of Npcs that is why you see the method ask for a given String 
    basically it was like this 

    private static List<NPC> npc = sI.npcs.getAll();

    rather then the method you use above
    anyways am I doing something wrong ? because when I click play and try to use the bot script it does nothing and after I do I can't even click on the osrs game anymore it is basically like if there were a JFrame over my game not letting me click anything on that screen after I try to run the unsucessful script

     

    Anyways I was thinking that maybe I should use a constructor to pass the script instance? Such as

     

    public class Attack {
        private Script sI;
    	public Attack(Script sI){
    		this.sI = sI;
    }
        //private static List<NPC> npc = sI.npcs.getAll();
        NPC npc = sI.getNpcs().closest("Rat");
        public void getAllNpcs(Script sI, String npcsName){
            if(!sI.myPlayer().isUnderAttack()){
                if(npc.exists()){
                    sI.npcs.closest(npcsName).interact("Attack");
                }else{
                    sI.log("Cant find the current NPCS " + npcsName);
                }
            }
        }
    }

    and below I will give you my main method

     

     

     

     

    public int onLoop ()  throws InterruptedException{
    
            switch (getState()){
                case EAT:
                    print(getState());
                    Eat.eatFood();
                    break;
                case ATTACK:
                    print(getState());
                    attack.getAllNpcs(this, "Rat");
                    break;
                case BANK:
                    print(getState());
                    bank.bankMode(this, Banks.VARROCK_WEST);
                    break;
    
            }
    
            return random(3000);
    
        }
    private States getState(){
    
            if(myPlayer().getHealthPercent()<20){
                    return
                            States.EAT;
    
            }else if(!myPlayer().isUnderAttack()){
                    return
                            States.ATTACK;
    
            }else
    
                return States.BANK;
    // do not mind the return States.BANK as I have not finished the code but all I was trying to do is make the player attack is all and my player is not under attack so it should return States.attack		
                                                

     

     

    Oh yes by the way I have never created States or Classes that have separate task, this is my first time and that is why maybe it is not working for me 

     

    but if the code looks fine to everyone than maybe I am not setting the build path correctly and I am using IntelliJ

  6. Of course like everyone else here I have some question

     

    One of the question is that when you rent a server- do they physically bring it to your home?

     

    Also if you buy lets say 3 used servers and install them can you physically log in to each of those servers like to see a GUI?

     

    Would you be able to set them up individually ? and then would you get a new IP for each bot? or how does that work?

  7. On 12/7/2015 at 10:53 PM, lare96 said:

    Will flick "Rapid Heal", drink overloads when necessary and will drink 1-2 absorption sips after every overload sip. Make sure that you start the bot when you're inside the arena, you've guzzled your rock cakes and fully set up your character to be ready for combat (1HP, standing in corner, ready to flick). Sorry about the poor/messy quality but I whipped it up in 15 or so minutes, but I've been using it all day and it works perfectly. Enjoy!

     
     
    (Shitty XP because this is while I was debugging the script.)
     
    xFVKrHP.png
    
    import com.google.common.base.Stopwatch;
    import org.osbot.rs07.api.ui.PrayerButton;
    import org.osbot.rs07.api.ui.Skill;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    
    import java.awt.Color;
    import java.awt.Font;
    import java.awt.Graphics2D;
    import java.time.LocalTime;
    import java.util.concurrent.TimeUnit;
    
    /**
     * @author lare96 <http://github.org/lare96>
     */
    @ScriptManifest(logo = "", name = "NmzFlicker", author = "lare96", version = 1.0, info = "Will flick HP and pot overloads/absorbs.") public final class NmzFlicker
        extends Script {
    
        private final Stopwatch watch = Stopwatch.createStarted();
        private String status = "Idle...";
        private int sipAbsortption = 0;
    
        @Override
        public void onStart() {
            experienceTracker.start(Skill.ATTACK);
            experienceTracker.start(Skill.DEFENCE);
            experienceTracker.start(Skill.STRENGTH);
        }
    
        @Override
        public int onLoop() throws InterruptedException {
            if (!combat.isAutoRetaliateOn() && !prayer.isActivated(PrayerButton.RAPID_HEAL)) {
                status = "Turning on auto-retaliate...";
                combat.toggleAutoRetaliate(true);
                return random(1000, 1500);
            }
    
            if (skills.getDynamic(Skill.HITPOINTS) == 51 && !prayer
                .isActivated(PrayerButton.RAPID_HEAL) && sipAbsortption == 0) {
                status = "Drinking Overload potion...";
                for (int i = 1; i < 5; i++) {
                    if (inventory.contains("Overload (" + i + ")")) {
                        inventory.interact("Drink", "Overload (" + i + ")");
                        break;
                    }
                }
                sipAbsortption = random(1, 2);
                return random(1000, 1500);
            }
    
            if (sipAbsortption > 0 && !prayer.isActivated(PrayerButton.RAPID_HEAL)) {
                status = "Drinking Absorption potion...";
                for (int i = 1; i < 5; i++) {
                    if (inventory.contains("Absorption (" + i + ")")) {
                        inventory.interact("Drink", "Absorption (" + i + ")");
                        break;
                    }
                }
                sipAbsortption--;
                return random(1000, 1500);
            }
    
            if (prayer.isActivated(PrayerButton.RAPID_HEAL)) {
                status = "Flicking \"Rapid Heal\" off...";
                prayer.set(PrayerButton.RAPID_HEAL, false);
            } else {
                status = "Flicking \"Rapid Heal\" on...";
                prayer.set(PrayerButton.RAPID_HEAL, true);
                return random(50, 100);
            }
            return random(3000, 15_000);
        }
    
        @Override
        public void onPaint(Graphics2D g) {
            g.setColor(Color.WHITE);
            g.setFont(new Font("Myriad Pro", Font.BOLD, 16));
            g.drawString("NmzFlicker [By Lare96]", 7, 225);
            g.setFont(new Font("Myriad Pro", Font.PLAIN, 14));
            g.drawString("Time Running: " + LocalTime.ofSecondOfDay(watch.elapsed(TimeUnit.SECONDS)).toString(), 7, 245);
            g.drawString("Status: " + status, 7, 260);
            g.drawString("Attack XP: " + experienceTracker.getGainedXP(Skill.ATTACK) + " (" + experienceTracker
                .getGainedXPPerHour(Skill.ATTACK) + ")", 7, 275);
            g.drawString("Strength XP: " + experienceTracker.getGainedXP(Skill.STRENGTH) + " (" + experienceTracker
                .getGainedXPPerHour(Skill.STRENGTH) + ")", 7, 290);
            g.drawString("Defence XP: " + experienceTracker.getGainedXP(Skill.DEFENCE) + " (" + experienceTracker
                .getGainedXPPerHour(Skill.DEFENCE) + ")", 7, 305);
        }
    }

    Hi thank you for the code I yet have not used this on my account

     

      if (prayer.isActivated(PrayerButton.RAPID_HEAL)) {
                status = "Flicking \"Rapid Heal\" off...";
                prayer.set(PrayerButton.RAPID_HEAL, false);
            } else {
                status = "Flicking \"Rapid Heal\" on...";
                prayer.set(PrayerButton.RAPID_HEAL, true);
                return random(50, 100);
            }

     

    I am mainly confused only on this part because first you check to see if prayer is on "and if it is on" then you shut it off

    That part is clear but when you do shut it off again?

    does it loop back through the entire program to fulfil the other conditions?

    or does the return random(50,100) loop back around the same if statement one more time?

     

     

    On 7/7/2017 at 2:03 PM, slazter said:

    Hmm wouldn't it be smarter to keep it at == 51, and instead throw in an else loop for >51, to eat on the dwarven rock cake, until 51. 

    That is a good point actually but I do not think this bot will mess up lol

     

    but that is definitely a good point incase that happens

    or you can do if >51 

    and down the line

    ==1, incase it goes over 1 into the 2 zone.

  8. Just showing you should know as well, jagex keeps tracks of IP address so actually having several osBOT apps opening would be better using different proxies on each, but that personal preference

    Logically you would need to have a timer on the script just stating to logout in 4 hours and log another account in right after.

  9. Imagine this...

     

    String [] allBanks = {Banks.AL_KHARID,Banks.GRAND_EXCHANGE,Banks.LUMBRIDGE_UPPER,Banks.VARROCK_EAST,Banks.VARROCK_EAST};
    
    

    Now here is where we ask the user when starting the script

     

    USER -> STARTS SCRIPT -> SCRIPT THEN ASK -> Where would you like to go with the options 1-10, and names next to them

    1. - AL KHARID BANK

    2. G.E

    AND so on.

     

×
×
  • Create New...