mikemouse2 Posted April 4, 2014 Share Posted April 4, 2014 Ok so i wanted to learn how scripts were made and i haven't seen a monkfish bot yet so i decided to attempt to make one and it doesn't work well, especially when it tries to bank. My knowledge of java is pretty limited so don't judge too harshly:) Any help would be appreciated! script: http://pastie.org/8933809 Link to comment Share on other sites More sharing options...
thelegacy0 Posted April 4, 2014 Share Posted April 4, 2014 (edited) Bank booths are objects. RS2Object bankBooth = closestObjectForName("Bank Booth"); client.moveCameraToEntity(bankBooth); sleep(random(300,600)); bankBooth.interact("Bank"); sleep(random(500,800)); If you want to use an NPC banker, just do NPC and closestNPCForName("Banker"); ALSO When you write a switch statement case FISHING: case WALKING_TO_FISH_AREA: case DOING_NOTHING: Will all do the same thing, it's the same as saying case FISHING && WALKING etc, so if you're trying to switch states, make sure you have break; in there so you define what state does what. Also, in your onLoop(), you want to outline when you're in what state: if(fullInventory()) { if(inBank()) { state = bank } else { state = walking; } } else { if(inFishingArea()) { state = fishing; } else { state = walking; } } I'm so noob, keep editing my post.. case WALKING_TO_BANK: return walkToBank(); break; int walkToBank() { if(BANK_AREA.contains(player)){ NPC bankbooth = closestNPC(BANK_BOOTH_ID); if(bank.isOpen()){ bank.depositAllExcept(303); whatAmIDoing = I_AM.DOING_NOTHING; }else{ if(bankbooth != null){ if(bankbooth.isVisible()){ bankbooth.interact("Bank"); sleep(random(700,800)); }else{ client.moveCameraToEntity(bankbooth); } } } } return 1000; } Edited April 4, 2014 by thelegacy0 1 Link to comment Share on other sites More sharing options...
mikemouse2 Posted April 4, 2014 Author Share Posted April 4, 2014 thanks so much!! Link to comment Share on other sites More sharing options...
thelegacy0 Posted April 4, 2014 Share Posted April 4, 2014 You're very welcome, keep us posted on your script! Link to comment Share on other sites More sharing options...
korato Posted April 9, 2014 Share Posted April 9, 2014 Bank booths are objects. RS2Object bankBooth = closestObjectForName("Bank Booth"); client.moveCameraToEntity(bankBooth); sleep(random(300,600)); bankBooth.interact("Bank"); sleep(random(500,800)); If you want to use an NPC banker, just do NPC and closestNPCForName("Banker"); ALSO When you write a switch statement case FISHING: case WALKING_TO_FISH_AREA: case DOING_NOTHING: Will all do the same thing, it's the same as saying case FISHING && WALKING etc, so if you're trying to switch states, make sure you have break; in there so you define what state does what. Also, in your onLoop(), you want to outline when you're in what state: if(fullInventory()) { if(inBank()) { state = bank } else { state = walking; } } else { if(inFishingArea()) { state = fishing; } else { state = walking; } } I'm so noob, keep editing my post.. case WALKING_TO_BANK: return walkToBank(); break; int walkToBank() { if(BANK_AREA.contains(player)){ NPC bankbooth = closestNPC(BANK_BOOTH_ID); if(bank.isOpen()){ bank.depositAllExcept(303); whatAmIDoing = I_AM.DOING_NOTHING; }else{ if(bankbooth != null){ if(bankbooth.isVisible()){ bankbooth.interact("Bank"); sleep(random(700,800)); }else{ client.moveCameraToEntity(bankbooth); } } } } return 1000; } I would do this all differently. What this does is force the script to do things that you can't control and are solely instance like and volatile. What you should do is only change states in the switch statement. When you start your script, you should have an IDLE state so that your script passes off the state for the first time and you go from there. I use a pre execution method, which is what I call it, because it's the method I run before I update the script and perform actions. ScriptState sState = State.IDLE; public void preExectutionRun(){ if(sState.equals(State.IDLE){ if(player inventory is full){ if(player is in bank){ sState = State.BANK_ITEMS; } if(player is in fishing area){ sState = State.GO_TO_BANK } } } //etc for if the inventory isn't full and //you have if statements for checking if //you are in bank or fishing area. } Then I use a switch statement to carry out the script actions. Within this switch function I can be VERY VERY specific in when it switches states and when to Queue for the next state. Drawn out example here. http://pastebin.com/ZpNMSh7K Link to comment Share on other sites More sharing options...