August 6, 201510 yr I kinda need help with a tanning script i wrote, whenever I launch it via OSbot i get a couple of error messages and since im new to this all info and help would be accepted, thanks in advance. package tanHide; import java.awt.Graphics; import org.osbot.rs07.script.Script; import org.osbot.rs07.api.Bank; import org.osbot.rs07.api.Inventory; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Andrey", info = "Tans hides(osrs_f2p)", logo = "kek", name = "Hide_tanner", version = 0.1) public class TanHide extends Script { //executes code final Area BANK_AREA = new Area(3272,3173,3269,3161); final Area TAN_AREA = new Area(3270,3189,3277,3194); final int BANK_BOOTH_ID=396; final int ELLIS_ID=3231; public void onStart(){ } //code executed at end public void onExit(){ } Inventory inven = client.getMethods().getInventory(); Player player = client.getMethods().myPlayer(); Bank bank = client.getMethods().getBank(); //code in loop, goes into bank, takes hide, goes to tanner and back public int onLoop() throws InterruptedException { //banker interaction if(inven.isEmptyExcept(995)){ if(BANK_AREA.contains(player)){ NPC banker = npcs.closest(BANK_BOOTH_ID); if(bank.isOpen()){ bank.withdrawAll(1739); }else{ if(banker!=null){ if(banker.isVisible()){ banker.interact("Bank"); sleep(random(700,800)); } } } }else{ getLocalWalker().walk(BANK_AREA,true); } }else{ //tanner interaction getLocalWalker().walk(TAN_AREA,true); NPC ellis = npcs.closest(ELLIS_ID); NPC banker = npcs.closest(BANK_BOOTH_ID); if(ellis!=null){ if(ellis.isVisible()){ ellis.interact("Trade"); sleep(random(700,800)); ellis.getMethods().getWidgets().getWidgetContainingText("Hard Leather").interact("All"); getLocalWalker().walk(BANK_AREA,true); if(banker!=null){ if(banker.isVisible()){ banker.interact("Bank"); sleep(random(700,800)); bank.depositAllExcept(995); } } } } } return 50; } //paint public void onPaint(Graphics g){ } }
August 6, 201510 yr Impossible to read haha! format the code then copy and paste it using the code posting button (<€ >) might be easier to help u then
August 6, 201510 yr Author package tanHide; import java.awt.Graphics; import org.osbot.rs07.script.Script; import org.osbot.rs07.api.Bank; import org.osbot.rs07.api.Inventory; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Andrey", info = "Tans hides(osrs_f2p)", logo = "kek", name = "Hide_tanner", version = 0.1) public class TanHide extends Script { //executes code final Area BANK_AREA = new Area(3272,3173,3269,3161); final Area TAN_AREA = new Area(3270,3189,3277,3194); final int BANK_BOOTH_ID=396; final int ELLIS_ID=3231; public void onStart(){} //code executed at end public void onExit(){} Inventory inven = client.getMethods().getInventory(); Player player = client.getMethods().myPlayer(); Bank bank = client.getMethods().getBank(); //code in loop, goes into bank, takes hide, goes to tanner and back public int onLoop() throws InterruptedException { //banker interaction if(inven.isEmptyExcept(995)){ if(BANK_AREA.contains(player)){ NPC banker = npcs.closest(BANK_BOOTH_ID); if(bank.isOpen()){ bank.withdrawAll(1739); }else{ if(banker!=null){ if(banker.isVisible()){ banker.interact("Bank"); sleep(random(700,800)); } } } }else{ getLocalWalker().walk(BANK_AREA,true); } }else{ //tanner interaction getLocalWalker().walk(TAN_AREA,true); NPC ellis = npcs.closest(ELLIS_ID); NPC banker = npcs.closest(BANK_BOOTH_ID); if(ellis!=null){ if(ellis.isVisible()){ ellis.interact("Trade"); sleep(random(700,800)); ellis.getMethods().getWidgets().getWidgetContainingText("Hard Leather").in teract("All"); getLocalWalker().walk(BANK_AREA,true); if(banker!=null){ if(banker.isVisible()){ banker.interact("Bank"); sleep(random(700,800)); bank.depositAllExcept(995); } } } } } return 50; } //paint public void onPaint(Graphics g){ } } Would this help? Edited August 6, 201510 yr by MightySir2
August 6, 201510 yr Author Oh yeah another thing, it tells me Failed to start script [insertscripthere] regardless of what i execute
August 6, 201510 yr I don't even know where to start Well... first of all, this: Inventory inven = client.getMethods().getInventory(); Player player = client.getMethods().myPlayer(); Bank bank = client.getMethods().getBank(); What are you trying to do here? You already have access to the inventory by calling, for example, inventory.contains() directly. Same for player and bank. The reason the script doesn't start is that client doesn't exist yet, any initialization should be done in onStart. if(inven.isEmptyExcept(995)){ Should just use inventory.isEmptyExcept(995). if(BANK_AREA.contains(player)){ You have access to the local player through myplayer() ellis.getMethods().getWidgets().getWidgetContainingText("Hard Leather").in teract("All"); All methods are already accessible from the script itself. You can directly call : getWidgets().getWidgetContainingText("Hard Leather").interact("All"); Also, banking can simply be done by calling bank.open(), you don't have to do there interaction yourself Edited August 6, 201510 yr by Flamezzz
August 6, 201510 yr Author Thanks, I realized what I did wrong, anyways I started a new script from scratch using state/enum, and everything is functional so far.
August 7, 201510 yr Author another question, , how do i go about interacting(al kharid ellis tanner in my case) a widget? and finally how do improve my walking and interacting code to prevent ban?
Create an account or sign in to comment