Jump to content

[Multi Thread] Action


Recommended Posts

Posted (edited)

Maybe try this, Make a new class with the following code.

package osbot;
import org.osbot.rs07.script.MethodProvider;

public class Multi implements Runnable {

    private final MethodProvider script;

    public Multi(MethodProvider script) {
        this.script = script;
    }

public void run() {

        while (script.myPlayer().isMoving()) {

//Action --> Script.

     }
 
        }
  }  

In your script file add this

new Thread(new Multi(this)).start(); 

Here this is one of the snippets which I always use.

I hope it helps, Let me know!

Edited by Mr Pro Pop
  • Like 1
Posted (edited)

I am not really sure.

 

Maybe you could do it by 2 times like make 2 areas ( Area 1 then Area 2 ) so it walks to a1 firstly to do an action there and then starts walking to a2.

also to randomize it so it doesn't do the same thing as always I would recommend adding a random area in a1 like the x you wanted +random(1,10) and y+random(1,10) so it doesn't stop at the same place as always.

 

This will make it going far away from the area within 1-10 steps.

but may I know what do you need that for and what will be the usage of that?

 

Good luck!

Edited by Mr Pro Pop
Posted

Could you show me how pl

 

 

@@The King

1) Issue move command using minimap tile destination

2) Execute action

 

Conditional:

3a) Issue move command to next minimap tile, if minimap tile exists.

3b) Otherwise, Issue move command to original position to cancel animation.

 

Could you show me how please ?

Give me an example code of how it works

Posted (edited)

1) Instantiate mmtd

http://osbot.org/api/org/osbot/rs07/input/mouse/MiniMapTileDestination.html

MinimapTileDestination mmtd = new MiniMapTileDestination(org.osbot.rs07.Bot bot, Position position)
// ctor

2) Get data from mmtd

// Method 1: use bounding box
mmtd.getBoundingBox()

// Method 2: use point
mmtd.getPoint()

4) Execute move instruction - think, what do I do with a point or rectangle?

5) Execute action instruction

6) Conditional sleep

7) Perform nullity and existential checks to determine what you should do next

 

That should be more than enough to get started. When I was starting, I didn't understand why spoonfeeding is terrible. It is terrible. 

 

Edited by Solzhenitsyn

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...