

liverare
Scripter II-
Posts
1300 -
Joined
-
Last visited
-
Days Won
3 -
Feedback
0%
Everything posted by liverare
-
Oh my fucking god, what an insufferable prick. Question/questionable (aka. click-bait) title, with NO concise answer within the first 30 seconds of the video. Facial expression that of someone taking a huge shit. Jump-cuts. He's a bastard who's not getting 10 minutes of my time. :edit: I fucking bet if I disable my ad-block, his video will be crawling with ads. This is one of the many reasons the internet's going to absolute shit nowadays.
-
Before you start programming, you should setup your programming environment:
-
You've got a lot going on in your loop, which isn't good. Your loop function should be clean and concise: if (needToEat()) { if (canEat()) { eat(); } else { bank(); } } else if (needToLoot()) { if (canLoot()) { loot(); } else { bank(); } } else { if (notKilling()) { if (canKill()) { kill(); } else { spinTheCameraAroundSoWeDontLogOut(); } } } Separate routines is the way to go:
-
You can request an unban here: https://support.runescape.com/hc/en-gb/articles/115002238729-Account-Bans However, if they reject your appeal, they'll reject any other future appeals too. I requested an appeal last week for an account created in 2006 and permanently banned in 2010, and I was successful. In the email, the Mod mentioned that enough time had passed and that that my unbanning is an extremely rare exception. I would recommend you wait a few years before making an appeal. I will try this again with another account that got banned in 2014. I'll be sure to share the results.
- 32 replies
-
probably i was laying on my bed so that didnt help
-
Items? You can use IDs for items, as I doubt they've ever changed and are unlikely to. Game objects? You should use names where possible. If not, model ids are also fairly consistent too.
-
5 weeks is a pretty long time. You should poke Alek in the chat about it.
-
You're misusing getArea: You're creating a new Area object just to test whether someone is inside of it. What a total waste. You're creating that new Area object for each player you check. Additionally, the null check is redundant as OSBot won't pass you null values to begin with, and you should cache myPlayer() somewhere, as that's likely a function that interfaces with the game to grab your player information. You should only have to grab it once for the duration of your checking. Otherwise, it's just inefficient.
-
I'm guessing you're trying to find players who are nearby you? If so: private List<Player> getPlayersNearby(int distance) { final Player me = myPlayer(); return players.filter(p -> !me.equals(p) && me.getPosition().distance(p) <= distance); }
-
There was an issue with the item named that I have now fixed. The script should be updated on the SDN later.
-
Actually, it turns out there's a problem with one of my older scripts, which is causing a problem for all my other scripts. I'll sort it out now, then things should run smoothly again.
-
That's just referencing the function that will be ran to fix the problem. There's not really a more efficient way of doing this. However, stackable items have a stackable worth, so you need to take that into account. You're going to need some sort of table/enum/data structure to define those items and their perceived values. Then, you can evaluate the items you have in your inventory to find the least valuable item(s) and drop them, then loot the more valuable item.
-
:edit: I've massively overcomplicated it. Something better would be: if (lootExists()) { if (lootIsStackable()) { if (inventoryContainsLoot()) { lootItem(); } else if (inventoryIsFull()) { makeSpace(); } } else { if (inventoryIsFull()) { makeSpace(); } else { lootItem(); } } } The problem with looting algorithms is that it's nearly impossible to figure out what items you'd dispose of in place for a more valuable item. Imagine if you're inventory's full of an item your bots is programmed to value, such as abyssal whips, but then a wild elysian sigil appears. If your bot isn't programmed to forcibly make space for that item, you could lose out on a very valuable item. You could try to use GE prices, but they're volatile, subjective, and sometimes miscellaneous items can have their prices purposfully manipulated to trick your bot into dropping valuables.
-
-
It's just a security measure. If OSBot reads a malicious file, then the developers can be assured it originated from the data folder and that a scriptwriter/user is likely responsible for it. It has the added benefit of preventing scriptwriters from loading in password files. I know there are other security measures in place, such as scriptwriters are no longer able to use Reflection, also I believe there's some sort of limitation when it comes to connecting to websites (or web stuff). It can be annoying at times, but I guess it's just the developers not taking the chance, because bad stuff has happened in the past.
-
A lot of scripters are writing their own nodes. Why not make an official OSBot one? It'd just be an extra extendable class.
-
Your function is called getCallisto, but you're returning whether you see Callisto, not whether you've got him. There's plenty more information to gain from an NPC object, such as location, health, etc. But you're not returning that. Instead, you're returning just a bool. In said function, you're not checking to see whether Callisto is valid (null checks). You're using a Lambda expression to filter for an NPC by it's name only. That's putting a hat on a hat, when NPCS#getClosest will already let you find NPCs by their name. In your function, you get Callisto then you check whether Callisto is visible on your screen. I'm certain you intended to check whether Callisto is valid, not visible. Your entire function seems wholly redundant. Again, just find Callisto and store it as a local variable (outside onLoop), then check whether Callisto is valid (null check) and then do whatever it is you intend to do. Example: NPC callisto; @Override public int onLoop() { if (callisto != null && callisto.exists()) { /* TODO: Callisto exists - what now? */ } else { /* Find Callisto */ callisto = npcs.closest("Callisto"); } return 250; } You can expand upon this by only searching for Callisto if your player is located near Callisto (distance check/area check/X,Y check). That way, you're not wasting time searching for Callisto while you're at the Grand Exchange, for instance.
-
That's pretty anecdotal. Were you previously banned on that or any other account? Did you run any other scripts? Are you a fresh level-3 account from F2P who had a large gold/item transaction in order to begin training? Etc. There are many reasons to suspect it's not the script, but likewise, if I start hearing the same complaints then I'll make some adjustments. I designed my script to be fit-for-purpose. It operates as fast as RS and OSBot allows. My script cannot craft glass any faster than RS allows, and likewise, my script cannot perform interactions any faster than OSBot's mouse and keyboard handlers do. The only things that I control (time-wise) is the conditional sleeps (which end when it's meant to - and promptly) and the delay between each cycle of the main loop in the script.
-
Your problem is "C:\Users\ItsAMe\MyScriptStuff\accounts.txt". Why? Because OSBot won't let you look, let alone touch, any files outside of the OSBot data directory: C:\Users\...\osbot\data\...
-
You should really make a coal bag API as apposed to shoving it into a task node. That way, it's a little more maintainable and, if it proves flawless, it could perhaps make it into the official API to then be maintained by the developers and scriptwriters. Here's a 10 minute example of me taking what you wrote and scribbling out an API: import org.osbot.rs07.api.model.Item; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.api.ui.Message.MessageType; import org.osbot.rs07.listener.MessageListener; import org.osbot.rs07.script.API; import org.osbot.rs07.utility.ConditionalSleep; public class CoalBagAPI extends API implements MessageListener { /** * Maximum amount of coal that can be stored in the coal bag when the user is * not wearing a smithing cape. */ public static final int STORAGE_COUNT = 27; /** * Maximum amount of coal that can be stored in the coal bag when the user is * wearing a smithing cape. */ public static final int STORAGE_COUNT_SMITHING_CAPE = 36; /** * Smithing cape increases the size capacity of the coal bag. */ private boolean usingSmithingCape; /** * Keep a running tally of the amount of coal stored in the coal bag. */ private int storedCoalAmount; @Override public void initializeModule() { bot.addMessageListener(this); usingSmithingCape = equipment.contains("Smithing cape"); } @Override public void onMessage(Message messageObj) throws InterruptedException { String messageText = messageObj.getMessage(); /* Check whether message is from the game */ if (messageObj.getType().equals(MessageType.GAME)) { /* Check the message contents */ if (messageText != null) { switch (messageText) { /* Set counter to 0 */ case "Your coal bag is empty.": storedCoalAmount = 0; break; /* Set counter to max storage value */ case "Your coal bag is already full.": storedCoalAmount = (usingSmithingCape ? STORAGE_COUNT_SMITHING_CAPE : STORAGE_COUNT); break; } } } } public boolean isUsingSmithingCape() { return usingSmithingCape; } public void setUsingSmithingCape(boolean usingSmithingCape) { this.usingSmithingCape = usingSmithingCape; } public int getStoredCoalAmount() { return storedCoalAmount; } public void setStoredCoalAmount(int storedCoalAmount) { this.storedCoalAmount = storedCoalAmount; } public boolean isFull() { return usingSmithingCape ? storedCoalAmount == STORAGE_COUNT_SMITHING_CAPE : storedCoalAmount == STORAGE_COUNT; } public boolean isEmpty() { return storedCoalAmount == 0; } public int getRemainingSpace() { return usingSmithingCape ? (STORAGE_COUNT_SMITHING_CAPE - storedCoalAmount) : (STORAGE_COUNT - storedCoalAmount); } private int getCoalAmount() { return (int) inventory.getAmount("Coal"); } private Item getCoalBag() { return inventory.getItem("Coal bag"); } public boolean fill() throws InterruptedException { boolean successful = false; Item coalBag = getCoalBag(); int invCoalCount = getCoalAmount(); int remainingSpace = getRemainingSpace(); int amountToBeStored = 0; ConditionalSleep sleepUntilCoalAddedToBag = null; if (coalBag == null) { /* Don't bother returning true/false */ throw new InterruptedException("No coal bag found!"); } else if (invCoalCount > 0 && remainingSpace > 0) { /* Calculate the difference for when you store the coal */ amountToBeStored = (invCoalCount - remainingSpace); /* Try to fill the coal bag */ if (coalBag.interact("Fill")) { /* Sleep for 3.5 seconds (3500) */ sleepUntilCoalAddedToBag = new ConditionalSleep(3500) { @Override public boolean condition() throws InterruptedException { /* Wake up when the coal has been added */ return getCoalAmount() != invCoalCount; } }; /* It shouldn't take us 3.5 seconds to check whether the bag's been filled */ if (sleepUntilCoalAddedToBag.sleep()) { storedCoalAmount += amountToBeStored; successful = true; } } } return successful; } public boolean empty() throws InterruptedException { boolean successful = false; Item coalBag = getCoalBag(); int remainingSpace = inventory.getEmptySlotCount(); int amountToBeWithdrawn = 0; ConditionalSleep sleepUntilCoalRemovedFromBag = null; if (coalBag == null) { /* Don't bother returning true/false */ throw new InterruptedException("No coal bag found!"); } else if (storedCoalAmount > 0 && remainingSpace > 0) { /* Figure out how much inventory space we're about to lose */ amountToBeWithdrawn = Math.min(storedCoalAmount, remainingSpace); /* Try to fill the coal bag */ if (coalBag.interact("Empty")) { /* Sleep for 3.5 seconds (3500) */ sleepUntilCoalRemovedFromBag = new ConditionalSleep(3500) { @Override public boolean condition() throws InterruptedException { /* Wake up when the coal has been added */ return inventory.getEmptySlotCount() != remainingSpace; } }; /* It shouldn't take us 3.5 seconds to check whether the bag's been filled */ if (sleepUntilCoalRemovedFromBag.sleep()) { storedCoalAmount -= amountToBeWithdrawn; successful = true; } } } return successful; } /** * TODO ... * @return * @throws InterruptedException */ public boolean check() throws InterruptedException { return false; } }
-
Stop/Start Blocking User Input as Part of Script?
liverare replied to koboldNinja's topic in Scripting Help
I've come up with a solution using an JWindow to overlay on top of the game screen. This blocks mouse clicks, and the overlay is black and transparent, so you can still see what you're doing and know when you're clicks are being blocked. Additionally, only the game screen is blocked and not the bot control bar, so you can stop the script (which dismisses the overlay entirely). The overlay will reposition itself over the game screen when you hide/show it, not when you move the bot client around. Bare that in mind. You can add your own WindowListener to the bot canvas if you want, but I'm pretty sure the last thing you're doing when your swapping between your loadouts is moving the client about. TestScript.java import javax.swing.SwingUtilities; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "LiveRare", info = "", logo = "", name = "Block User Input", version = 0) public class TestScript extends Script { WindowOverlay wo; @Override public void onStart() throws InterruptedException { SwingUtilities.invokeLater(() -> { /* Initialise the window overlay */ wo = new WindowOverlay(bot.getCanvas()); }); } @Override public int onLoop() throws InterruptedException { /* Make sure the WindowOverlay exists before we use it */ if (wo != null) { /* Check whether mouse clicks are blocked*/ if (isRealMouseBlocked()) { /* TODO Switch gear */ hideWindowOverlay(); } else { /* TODO wait for request to fast-switch gear */ showWindowOverlay(); } } return 250; } @Override public void onExit() throws InterruptedException { /* VERY IMPORTANT - DISPOSE OF THE WINDOWOVERLAY!!! */ SwingUtilities.invokeLater(() -> { if (wo != null) { wo.dispose(); } }); } private synchronized boolean isRealMouseBlocked() { return wo.isVisible(); } private synchronized void showWindowOverlay() { wo.setVisible(true); } private synchronized void hideWindowOverlay() { wo.setVisible(false); } } WindowOverlay.java import java.awt.Color; import java.awt.Component; import javax.swing.JWindow; public class WindowOverlay extends JWindow { /** * */ private static final long serialVersionUID = 1L; private final Component component; public WindowOverlay(Component component) { super(); super.setSize(component.getSize()); super.setOpacity(0.314f); super.getContentPane().setBackground(Color.BLACK); this.component = component; } @Override public void setVisible(boolean b) { super.setVisible(b); if (b) { super.setLocation(component.getLocationOnScreen()); } } } With this, you should be able to write an entire kit-switching script for OSBot without the need for any other third-party macros. Although, I would look into creating your own bot mouse, because the default one may be too slow.