Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Buy OSRS Gold

Search the Community

Showing results for tags 'snippet'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • TRiBot
    • News and Announcements
    • Old School Scripts
    • Help and Guidance
    • Development
    • Bugs and Errors
    • Tutorials
  • Scripters' Forums
    • Scripter Application
  • RuneScape®
    • General
    • Guides/Tutorials
    • Achievements
  • General
    • General
    • Questions
    • Discussions & Debates
    • Introductions
    • Suggestions
    • Feedback
  • The Black Market
    • Disputes
    • Repository Credits
    • Gold Exchange
    • Item Exchange
    • Membership Sales
    • Services
    • Other
    • Middleman Services

Blogs

  • Getting Started With TRiBot
  • The Best Way To Get Rid Of Termites
  • How to Generate Real Estate Leads Using Twitter
  • A Guide to Landing Pages
  • Dog Grooming in Sydney – 5 steps to finding a grooming salon
  • Cheap RS 2007 Gold for Spring 2020!
  • Logo Design Mistakes- Your Business Should Avoid at All Cost
  • Effective Pest Control Measures
  • В Алматы карантин из-за коронавируса: жизнь в условиях пандемии
  • Preschool Educational Toys, Helping One's Child Prepare For the Future
  • Automating Tribot
  • Payment error
  • Animal Crossing: New Horizons Cuts Player Interest Rates
  • network-security-engineer
  • SERVICES 100% BY HAND
  • The best place to buy Animal Crossing Bells
  • Major Content of Escape from Tarkov Patch 0.12.5.6924 Optimizations
  • You need to rest properly when playing Rocket League
  • Escape from Tarkov hits 200k concurrent players
  • List of Rocket League Ranking System
  • Should I need to run a paid ad campaign, when organically I rank well?
  • Rocket League SPRING SERIES: EUROPE TAKEAWAYS
  • How to play Rocket League
  • Twitch Drops Come Back in Escape from Tarkov
  • The Path of Exile game features
  • Be more seen
  • Rocket League Took Actions to Fight Racism and Discrimination in the Game 
  • Rocket League camera setting 
  • Animal Crossing -List of Wedding Season Rewards
  • What WoW Classic race and sophistication is best?
  • FIFA 21 Coming to Steam
  • The Ideal Place for Global Players to Buy and Sell Rocket League Items 
  • Customize furniture in Animal Crossing: New Horizons
  • ABOUT NBA 2K20
  • Purchase Cheap RL Items from Lolga.com to set aside bunches of Cash 
  • Ethan Smith
  • How much does WoW Classic cost?
  • Special Olympics NY partners with Mission Control for Rocket League competitions
  • Rocket League:Premium Challenges and Rewards
  • The things Psyonix has made for this occasion are generally birthday-themed
  • Epic Games Store version of Rocket League
  • The Rocket League people group quickly got their pitchforks and took to Reddit
  • The arrival of cross-platform progression means changes to player-to-player trading
  • will Rocket League Credits stay dynamic

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


Bio

Found 8 results

  1. I decided to create my own banking API that mimics tribots way of implementing the API as much as possible. Basically it would only contain nothing more than just method calls. Simple and easy to use. This API is a reworked version that is currently in my jHerblore script. I intend to release my GE api as well once I have finished that one up too. The API requires DaxWalker & Wastedbro's Item Price API. Other than that the rest is achieveable with standard dependencies that already comes with tribot. All of the method names are the same as the ones from Banking & GrandExchange class in tribot, with a few exceptions, the only difference is that these methods are called with different class names such as Banker & Exchanger, so they do not collide with the Banking & GrandExchange class of tribot and cause an ambiguity problem. List of available methods: Some of the features this API offers: - Methods that incorporate any form of withdrawing or depositing do not need you to first check if the bank is open nor if it is loaded. It will attempt to open the bank if it is not open before returning false, and wait for bank to load if it is not loaded yet. - Methods that incorporate any form of buying or selling do not need you to first check if the exchange window is open. It will attempt to open the exchange window if it is not open before returning false. - Deselector. All methods that require the mouse to click somewhere on the screen first check if an item or spell is selected, if it is then it will deselect whatever is selected before attempting the requested action. - Additional failsafes, not just the deselector. Tribots banking api does not know if what you were trying to click actually was succesfully clicked. Instead it views succesfully calling the click function as a succesfull attempt. It's kind of like playing pin the nail to the donkey game. It does not know if it pinned it at the right location, but as long as it pinned it the function returns true. This is not true for all methods, some methods do actually check if the action was succesfully performed, however they do not reattempt the action if it failed. 1 call = 1 attempt. My api will reattempt any action that might fail, several times, before returning false and will also wait until inventory count is updated. For example using the tribot banking API if you were to deposit all your items and then immediately check your available inventory space before withdrawing items then it might not work as you wish because Banker.depositAll() returns before the action of depositing has finished. - When banking, closes GrandExchange window if it is open. - When buying/selling, closes the bank screen if it is open. - Support for withdrawing items in noted format and with or without stack exception. Stack exception is basically if you wish to draw X amount of items in your inventory but you only had Y left, then you can choose if you wish to draw these items or not. Also supports depositing of noted item ids if you happen to pass a list with of items that contains items of unnoted item ids, but the item in your inventory is a noted version of the item in your inventory. Also will not deposit equipment or items if you have none equipped or in your inventory. There is a total of 4 different depositing methods and 16 different withdrawing methods. - Unique dynamic sleeping method, all methods that should sleep already have sleeps implemented so you do not need to call a sleep after executing any of the methods. Involves random varying sleeps but will occasionally, every so often, in a irregular pattern, sleep a bit longer. I use this because I prefer it over General.sleep(). Feel free to replace it with whichever method you wish. Remember before running the main loop in your script to call: jGeneral.get().generateSeed(); This will create a random number between 0-100 that will be added to your dynamic sleeps in milliseconds. This is so no bot has the same average reaction/sleeping time. - When buying items on the GE, if the bot does not have any money or too little money in the inventory, it will check if you have enough of the missing amount in the bank and withdraw that amount. - Custom buying method that checks for an exact string match of the item you wish to buy and chooses that one from the returned items in the buy window search box. The standard GE api does not do this and will for instance click the wrong herb when it searches for "Guam leaf" in the grand exhcange, this is because more than one item contains "guam leaf" in their name. Such as Grimy guam leaf and so on. - Profit tracking when buying/selling items on the GE. This is optional. GET THE SOURCE HERE! UPDATES: - Pushed new updates that fix some of the methods that I've tested a bit for now, bit of logic and efficiency improvements. Also added 2 new depositing methods. Remember to replace the old java files with the new ones. - Pushed even more updates. Fixed interface problem for withdrawing noted items. My GE api is now also been released to the public. Enjoy!
  2. JoeDezzy1

    Login Helper

    In the past, I've experienced consistency issues with certain methods in the API that return false/inconsistent information on certain occasions, especially upon logins. Here is something I've created a while ago that became very useful to combat that issue. import org.tribot.api.General; import org.tribot.api2007.Game; import org.tribot.api2007.Login; /** * @author JDezzy1 */ public class LoginAccess extends Login implements Access { /** * The amount of settings in the gamesettings array to confirm consistency * in ingame data */ public static final transient int settingsArrayLength = 70; /** * The ban message upon logging in */ public static final transient String BAN_HOOK = "Your account has been disabled. Please check your message-centre for details."; /* * (non-Javadoc) * * @see scripts.dezapi.wrappers.accessor.Access#access() */ @Override public Class<Login> access() { return Login.class; } /** * @return true if in game */ public static boolean inGame() { final STATE ST8 = getLoginState(); return ST8 != null && ST8.equals(STATE.INGAME); } /** * @return true if at the login screen */ public static boolean inLoginScreen() { final STATE ST8 = getLoginState(); return ST8 != null && ST8.equals(STATE.LOGINSCREEN); } /** * @return true if at the welcome screen */ public static boolean inWelcomeScreen() { final STATE ST8 = getLoginState(); return ST8 != null && ST8.equals(STATE.WELCOMESCREEN); } /** * @return true if there is a ban message */ public static boolean banMessage() { final String response = Login.getLoginResponse(); return response != null && response.equals(BAN_HOOK); } /** * Does what it says * * @return Game setting.length > ~70 plus all other hooks */ public static boolean isEverythingFuckingLoadedAndReadyToBeRead() { return !inWelcomeScreen() && inGame() && Game.getGameState() == 30 && Game.getSettingsArray().length >= settingsArrayLength; } /** * @return true if the login was successful */ public static boolean waitLogin() { return Waiting07.waitCondition(() -> { return isEverythingFuckingLoadedAndReadyToBeRead(); }, System.currentTimeMillis() + General.randomSD(35000, 45000, 4250)); } /** * @return true if the logout was successful */ public static boolean waitLogout() { return Waiting07.waitCondition(() -> { return inLoginScreen(); }, System.currentTimeMillis() + General.randomSD(35000, 45000, 4250)); } /** * * @param user * @param pass * @return */ public static boolean handleLogin(final String user, final String pass) { General.println("Login => attempting login => " + user); if (login(user, pass)) { General.println("Login => waiting for login..."); if (waitLogin()) { General.println("Login => logging in => successful login"); return true; } } return false; } }
  3. One of the most advantageous things you can do in programming is D.R.Y. (Don't Repeat Yourself!) In our scripts, we can practice this by centralizing certain data constants within Enums, and adding in helper methods that will shorten our functioning code and create a level of abstraction that will make script maintenance a breeze. For this tutorial, I will just be showing a simple Item enum: public enum Items { LEATHER(1741), HARD_LEATHER(1743), GREEN_LEATHER(1745), BLUE_LEATHER(2505), RED_LEATHER(2507), BLACK_LEATHER(2509), COINS(995); private final int ID; private Items(int id) { this.ID = id; } public int getID() { return ID; } public int getNotedID() { return RSItemDefinition.get(ID).getNotedItemID(); } public RSItemDefinition getDefinition(){ return RSItemDefinition.get(ID); } } This is for a Tanning script. As you can see, we name each constant by its full name to avoid naming collisions/confusion. In an Item enum, the only required data is a Unique ID for each item. With this, we can create several helper functions that might be specific to the script., but the above is a good base for about any script. "Why not just use item id's and the standard API's methods you idiot? This is a waste of time..." As I said before, the above is a very introductory example, but here is a more complex application of the above idea using Interfaces. public enum Interfaces implements Clickable { TANNING_SOFT_LEATHER(324, 124), TANNING_BLACK_LEATHER(324, 131); private final int PARENT; private final int CHILD; private final int COMPONENT; private Interfaces(int parent, int child, int component) { this.PARENT = parent; this.CHILD = child; this.COMPONENT = component; } private Interfaces(int parent, int child) { this.PARENT = parent; this.CHILD = child; this.COMPONENT = -1; } private Interfaces(int parent) { this.PARENT = parent; this.CHILD = -1; this.COMPONENT = -1; } public int getParent() { return this.PARENT; } public int getChild() { return this.CHILD; } public int getComponent() { return this.COMPONENT; } /** * Check whether or not the interface is not null, and not hidden * * @return true if interface is open and visible, false if null, false * if hidden */ public boolean isOpen() { /* Null check Interface tree in descending order*/ if (org.tribot.api2007.Interfaces.get(PARENT) == null) { return false; } if (CHILD != -1 && org.tribot.api2007.Interfaces.get(PARENT).getChild(CHILD) == null) { return false; } if (COMPONENT != -1 && org.tribot.api2007.Interfaces.get(PARENT).getChild(CHILD).getChild(COMPONENT) == null) { return false; } /* Component.isHidden() check on Interface tree in ascending order*/ if (COMPONENT != -1) { return !org.tribot.api2007.Interfaces.get(PARENT).getChild(CHILD).getChild(COMPONENT).isHidden(); } if (CHILD != -1) { return !org.tribot.api2007.Interfaces.get(PARENT).getChild(CHILD).isHidden(); } return !org.tribot.api2007.Interfaces.get(PARENT).isHidden(); } /** * Attempts to click the interface component using the given option * * @param option the option to click on the component * @return true if we clicked the component, false otherwise */ @Override public boolean click(String[] option, Point randomness, Point offset) { if (isOpen()) { if (COMPONENT != -1) return org.tribot.api2007.Interfaces.get(PARENT).getChild(CHILD).getChild(COMPONENT).click(option, randomness, offset); if (CHILD != -1) return org.tribot.api2007.Interfaces.get(PARENT).getChild(CHILD).click(option, randomness, offset); return org.tribot.api2007.Interfaces.get(PARENT).click(option, randomness, offset); } return false; } @Override public boolean click(String... option) { return click(option, null, null); } @Override public boolean click(String option, Point randomness, Point offset) { return click(option, randomness, offset); } @Override public boolean hover() { return hover(null, null); } @Override public boolean hover(Point randomness, Point offset) { if (isOpen()) { /* Component.isHidden() check on Interface tree in ascending order*/ if (COMPONENT != -1) return !org.tribot.api2007.Interfaces.get(PARENT).getChild(CHILD).getChild(COMPONENT) .hover(randomness, offset); if (CHILD != -1) return !org.tribot.api2007.Interfaces.get(PARENT).getChild(CHILD).hover(randomness, offset); return !org.tribot.api2007.Interfaces.get(PARENT).hover(randomness, offset); } return false; } } Now as you can see this is far more useful in code. We can overload the constructor method of the enum to accept all types of interface components from Parent to Children, to Components. This allows us to directly path to the component we want, similar to org.tribot.api2007.Interfaces.get(int parent, int child). Also, we can implement the Clickable interface to get access to all mouse functionality commonly used within scripts, meaning we can now SAFELY click interfaces within our scripts like so: Constants.Interfaces.CONSTANT.click() There are other things this can be applied to such as NPCs and Objects, but I will let you code your on versions of those An easy way to manage all of your scripts constants (assuming it is a reasonable amount of code, under 500 lines) is to put all of your enums inside of a Constants class. This will allow you to easily manage imports and give access to all your constants with one import. Thank you for taking the time to read this and if you have any questions, comments, concerns, flame, trihards, or otherwise feel free to reply or send me a PM and I will get back to you ASAP. -Guki
  4. Description: I thought some new scripters might find this useful. So I rewrote @TehRhio's old shop api since it's #getAll method was outdated. Original Thread: Snippet: import org.tribot.api.Timing; import org.tribot.api.types.generic.Condition; import org.tribot.api2007.Interfaces; import org.tribot.api2007.Inventory; import org.tribot.api2007.types.RSInterfaceChild; import org.tribot.api2007.types.RSInterfaceComponent; import org.tribot.api2007.types.RSItem; import org.tribot.api2007.types.RSItemDefinition; import java.awt.*; import java.util.ArrayList; import java.util.Arrays; public class OSShopping { private static final int MASTER_ID = 300; private static final int FRAME_CHILD_ID = 1; private static final int ITEMS_CHILD_ID = 2; public static boolean isShopOpen() { return Interfaces.get(MASTER_ID, ITEMS_CHILD_ID) != null; } public static String getShopName() { RSInterfaceChild frame = Interfaces.get(MASTER_ID, FRAME_CHILD_ID); if (frame != null) { return frame.getText(); } return ""; } public static boolean close() { RSInterfaceChild frame = Interfaces.get(MASTER_ID, FRAME_CHILD_ID); if (frame != null) { RSInterfaceComponent closeButton = frame.getChild(11); return closeButton != null && closeButton.click("Close") && Timing.waitCondition(new Condition() { @Override public boolean active() { return !isShopOpen(); } }, 2000); } return false; } public static RSItem[] getAll() { ArrayList<RSItem> itemList = new ArrayList<>(); RSInterfaceChild itemsChild = Interfaces.get(MASTER_ID, ITEMS_CHILD_ID); if (itemsChild != null && itemsChild.getChildren() != null) { for (int i = 0; i < itemsChild.getChildren().length; i++) { RSInterfaceComponent itemComponent = itemsChild.getChild(i); if (itemComponent != null && !itemComponent.isHidden()) { final int garbageLength = 11; String name = itemComponent.getComponentName(); Rectangle bounds = itemComponent.getAbsoluteBounds(); if (name != null && name.length() >= garbageLength && bounds != null) { RSItem item = new RSItem(name.substring(garbageLength).replace("</col", ""), itemComponent.getActions(), itemComponent.getIndex(), itemComponent.getComponentItem(), itemComponent.getComponentStack(), RSItem.TYPE.OTHER); item.setArea(bounds); itemList.add(item); } } } } return itemList.toArray(new RSItem[itemList.size()]); } public static boolean contains(String... names) { return get(names).length > 0; } public static boolean contains(int... ids) { return get(ids).length > 0; } public static RSItem[] get(String... names) { ArrayList<RSItem> items = new ArrayList<>(); for (RSItem i : getAll()) { RSItemDefinition definition = i.getDefinition(); if(definition != null && Arrays.asList(names).contains(definition.getName())) { items.add(i); } } return items.toArray(new RSItem[items.size()]); } public static RSItem[] get(int... ids) { ArrayList<RSItem> items = new ArrayList<>(); for (RSItem i : getAll()) { if(Arrays.asList(ids).contains(i.getID())) { items.add(i); } } return items.toArray(new RSItem[items.size()]); } public static int getCount(String... name) { int total = 0; for (RSItem item : get(name)) { total += item.getStack(); } return total; } public static int getCount(int... id) { int total = 0; for (RSItem item : get(id)) { total += item.getStack(); } return total; } public static boolean buy(int amount, String name) { RSItem[] items = get(name); RSItem item = items.length > 0 ? items[0] : null; return item != null && item.getStack() > 0 && exchangeItem(amount, "Buy", item); } public static boolean buy(int amount, int id) { RSItem[] items = get(id); RSItem item = items.length > 0 ? items[0] : null; return item != null && item.getStack() > 0 && exchangeItem(amount, "Buy", item); } public static boolean sell(int count, String name) { RSItem[] items = Inventory.find(name); return items.length > 0 && exchangeItem(count, "Sell", items[0]); } public static boolean sell(int count, int id) { RSItem[] items = Inventory.find(id); return items.length > 0 && exchangeItem(count, "Sell", items[0]); } private static boolean exchangeItem(int amount, String action, RSItem item) { if (amount >= 50 && action.equals("Sell")) { return item.click(action + " 50"); } else if (amount >= 10) { return item.click(action + " 10"); } else if(amount >= 5) { return item.click(action + " 5"); } else { return item.click(action + " 1"); } } }
  5. This is a helper class I wrote that helps you manipulate and generate strings in java.
  6. ActionManager: public class ActionManager extends Thread { //Java 8 static method references public static class Flags { public static final Supplier<String> PREVENT_WINDOWS = ActionManager::preventWindows; public static final Supplier<String> CHECK_XP = ActionManager::checkXP; public static final Supplier<String> AVOID_PLAYERS = ActionManager::avoidPlayers; } private Script _runningScript; private Action[] _actions; public ActionManager(Script $script, Action[] $actions) { this._runningScript = $script; this._actions = $actions; } @Override public void run() { this.initialization(); //TODO: Needs an exit point? while(true) { this.manageActions(); } } private void initialization() { this._runningScript.println(Messages.ActionManager.INITIALIZATION); } private void manageActions() { for (int $actionIdx = 0; $actionIdx < this._actions.length; $actionIdx++) { Action $currentAction = this._actions[$actionIdx]; if ($currentAction.thread.isAlive()) { if ($currentAction.active) { for (int $flagIdx = 0; $flagIdx < $currentAction.flags.length; $flagIdx++) { String $flagResult = $currentAction.flags[$flagIdx].get().toString(); if ($flagResult != Messages.SUCCESS) { $currentAction.active = false; } } } else $currentAction.thread.interrupt(); } else if ($currentAction.active) $currentAction.thread.start(); } } ... //Proper use of ActionManager is to predefine your actions in the constructor /*public Boolean addAction(Action $action) { this._actions[this._actions.length] = $action; }*/} Action: public class Action { public String name; public Thread thread; public Supplier[] flags; public Boolean active; public Action(String $name, Thread $action, Supplier[] $flags) { this.name = $name; this.thread = $action; this.flags = $flags; this.active = false; }}Usage: private void initialize() { this.println(Messages.INITIALIZATION); this._dropItems = new Action( Messages.DropItems.NAME, new DropItems(this, GameItems.ITEM_A), new Supplier[] {ActionManager.Flags.PREVENT_WINDOWS}); this._bankItems = new Action( Messages.BankItems.NAME, new BankItems(this, new int[] {GameItems.ITEM_B, GameItems.ITEM_C})); this._stealItems = new Action( Messages.StealItems.NAME, new StealItems(this, new int[] {GameObjects.OBJECT_A, GameObjects.OBJECT_B}), new Supplier[] {ActionManager.Flags.AVOID_PLAYERS, ActionManager.Flags.PREVENT_WINDOWS}); this._actionManager = new ActionManager(this, new Action[] {this._dropItems, this._bankItems, this._stealItems}); this._actionManager.start();}if (Inventory.isFull() && !this._dropItems.active) { //Allow the Action to be started by ActionManager this._dropItems.active = true;}Useful for pausing time consuming single-run operations like Inventory.drop() to handle cases which should be defined as static methods and referenced in ActionManager.Flags using Java 8 method references (see https://docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html for the type you should be using depending on the cases you define)
  7. Can anyone make a worldhop snippet that can actually work flawlessly? tried using some old ones but end up with errors/getting stuck Ingame/normal hopping doesn't really matter.
  8. One of my favorite ways of minimizing ban rate is to call various switch statements in my methods. Most of this is just general knowledge, but I feel like sometimes it's overlooked. This snippet is for joining and idling in clan chats. First we create a method for opening up the interface. private void joinChat(){ GameTab.open(GameTab.TABS.CLAN); sleep(200,300); } Obviously this is a very poorly written method, as it had no checks as to whether the tab is already open, or if it's already in a clan chat. To improve it, let's add a check to see if it's already in a clan chat. Remember, this is necessary because if we call this method in our onStart(), it will execute every time the script starts. If it's already in a clan chat and you restart a script, it will leave the chat and then type the name. private void joinChat(){ GameTab.open(GameTab.TABS.CLAN); sleep(200,300); if(isntInClanChat()){ //Actions here }else //if isInClanChat is true, go back to the inventory. GameTab.open(GameTab.TABS.INVENTORY); } Now let's check if it's in a clan chat. RSInterfaceChild ChatName = Interfaces.get(589, 0 ); if (ChatName != null) if (ChatName.getText().contains("Not in chat")){ //actions }else GameTab.open(GameTab.TABS.INVENTORY); } Now let's implement our actions. private void joinChat(){ GameTab.open(GameTab.TABS.CLAN); sleep(200,300); RSInterfaceChild ChatName = Interfaces.get(589, 0 ); if (ChatName != null) if (ChatName.getText().contains("Not in chat")){ Mouse.click(580, 449, 1); sleep(1000,1500); chatChooser(); sleep(100,200); GameTab.open(GameTab.TABS.INVENTORY); sleep(200,300); }else GameTab.open(GameTab.TABS.INVENTORY); } As I said in the code, coord clicking is really never ok, and you should always try to use interfaces. But, for the purpose of this tutorial it's ok. As you can see, I've added an action (Mouse.click(580, 449, 1) . This is what clicks "Join Chat". Then, I call a chatChooser() method, which we will create next. After that, I reopen the inventory tab and the code finishes. Now let's create the chatChooser() method. private void chatChooser() { status = ("Joining clan chat..."); int random = General.random(1, 4); switch(random){ case 1: println("Chose Sparc Mac CC"); Keyboard.typeSend("Sparc Mac"); sleep(300,600); break; case 2: println("Chose So Wreck3d CC"); Keyboard.typeSend("So Wreck3d"); sleep(300,600); break; case 3: Keyboard.typeSend("Mod Mark"); sleep(300,600); break; case 4: println("Chose NightmareRH CC"); Keyboard.typeSend("NightmareRH"); sleep(300,600); break; } } This method is different from the others; It's actually a switch statement. If your bots just joined the exact same clan every time, it would be kind of fishy. Therefore, the method would be bad. So what I've done is created 4 different options of clans. Obviously you can add more if you wish, I'm sure you can figure out how. When the method is called, it selects a random number 1-4 int random = General.random(1, 4); and then it calls the number switch(random){ and then does the actions called. Let's say it selected the number 2. case 2: println("Chose So Wreck3d CC"); Keyboard.typeSend("So Wreck3d"); sleep(300,600); break; First, it will print in the log what FC it chose. Then, I use Keyboard.typeSend to type the string "So Wreck3d". I add a sleep for any delay, and then the code completes. So, now the code can choose between any of those 4 fcs. And you are done! Here's the finished code (make sure to put it in your onStart): private void joinChat(){ GameTab.open(GameTab.TABS.CLAN); sleep(200,300); if(isInClanChat()){ Mouse.click(580, 449, 1); sleep(200,300); chatChooser(); sleep(200,300); GameTab.open(GameTab.TABS.INVENTORY); sleep(200,300); }else GameTab.open(GameTab.TABS.INVENTORY); } private boolean onStart(){ joinChat();//other stoof return true; //for my code, might not need this. } Enjoy! EDIT: As pointed out by Arckos, if the clan chat is full it will error out. Here is a solution to this: 1. Import MessageLIstener for 07 2. Declare this: boolean isFull; 3. Add this into the generated code: @Override public void serverMessageRecieved(String arg0) { if(arg0.contains("Clan")){ isFull = true; }else isFull = false; } 4. Modify joinChat() method: private void joinChat(){ GameTab.open(GameTab.TABS.CLAN); sleep(200,300); RSInterfaceChild ChatName = Interfaces.get(589, 0 ); if (ChatName != null) if (ChatName.getText().contains("Not in chat")){ Mouse.click(580, 449, 1); sleep(1000,1500); if(isFull != true){ chatChooser(); }else{ println("Chat was full, attempt #2..."); Mouse.click(580, 449, 1); sleep(1000,1500); chatChooser(); } sleep(100,200); GameTab.open(GameTab.TABS.INVENTORY); sleep(200,300); }else GameTab.open(GameTab.TABS.INVENTORY); } Enjoy ^^
×
×
  • Create New...