Jueix Posted March 13, 2023 Share Posted March 13, 2023 (edited) So everyone is hearing in the news lately about chat gbt and how it can write essays and do alot of things for you and to my surprise it can actually write you osbot scripts. You will need java knowledge in order to get the script fully working this is just an outline to get a basic script skeleton with whT you want done. Step 1: Make an account on chatGBT and ask it to write you a script, my script will be to cut oak logs. Then go to the bank. Add in that it needs to familiarise it self with the osbot API. It will say that but don't worry the script will come. It will look like that at first but it will give you example code. As you will see it will require you to fill out the coordinates and bank stuff. step 2: lets make it do something a little harder write us a script that will walk us around gnome agility course. Ask the ai to familiarise its self with a part of the game you would like to bot. Once it's done ask it to write you a script on that part of the game (may need to make a few tweaks yourself or describe better exactly what you want it to do). as you can see the code will appear but it will be using sleep(random) we want it to convert to conditional sleeps. step 3: getting it to fix the sleep(random) just as it to convert / change it into conditonal sleeps. You can also get it to fix other problems by asking it the same. You will need to make tweaks supplying coordinates and other things this just helps to give you a fast script to play with which you will need to edit a little to get working correctly. Note: this can also be done for the runelite API to make runelite plugins and for other clients ( this is not here to advertise them clients remove this if not allowed. ) Edit made it make me a basic green dragon killer. Here's how. I will leave it to you guys to figure out how to make it eat on low hp, and pick up the dragon bones and green d hide and run back to bank. Edited March 13, 2023 by Jueix Quote Link to comment Share on other sites More sharing options...
FushigiBot Posted March 13, 2023 Share Posted March 13, 2023 You can actually feed it the api, object, npc, etc info. The key to successfully using it to write a complex program is to write the workflow down and then ask it to write you short snippets for each part of the workflow. 1 Quote Link to comment Share on other sites More sharing options...
Jueix Posted March 13, 2023 Author Share Posted March 13, 2023 8 hours ago, FushigiBot said: You can actually feed it the api, object, npc, etc info. The key to successfully using it to write a complex program is to write the workflow down and then ask it to write you short snippets for each part of the workflow. Yea you can do that too. You can also ask it to convert the script to work with other clients as well (not advertising them). I asked it to write me a green dragon killing bot and it actually works okay. public class GreenDragonKiller extends MethodProvider { private static final int LOGOUT_THRESHOLD = 10; // The distance at which the bot will log out or teleport private static final int VARROCK_TELEPORT_ID = 8007; // The ID of the Varrock teleport item private static final int[] FOOD_IDS = { 379, 385, 7946 }; // The IDs of the food items to use @Override public int onLoop() throws InterruptedException { // Check for nearby players if (getPlayers().all().stream().anyMatch(p -> p.distance(myPlayer()) < LOGOUT_THRESHOLD)) { // If a player is detected, log out or teleport to Varrock if (getTabs().isOpen(Tab.LOGOUT)) { getTabs().logout(); } else { // Use the Varrock teleport if available, or log out if not if (getInventory().contains(VARROCK_TELEPORT_ID)) { getInventory().interact(VARROCK_TELEPORT_ID, "Break"); sleepUntil(() -> getTabs().isOpen(Tab.LOGOUT), random(5000, 10000)); } else { getTabs().logout(); } } return random(500, 1000); } // Check the player's health if (myPlayer().getHealthPercent() < 50) { // If the player's health is low, try to eat food from the inventory for (int foodId : FOOD_IDS) { if (getInventory().contains(foodId)) { getInventory().interact(foodId, "Eat"); sleep(random(500, 1000)); break; } } // If no food is available, run to the bank if (myPlayer().getHealthPercent() < 50 && !getInventory().contains(FOOD_IDS)) { getWalking().webWalk(new Area(3092, 3491, 3097, 3488)); sleepUntil(() -> getBank().isOpen(), random(5000, 10000)); getBank().depositAllExcept(FOOD_IDS); getBank().withdrawAll(FOOD_IDS); getBank().close(); } } // Locate the nearest Green Dragon NPC dragon = getNpcs().closest("Green Dragon"); // Attack the dragon if it is in range if (dragon != null && dragon.isVisible() && !myPlayer().isAnimating()) { if (getCombat().getFightMode() != Combat.FightMode.RANGED) { getCombat().setFightMode(Combat.FightMode.RANGED); } if (getCombat().isSpecialActivated()) { getCombat().toggleSpecialAttack(); } if (getCombat().attack(dragon)) { sleepUntil(() -> myPlayer().isAnimating(), random(2000, 3000)); } } return random(500, 1000); } } I then asked it to convert the above code into an other API and it done the same. (But sadly it crashed before it could finish). Sure, here's a modified version of the script that uses the "Removed name" API instead of the OSBot API: import net."removed in case of advertising".api.*; import net."removed in case of advertising".api.coords.WorldPoint; import net."removed in case of advertising".api.events.GameTick; import net."removed in case of advertising".client.callback.ClientThread; import javax.inject.Inject; public class GreenDragonKiller implements Runnable { private static final int LOGOUT_THRESHOLD = 10; // The distance at which the bot will log out or teleport private static final int VARROCK_TELEPORT_ID = 8007; // The ID of the Varrock teleport item private static final int[] FOOD_IDS = { 379, 385, 7946 }; // The IDs of the food items to use @Inject private Client client; @Inject private ClientThread clientThread; @Override public void run() { while (true) { try { Thread.sleep(600); } catch (InterruptedException e) { e.printStackTrace(); } clientThread.invoke(this::onGameTick); } } private void onGameTick() { Player localPlayer = client.getLocalPlayer(); // Check for nearby players if (client.getPlayers().stream().anyMatch(p -> p.getLocalLocation().distanceTo(localPlayer.getLocalLocation()) < LOGOUT_THRESHOLD)) { // If a player is detected, log out or teleport to Varrock if (client.getVar(Varbits.LOGOUT_OPEN) == 1) { client.invokeMenuAction("Logout", "", 0, 0, MenuAction.WIDGET_TYPE_1.getId(), 0); } else { // Use the Varrock teleport if available, or log out if not if (client.getItemContainer(InventoryID.INVENTORY).contains(VARROCK_TELEPORT_ID)) { client.invokeMenuAction("Break", "", client.getItemContainer(InventoryID.INVENTORY).getId(VARROCK_TELEPORT_ID), 0, MenuAction.ITEM_SECOND_OPTION.getId(), 0); clientThread.invokeLater(() -> client.getWidget(182, 12).getChild(1).interact("Continue")); } else { client.invokeMenuAction("Logout", "", 0, 0, MenuAction.WIDGET_TYPE_1.getId(), 0); } } return; } // Check the player's health if (localPlayer.getHealthRatio() < 0.5) { // If the player's health is low, try to eat food from the inventory for (int foodId : FOOD_IDS) { if (client.getItemContainer(InventoryID.INVENTORY).contains(foodId)) { ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); Item item = inventory.getItem(inventory.getId(foodId)); if (item != null) { client.invokeMenuAction("Eat", "<col=ffff00>" + item.getName() + "<col=ffffff>", item.getId(), 0, MenuAction.ITEM_FIRST_OPTION.getId(), 0); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } break; } } } // If no food is available, run to the bank if (localPlayer.getHealthRatio() < 0.5 && !client.getItemContainer(InventoryID.INVENTORY).containsAny(FOOD_IDS)) { clientThread.invokeLater(() -> { client.executeCommand("bank"); clientThread.invokeLater(() -> { Bank bank = client.getBank(); if (bank != null) { bank.depositAllExcept(FOOD_IDS); for (int foodId : That's where it got to before it crashed on converting the code. I literally asked it to get familiar with banks in runescape, the food ID's mostly used and how green dragons work and it wrote me that code and it actually works *Had to do a little tweak*. The next step in OSBOTing? Making AI write you the bots? 1 Quote Link to comment Share on other sites More sharing options...
MongooseFox Posted March 22, 2023 Share Posted March 22, 2023 Amazing, It would be a great idea to feed it with scripts, but when Chat starts writing super scripts, it will be a problem for their creators Quote Link to comment Share on other sites More sharing options...
castroed Posted June 7 Share Posted June 7 Thanks for the information! Quote Link to comment Share on other sites More sharing options...