Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help me with my monkfish script:)

Featured Replies

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

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 by thelegacy0

 

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

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.