Famous Scripts
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Scripts for RSBot made by Famous
 
HomePortalLatest imagesRegisterLog in
New scripts being created everyday! Go to GameKiller.net!

 

 Tutorial 3: Walking

Go down 
4 posters
AuthorMessage
Famous
Administrator
Administrator
Famous


Posts : 50
Join date : 2009-10-23
Age : 29
Location : Chicago

Tutorial 3: Walking Empty
PostSubject: Tutorial 3: Walking   Tutorial 3: Walking EmptyMon Jan 11, 2010 11:00 pm

Sorry I haven't written a guide in a few months. But anyways, as promised, I will start to write more guides as the weeks go by.

Anyways, this tutorial will be about walking.

Pre Requirements: Load up RSBot, press view, check player position.

The first thing we are going to need to add to our script is to make an RSTile array. It should look like this:
Code:
RSTile[] NAMEOFPATH = { };
This is the name of the path that we will call to walk. Here's an example of a walkpath taken from my silkBuyer script:
Code:
RSTile[] walkToTrader = { new RSTile(3270, 3167), new RSTile(3277, 3175), new RSTile(3283, 3183), new RSTile(3294, 3184), new RSTile(3294, 3196), new RSTile(3300, 3204) };
Notice the x,y coordinates?
Code:
new RSTile(3270, 3167)
This is where your path starts and ends. This path is from the bank to the trader NPC. Make sure to end your path with a }; <-----Don't forget the semicolon. Tutorial 3: Walking Icon_biggrin

Now you may be wondering, "So I understand that it walks to the trader, but do I have to write the whole path backwards to make it walk to the bank?"Nope, luckily there is a way that tells RSBot to walk it backwards. This is the RSTile[] array for it:
Code:
RSTile[] walkToBank = reversePath(walkToTrader);
Once again, this tells RSBot to walk the path backwards.
Now you're probably asking how to implement it into your loop. I'll try to explain this my best, so bare with me. Very Happy

I just want to go over some simple little methods to walk. If you are just walking to a single tile, you use the method:
Code:
walkTileMM(x, y); //Walks to a single tile.

To walk a whole path, you use something similar.
Code:
walkPathMM(PATH);
Now I've seen many people asking me why it only walks to one tile and stops. This is because the walkPathMM method is not looped in your script. This is an example of what a looped walking method should look like. Let's say that
you have a full inventory and need to walk to the bank. (I'll be writing a tutorial on Banking soon)
Code:
while (distanceTo(bankTile) >= 5 && isInventoryFull()) {
        walkPathMM(toBank);
}

That's the best that I can think of right off the top of my head. I hope that you understand that, and if you have any questions, ring them by me via PM.


Last edited by Famous on Sat Jun 19, 2010 3:19 pm; edited 2 times in total (Reason for editing : Updated)
Back to top Go down
https://famousscripts.forumotion.com
Eons




Posts : 6
Join date : 2009-12-12

Tutorial 3: Walking Empty
PostSubject: Re: Tutorial 3: Walking   Tutorial 3: Walking EmptyTue Jan 12, 2010 8:30 am

Nice one, thank you sir. Smile
Back to top Go down
Sanuka

Sanuka


Posts : 17
Join date : 2010-07-27
Age : 30
Location : Boskoop, the Netherlands

Tutorial 3: Walking Empty
PostSubject: Re: Tutorial 3: Walking   Tutorial 3: Walking EmptyTue Jul 27, 2010 4:06 am

First of all thank you so much! These tutorials of yours are so noob friendly! You explain everything at an understandable level (altough that might just be because I can program C++ Wink) and the pace of your text is easy-going.
The only problem is that there aren't enough tutorials yet Very Happy

So onto my problem, I've been using your tutorials to construct my first script (you must be proud (lol)) It's going ok so far, I get a problem (ussually me being sloppy on the code) and I get it fixed. But I can't seem to figure this one out.

Famous wrote:

To walk a whole path, you use something similar.
Code:
walkPathMM(PATH);
Now I've seen many people asking me why it only walks to one tile and stops. This is because the walkPathMM method is not looped in your script. This is an example of what a looped walking method should look like. Let's say that
you have a full inventory and need to walk to the bank. (I'll be writing a tutorial on Banking soon)
Code:
while (distanceTo(bankTile) >= 5 && isInventoryFull()) {
        walkPathMM(toBank);
}
Where is the "bankTile" defined (i mean where is it in your example code) and as what? Just a integer or a X,Y Coordinate? Or a'm I just being oblivious to something? (No I didn't Ctrlv, Ctrlc) but that might be part of the problem xD I just can't seem to find it. I'll also pm you let's see wich is faster =P

Pardon my English, my maiden language is Dutch (lol is maiden even a word)

Edit:
Well i just finished my first script, and it works Very Happy
I'm currently powerfishing shrimps (xD) and the script checks whether or not it is next to the fishing spot.


Last edited by Sanuka on Tue Jul 27, 2010 6:09 am; edited 1 time in total (Reason for editing : wohoo first script ever!)
Back to top Go down
cool




Posts : 5
Join date : 2010-07-02
Location : Belgium

Tutorial 3: Walking Empty
PostSubject: Re: Tutorial 3: Walking   Tutorial 3: Walking EmptyTue Jul 27, 2010 11:47 am

Sanuka wrote:

Edit:
Well i just finished my first script, and it works Very Happy
I'm currently powerfishing shrimps (xD) and the script checks whether or not it is next to the fishing spot.
gratz with first script!
Need someone to test it? I will do it, and I give proggy if needed =)
Back to top Go down
Sanuka

Sanuka


Posts : 17
Join date : 2010-07-27
Age : 30
Location : Boskoop, the Netherlands

Tutorial 3: Walking Empty
PostSubject: Re: Tutorial 3: Walking   Tutorial 3: Walking EmptyTue Jul 27, 2010 1:09 pm

cool wrote:
Sanuka wrote:

Edit:
Well i just finished my first script, and it works Very Happy
I'm currently powerfishing shrimps (xD) and the script checks whether or not it is next to the fishing spot.
gratz with first script!
Need someone to test it? I will do it, and I give proggy if needed =)
Thanks, and the script is still buggy, the location checker doesn't quite work and sometimes it just quits fishing all together lol. I've been running it on my pc for a while now and it still needs a hand from time to time. I'm gonna try and change that, perhaps through the use of a timer.

but thanks for the offer Smile
Back to top Go down
cool




Posts : 5
Join date : 2010-07-02
Location : Belgium

Tutorial 3: Walking Empty
PostSubject: Re: Tutorial 3: Walking   Tutorial 3: Walking EmptyWed Jul 28, 2010 5:56 am

Sanuka wrote:

but thanks for the offer Smile
No problem, good luck with the script!
Back to top Go down
Sponsored content





Tutorial 3: Walking Empty
PostSubject: Re: Tutorial 3: Walking   Tutorial 3: Walking Empty

Back to top Go down
 
Tutorial 3: Walking
Back to top 
Page 1 of 1
 Similar topics
-
» Tutorial 2: Writing your first script
» Pre Tutorial Methods
» Tutorial 4: Banking
» Fixing JDK Not found error.
» Tutorial 1: Beginning Scripting

Permissions in this forum:You cannot reply to topics in this forum
Famous Scripts :: Tutorials :: Tutorials :: Famous' Scripting Tutorials-
Jump to: