Everything posted by exuals
-
OSBot2 Event (Node) Driven Script Skeleto
Thanks, my IDE does it automatically when I refactor const's though.
-
OSBot2 Event (Node) Driven Script Skeleto
It's intentional, otherwise it'd attack a monster and immediately attempt to attack another when you're in combat. It's an example to demonstrate how to do the right click next monster for max efficiency shit.
-
OSBot2 Event (Node) Driven Script Skeleto
Since there is a tutorial for the legacy I figured I'd throw up what I've been using to develop OSB2 scripts. So, before I copy and paste code, an event is similar to a 'node' with the addition of useful features such as; EventMode EventStatus EventMode determines when to run the code in the event. With concurrency changes in OSB2 you can run events in 'ASYNC' mode, AKA another thread that runs this event in sync with another already running event. For example say you have an autofighter, you can start a new event in async mode that checks prayer points and when low; drinks a dose of prayer restore. You can also set an event to run in BLOCKING mode, simply stating that when the current event is finished, run this one next. EventStatus determines what the event is currently doing, this is useful for managing multiple events. EventStatus can be: Queued Working Finished Failed Back to the autofighter example, some of the events could be: AttackMonster, this can be run in BLOCKING mode as we don't want to fight multiple monsters. When this event is executed, if there is another event currently running, it will be queued. When this event is Working it will be in combat with a monster, when the event is Finished, the monster should be dead and Failed would be if the monster is unable to be killed or killed us. This is incredibly useful as there is functionality to run code while event is queued, hence, if you queued an AttackMonster event it could right click the monster and wait for the current to be killed. EatFood, this would be run in ASYNC mode as we want to eat when we are low and not wait for the current event to finish. EatFood can be queued to indicate that you want to eat 3 or 4 pieces of food in a row. When the event is finished, determine that our health increased to complete the event. Now, our core script class: import java.awt.Graphics2D; import java.util.ArrayList; import org.osbot.script.Script; import org.osbot.script.event.Event; import Events.EventTest; public class TestScript extends Script { private ArrayList<Event> allEvents = new ArrayList<Event>(); @Override public int onLoop() throws InterruptedException { for (Event e : allEvents) { execute(e); } return 1000; } @Override public void onStart() throws InterruptedException { allEvents.add(new EventTest()); super.onStart(); } } Looks similar to the node framework right? Simple enough to read, we have an ArrayList of all of our events , onStart we add what events we want to use. During the onLoop for this example we simply execute all of the events in the arraylist. Note: If you have events that run in async make sure to place them before non async events when adding to the arraylist. And here is an example event: package Events; import org.osbot.legacy.script.MethodProvider; import org.osbot.rs07.api.model.NPC; import org.osbot.script.event.Event; public class FishSharks extends Event { private static final String FISHING = "Fishing"; private static final String HARPOON = "Harpoon"; private static final int _618 = 618; private static final int _2906 = 2906; @Override public int execute() throws InterruptedException { if (inventory.isFull()) setFinished(); if (!(myPlayer().getAnimation() == _618)) startFishing(); return 0; } private void startFishing() throws InterruptedException { NPC fishingspot = npcs.closest(_2906); if (fishingspot.exists()) { camera.toEntity(fishingspot); fishingspot.interact(HARPOON); sleep(MethodProvider.gRandom(1000, 200)); } } @Override public String toString() { return FISHING; } } This event simply catches sharks if it is not animating. Since the event hasn't stated a EventMode it is automatically set to BLOCKING. Here is an example of a ASYNC event; package Events; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Spell; import org.osbot.script.MethodProvider; import org.osbot.script.event.Event; public class AntiBan extends Event { private static final String ANTIBAN = "Antiban"; public AntiBan() { setAsync(); } @Override public int execute() throws InterruptedException { antiBan(); return 0; } private void antiBan() throws IllegalArgumentException, InterruptedException { int rand = MethodProvider.random(0, 4); switch (rand) { case 0: antiBan.hoverSkill(Skill.FISHING); break; case 1: antiBan.hoverSpell(Spell.HOME_TELEPORT); break; case 2: antiBan.moveMouseOutsideScreen(); break; case 3: camera.movePitch(99); break; } sleep(MethodProvider.gRandom(6000, 6000)); } @Override public String toString() { return ANTIBAN; } } Because this Event is run in ASYNC (Notice we set this in the constructor) the antiban will run concurrently with the other two events. And finally, the core of this example fishing script: import java.awt.Color; import java.awt.Graphics2D; import java.util.ArrayList; import java.util.Collections; import org.osbot.script.Script; import org.osbot.script.ScriptManifest; import org.osbot.script.event.Event; import Events.AntiBan; import Events.BankSharks; import Events.FishSharks; @ScriptManifest(author = "exuals", info = "I don't even", logo = "what", name = "exFishy", version = 0) public class exSharksAPI2 extends Script { private ArrayList<Event> allEvents = new ArrayList<Event>(); @Override public int onLoop() throws InterruptedException { for (Event e : allEvents) { execute(e); } return 1000; } @Override public void onPaint(Graphics2D arg0) { super.onPaint(arg0); int x, y, width, height; x = 20; y = 50; width = 100; height = 25; for (Event e : allEvents) { if (e.isWorking()) { arg0.setColor(Color.green); arg0.fillRect(x, y, width, height); } else if (e.isQueued()) { arg0.setColor(Color.yellow); arg0.fillRect(x, y, width, height); } else if (e.hasFailed()) { arg0.setColor(Color.red); arg0.fillRect(x, y, width, height); } arg0.setColor(Color.white); arg0.drawRect(x, y, width, height); arg0.setColor(Color.black); arg0.drawString(e.toString(), x + 15, y + 17); y += 30; } } @Override public void onStart() throws InterruptedException { Collections.addAll(allEvents, new AntiBan(), new FishSharks(), new BankSharks()); super.onStart(); } }
-
=[EX-MOD]=->► ✓Friendly ☆☆☆Asuna's Bond Shop ✓Reliable ☆☆☆◄<-=[150+ FEEDBACK]=
Bought a bond, went first, super helpful and nice. Thanks
-
Weekend GDK Project
I wrote a NMZ bot in 4 hours, shouldn't be a problem, logic is easy. Just gotta type haha.
-
Weekend GDK Project
Broke from staking and need to make dosh. Going to write a quick GDK bot with some customization for my account (Ancient teleporting & Looting bag). I'll post progress in a list as I go along, if anyone would like to contribute or collab, shoot me a PM. Aiming to be finished by tomorrow, midnight at the latest. Completed: Starting items withdrawn from bank from hashmap Looting bag API (Deposits) Teleport to Graveyard Attack Green Dragon Eat Food Open Bank In Progress: Looting bag API (Withdraw, bank)
-
Nightmare Zoner
If you'd like my old source I can probably dig it up for you.
-
LF: Hearthstone Beta Key, Offering LoL/07/Nether accounts
Looking for a hearthstone beta key, offering a Gold 1 League of Legends account with numerous skins or a Nether beta access account. Skype: scottygmostdope
-
OSBot 2.0 Updates for 11/9/2013
As a script writer who wrote the asynchronous tasking for a previous script, did you use a queue with an Overridden peek to determine where to place the mouse? That was my method, was incredibly efficient, would highly recommend. Also, could we see a script to check out the new API?
-
Chatbox
I was recently kicked & banned from the Chat for telling the user "Cortana" to "Fuck off" Now, I'm curious. This isn't allowed because I swore? Or insulted you're little e-whore? Either way this is ridiculous, this is an internet community, a public way to express opinions. If I have a negative opinion of another user I'll state it as I expect them to state it to me, when in discussion. Cortana corrected my context of "you're/your", I told her to fuck off and was kicked. I rejoined the chat and then was banned after attempting to argue (without using "language") my side of how idiotic it is to censor language in a fucking chatroom. I can name multiple users on a daily basis who swear in that chatroom with moderator presence, anyone here know of a "Smoke Crack"? He's nothing but an idiot and annoying troll that swears and tells new users to delete system32, don't worry, you can still find him in the chatroom, but not I. Get you're shit together, censoring language in a public internet chatroom? Get real. Embarrassing to be a part of this community.
-
Marijuana: Legal or illegal.
As someone who is literally high everyday, all day... I hope they don't, I'd have to pay through the roof at a dispensary and my dealer gives me such nice deals.
-
Any FLAWLESS melee script?
My Nightmare Zone bot can reach 125k/exp an hour and will run forever. Released on SDN soon.
-
SSF giveaway! congrats aambeien!
25 sitting on 25 mill.
-
exNMZ (Nightmare Zone) - Up to 350kgp & 125kxp per hour
This.guy;
-
exNMZ (Nightmare Zone) - Up to 350kgp & 125kxp per hour
The item rewards are so stable, doubt it'll ever happen.
-
exRangeGuild
It works, make sure you have no extra bronze arrows whatsoever.
- Need 5 easy quests done
-
exNMZ (Nightmare Zone) - Up to 350kgp & 125kxp per hour
Oh shit, then I'll switch over to Snape Grass because that's not only going up, it's a better ratio. They added multiple high volume items for a reason, don't be an idiot and leave my thread. The best setup is to only have the following 5 done: Lost City, The Grand Tree, Gnome Village, Vampire Slayer & Fight Arena
-
exNMZ (Nightmare Zone) - Up to 350kgp & 125kxp per hour
Being approved on SDN. Going to SDN for $10. Haha anyone can offer in exchange for a free copy. I see you dharoking in picture. This supports dharoking? Also, are there certain quests I shouldn't do on that accounts im going to run on this? Yup, will even lower your health with protect from melee then activate absorption bots at 2 hp for max effect. Sounds good. Have any longer progress reports to show? I'm currently in the works of getting a NMZ account to set up a server on for infinite run throughs. On endurance mode though I burned through 3m when I accidently left it on overnight. I don't think theres any randoms there due to dharokers being 2hp and magic chicken would be a shitshow.
-
exNMZ (Nightmare Zone) - Up to 350kgp & 125kxp per hour
Being approved on SDN. Going to SDN for $10. Haha anyone can offer in exchange for a free copy. I see you dharoking in picture. This supports dharoking? Also, are there certain quests I shouldn't do on that accounts im going to run on this? Yup, will even lower your health with protect from melee then activate absorption bots at 2 hp for max effect.
-
exNMZ (Nightmare Zone) - Up to 350kgp & 125kxp per hour
Being approved on SDN. Going to SDN for $10. Haha anyone can offer in exchange for a free copy.
-
exNMZ (Nightmare Zone) - Up to 350kgp & 125kxp per hour
exNightmare Zone - Lite Automatically completes hard endurance dreams in NMZ. How do I setup? Have your coffer unlocked with money inside. Be standing inside the minigame area. Have your best melee set-up equipped. What does it do? Automatically creates a hard endurance dream. Enters the dream. Fights the monsters until death for experience and points. Repeats endlessly. Download: http://uppit.com/g8mu3isswj7o/exNightmare.jarMedia:
- Need 5 easy quests done
-
Need 5 easy quests done
Not accepting for free, they're a bitch. Also, scripts as in NMZ for free if you wanted or some shit, need my own hard rumble mule. What? Those quests are very easy..... Kind of dumb. But ok please pay people instead of getting it for free I fully intend to, go write scripts and stop trying to do slave labour silly
-
Need 5 easy quests done
Not accepting for free, they're a bitch. Also, scripts as in NMZ for free if you wanted or some shit, need my own hard rumble mule.