Jump to content

[Multi Thread] Action


The King

Recommended Posts

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
Link to comment
Share on other sites

Okay I have one more question,

If I want to walk from Lumbridge to draynor village or something and wanted to take it by 2 steps like it stops in the half of the destination to do an action and then continue walking the rest of the destination, How will I do it ?

 

@@Imateamcape

@@Mr Pro Pop

@@venetox

Edited by The King
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Pro Pop... facep.gif

 

@@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.

Edited by Solzhenitsyn
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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