How To Create A Rsbot ( Java Script )

Discussion in 'RuneScape Guide & eBook Sales' started by OmfgZomfglol, Sep 26, 2008.

Thread Status:
Not open for further replies.
How To Create A Rsbot ( Java Script )
  1. Unread #1 - Sep 26, 2008 at 3:19 AM
  2. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    Hello And Welcome To My Little Guide TO Help you make your First script :)

    Chapters :

    1.Script Outline
    2.walking
    3.Object And NPC finding


    ______________


    CHAPTER 1
    :


    This is a blank and most basic script. A new script must follow this format for it to be able to compile. It must implement all methods here.


    Code:
    import com.speljohan.rsbot.script.*;
    import com.speljohan.rsbot.script.wrappers.*;
    
    
    
    public class blank extends Script{
    
        public String getName() {
            return "Basic Script";
        }
    
    
    
        public String getAuthor() {
            return "~alex~";
        }
    
        public double getVersion() {
            return 0;
        }
    
        public boolean onStart(String[] args) {
            return true;
        }
    
        public int loop() {
            return 0;
        }
    
    }
    
    

    Thanks For ~ Alex ~ for The Skeleton !



    ___________________________________________



    Chapter 2
    :


    walking
    Making a script walking from location to location is easy in RsBot. Because it has the ability to read data from the client it can use Tiles for walking. In this tutorial I'm going to be showing you how to create an RSTilePath and use that to walk to a location.

    Firstly I'm going to create a blank script

    Now we will declare a new array of tiles. If you do not understand what an array is I suggest you Google it :D.

    (
    Code:
    RSTile[] myTile = new RSTile[]{};
    
    Now we need to get the tiles we want. To do this load up RsBot and start a bot. Ensure that player position is selected as the debug menu. You can see your players' current coordinates printed on the applet. Collect some coordinates and note them down. Here is a list that I've collected:

    3222,3219
    3235,3223
    3230,3231
    3221,3239
    3215,3243
    These are a series of waypoints from lumbridge castle to the general store. Now we will add these to our array of RSTiles.

    Code:
    RSTile[] myTiles = new RSTile[]{new RSTile(3222,3219),new RSTile(3235,3223),
        new RSTile(3230,3231),new RSTile(3221,3239),new RSTile(3215,3243)};
    
    Now we will create a new variable, a RSTilePath. The parameters for a RSTile path are as follows: RsTilePath myPath = new RsTilePath(RSTile[],script);

    Code:
    RSTilePath myPath = new RSTilePath(myTiles,this);
    

    Congratulations, you've just created your first path! Now I'm going to show you how to use this for walking, which is extremely simple.

    Code:
    myPath.walkToEnd();
    myPath.walkToStart();
    

    Something to note is that when walking a path an InterruptedException can be thrown, you must encapsulate your code in a try/catch block. Here is an example of it in a script:


    Code:
    import com.speljohan.rsbot.script.*;
    import com.speljohan.rsbot.script.wrappers.*;
    
    public class walking extends Script {
    
    	RSTile[] myTiles = new RSTile[] {
    			new RSTile(3222, 3219),
    			new RSTile(3235, 3223), // We declare a new array of RSTile and
    									// populate it with the waypoints
    			new RSTile(3230, 3231), new RSTile(3221, 3239),
    			new RSTile(3215, 3243) };// for our path.
    
    	RSTilePath myPath = new RSTilePath(myTiles, this); // We declare a new
    														// RSTilePath and tell
    														// it to use the tiles
    														// stores in 'myTiles'
    
    	public String getName() {
    		return "Basic Script";
    	}
    
    	public String getAuthor() {
    		return "~alex~";
    	}
    
    	public double getVersion() {
    		return 0;
    	}
    
    	public boolean onStart(String[] args) {
    		return true;
    	}
    
    	public int loop() {
    		try {
    			myPath.walkToEnd();
    			myPath.walkToStart();
    		} catch (Exception e) {
    			log("An error occured whilst walking");
    		}
    		return -1;
    	}
    
    }
    


    Chapter 2 DONE !




    ________________________________-


    Chapter 3



    Object & Npc finding

    These two topics are very similar so I decided to include them in the same tutorial.

    The ability to find objects on screen instantaneously has been a key factor to RSBot's success. An object is model displayed in the client, for example a door or a bank booth. Each of these have a unique ID. When you log into RS through RSBot and turn on the object debug you will see white text displaying a number over every object. RSBot can use these ID's to scan all the objects on screen and find the one you are looking for. Open a blank script.

    Now I'm going to intorduce you to a new class; the RSObject class. Lets attempt to find a bank booth at Draynor Bank. First of all we need to log into RSBot and ensure that the 'Object' option is enabled in the debug drop down menu. Now go to Draynor Bank and look at the number on top of the open bank booth. You should see that its 2213. We can now create a new RSObject for this object

    Code:
    RSObject bankBooth = new findObject(2213);


    Now we've created a new RSObject we can use it to find the object on screen. In order to do this we must use the atObject method, like so.

    Code:
    public int loop() {
        	atObject(bankBooth, "quickly");
            return 0;
    }
    If you run that it will right click the bank booth and click quickly.



    Now on to NPC's. NPC finding is similar to Object finding. They both have unique ID's however you can also find an NPC via it's name rather than it's ID. Try this,


    Code:
    public int loop() {
        	RSNPC man = getNearestNPCByName("Man");
        	return 0;
    }

    In eclipse you can then type 'man.' and the intelli-sense will show you all the methods within the RSNPC class. For instance you can do man.getAnimation(); or man.getHP();



    In order to click a NPC you can use the atNPC method as follows,

    Code:
    RSNPC man = getNearestNPCByName("Man");
      atNPC(man, "Attack");  
    Try experimenting with these methods, especially with the RSNPC class. They are very powerful and you can do a lot with them.





    Thats all and sorry its too short ill try to get more












    Credits for ~alex~ The orignal Creater
     
  3. Unread #2 - Sep 26, 2008 at 6:23 AM
  4. bk drk
    Joined:
    Jun 27, 2007
    Posts:
    106
    Referrals:
    0
    Sythe Gold:
    16

    bk drk Active Member

    How To Create A Rsbot ( Java Script )

    It looks pretty good so far. I would like to see it when you add more:) .
     
  5. Unread #3 - Sep 26, 2008 at 6:57 AM
  6. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    I well as soon as i can :)
     
  7. Unread #4 - Sep 26, 2008 at 10:59 AM
  8. Gofez0r
    Joined:
    Jan 21, 2007
    Posts:
    1,820
    Referrals:
    1
    Sythe Gold:
    0

    Gofez0r Guru

    How To Create A Rsbot ( Java Script )

    Not bad, but a retarded baby could make a decent RSBot script w/o much trouble ;)
     
  9. Unread #5 - Sep 27, 2008 at 11:11 AM
  10. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    Well this is for The Retarded Wannabe Babes :) then
     
  11. Unread #6 - Sep 27, 2008 at 3:04 PM
  12. lx TOOTHZ xl
    Joined:
    Aug 3, 2008
    Posts:
    140
    Referrals:
    0
    Sythe Gold:
    0

    lx TOOTHZ xl Active Member

    How To Create A Rsbot ( Java Script )

    MASSIVE VOUCH FOR OMFGZOMFGLOL I LOVE U OMG I LOVE AHHHHHHHHH THANKS SO MUCH I LOVE U AHHHHHHHHHHHHHHHHHHHHHH
     
  13. Unread #7 - Sep 27, 2008 at 10:54 PM
  14. xxthebeastxx
    Joined:
    May 17, 2008
    Posts:
    1,680
    Referrals:
    1
    Sythe Gold:
    0

    xxthebeastxx Guru
    Banned

    How To Create A Rsbot ( Java Script )

    This is really great, but you could have went in depth on each variable or w/e.

    Once you read this I recommend deciphering others code
     
  15. Unread #8 - Sep 27, 2008 at 11:25 PM
  16. Collapse
    Referrals:
    0

    Collapse Guest

    How To Create A Rsbot ( Java Script )

    Wow does this really work? I'm going to try it out.
     
  17. Unread #9 - Sep 28, 2008 at 4:43 AM
  18. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    Thanks For This nice replies guys and as i said ill go deeper when i have time :)
     
  19. Unread #10 - Sep 30, 2008 at 9:04 AM
  20. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    " Added To Verfied list OLE ! " Yeppe !
     
  21. Unread #11 - Sep 30, 2008 at 12:46 PM
  22. maxim130
    Joined:
    Mar 11, 2008
    Posts:
    43
    Referrals:
    0
    Sythe Gold:
    0

    maxim130 Member
    Banned

    How To Create A Rsbot ( Java Script )

    woow ty so much !!!

    but what to do if u want to make a willow cuter or a miner how does it know if invertory is full or not

    -- edit--

    what to do whit this code ??
    myPath.walkToEnd();
    myPath.walkToStart();

    myPath.walkToEnd(); this above me paths ??
    and this one myPath.walkToStart(); on the end ??
     
  23. Unread #12 - Sep 30, 2008 at 2:18 PM
  24. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )


    Hello And im very glad To help you :)

    1. About The How to know if inv is full :

    Use This code :

    Code:
                    if(getInventoryCount(Logs) == 28){ //If we have an Empty inv. go to next step

    2. Those Two ARe The Codes You Put in A Place in your Script
    Example : after cutting willows and have full inventory You put one of those lines and it well walk the path for u :)

    hope i helped and feel free to ask any more questions
     
  25. Unread #13 - Sep 30, 2008 at 2:45 PM
  26. I 1337 I
    Joined:
    Aug 18, 2007
    Posts:
    1,158
    Referrals:
    1
    Sythe Gold:
    0

    I 1337 I Guru
    Banned

    How To Create A Rsbot ( Java Script )

    Thanks :) Going to try scripting tomorrow :p
     
  27. Unread #14 - Oct 1, 2008 at 9:33 AM
  28. maxim130
    Joined:
    Mar 11, 2008
    Posts:
    43
    Referrals:
    0
    Sythe Gold:
    0

    maxim130 Member
    Banned

    How To Create A Rsbot ( Java Script )


    woow ty again if i am stuck again i ll post/pm you =]
    btw rsbot is offline ??
     
  29. Unread #15 - Oct 1, 2008 at 1:21 PM
  30. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    Yes it is its going to be updated into a new whole RSBOT In a week
     
  31. Unread #16 - Oct 3, 2008 at 9:33 AM
  32. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    Rsbot Updated and working again :p
     
  33. Unread #17 - Oct 9, 2008 at 7:16 PM
  34. Bob Pab
    Referrals:
    0

    Bob Pab Guest

    How To Create A Rsbot ( Java Script )

    hopefully u will make the guide grow...
     
  35. Unread #18 - Oct 10, 2008 at 2:08 PM
  36. OmfgZomfglol
    Joined:
    Jul 5, 2008
    Posts:
    316
    Referrals:
    1
    Sythe Gold:
    0

    OmfgZomfglol Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    I cant unforunttly :(
     
  37. Unread #19 - Oct 10, 2008 at 2:19 PM
  38. Belly
    Joined:
    Sep 5, 2008
    Posts:
    412
    Referrals:
    0
    Sythe Gold:
    0

    Belly Forum Addict
    Banned

    How To Create A Rsbot ( Java Script )

    nice guide ima try it :)
     
  39. Unread #20 - Oct 10, 2008 at 2:45 PM
  40. sirlaughsalot
    Joined:
    Apr 13, 2007
    Posts:
    260
    Referrals:
    0
    Sythe Gold:
    0

    sirlaughsalot Forum Addict

    How To Create A Rsbot ( Java Script )

    Is there any kind of manual for RSBot? I script SRL a lot, but i figured i might as well take a look at this :D
     
< ~|How to Switch Worlds|~ | This Kid Got A Purple P Hat From D Party >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site