OSBOTTESTER101
-
Posts
12 -
Joined
-
Last visited
-
Feedback
0%
Posts posted by OSBOTTESTER101
-
-
#697274577595662417
kevsosmooth#3526
-
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
-
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?
-
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?
-
On 6/20/2020 at 1:25 PM, Token said:
Don't call API methods before the onStart() executes, so nothing that assigns the result to class fields or in constructors/initializer blocks
What do you mean exactly because I did not call anything on the onStart method I just used onLoop method
-
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 thisprivate 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 scriptAnyways 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
-
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?
-
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.)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.
-
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.
-
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.
Blast Furnace Put-ore-on walking issue
in Scripting Help
Posted
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