The King Posted October 9, 2016 Share Posted October 9, 2016 (edited) Hey, Does anyone know how multi-thread works? Wanted to make some actions while walking like moving cameras and some other randomized stuff. thanks. Edited October 9, 2016 by The King Quote Link to comment Share on other sites More sharing options...
Mr Pro Pop Posted October 9, 2016 Share Posted October 9, 2016 (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 October 10, 2016 by Mr Pro Pop 1 Quote Link to comment Share on other sites More sharing options...
The King Posted October 10, 2016 Author Share Posted October 10, 2016 Thanks man it works but also does anyone have any other good methods ? Quote Link to comment Share on other sites More sharing options...
The King Posted October 10, 2016 Author Share Posted October 10, 2016 (edited) 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 October 10, 2016 by The King Quote Link to comment Share on other sites More sharing options...
Mr Pro Pop Posted October 10, 2016 Share Posted October 10, 2016 (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 October 10, 2016 by Mr Pro Pop Quote Link to comment Share on other sites More sharing options...
Solzhenitsyn Posted October 10, 2016 Share Posted October 10, 2016 (edited) Pro Pop... @@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 October 10, 2016 by Solzhenitsyn Quote Link to comment Share on other sites More sharing options...
The King Posted October 10, 2016 Author Share Posted October 10, 2016 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 Quote Link to comment Share on other sites More sharing options...
Solzhenitsyn Posted October 10, 2016 Share Posted October 10, 2016 (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 October 10, 2016 by Solzhenitsyn Quote Link to comment Share on other sites More sharing options...
The King Posted October 10, 2016 Author Share Posted October 10, 2016 (edited) Ohh thanks but I still don't get how to do it by bounding box as I am still a beginner on coding. If you would like could you please give me a full code ( Example of walking to an area with this ) so I can learn how to do it in the future ? @@Solzhenitsyn Edited October 10, 2016 by The King Quote Link to comment Share on other sites More sharing options...
Solzhenitsyn Posted October 10, 2016 Share Posted October 10, 2016 @@The King https://docs.oracle.com/javase/7/docs/api/java/awt/Point.html https://docs.oracle.com/javase/7/docs/api/java/awt/Rectangle.html Now you know how to use point and rectangle data types. Now go read the OSB manual and learn which methods use these data types. @@The King Quote Link to comment Share on other sites More sharing options...