[Tutorial] Basic Scripting - Part 1

View previous topic View next topic Go down

[Tutorial] Basic Scripting - Part 1

Post by lawlcakes on Wed Dec 29, 2010 11:13 pm

Hey everyone, thought I'd make a basic scripting tutorial for the new comers.

Okay, let's start out with a basic power mining script.

1. :mine:
2. wait(500,1000)
3. sleep(90,99)
4. useObject(102)
5. goto(:mine:)

Okay, I numbered the lines for you so we can make this easier, in real scripting dont number the lines.

- In line 1 we have ":mine:" : represents the beginning of a section of the script, "mine" represents the name of that section of the script, and the last ":" is the ending of the section of the script. You can name "mine" whatever you want to, as long as you dont use it more than once throughout your script, no more than one section can have the same name. and a section ALWAYS has to begin and end with a ":" colon.

- In line 2 we have "wait" this is self explanatory, this is the amount of time it waits. "(500,1000)" 500, being the minimum, 1000 being the maximum. The time goes by milliseconds, so 500 = half a second, 1000 = a second. You dont always have to use two number such as "(500,1000)" for example you can use one number "wait(1000)" which means wait one second before doing what is next the command.

- In line 3 we have "sleep" also self explanatory, which means sleep in your sleeping bag. the "(90,99)" means what? 90 being the minimum, and 99 being the maximum. So for example, while it is mining, it can mine past 90 fatigue, or sleep at 90 fatigue. but when it hits 99 the maximum it is automatically going to sleep. One example of explaining why it would go past 90 fatigue is say you are at 90 fatigue but your character just clicked a rock to mine and it takes you up to 91 fatigue. Some people like to use the command ifFatigue(#) sleep(). which we will learn about later.

- In line 4 we see "useObject" & "(102)". useObject is a command built within the program you have to make sure you have the capitalization right or else it will not work. useObject means it's going to use the object/click the object you have put in the parenthesis. In this case "(102)" the number 102 is in the parenthesis which is the object of the iron rock. So this line of command is going to click a iron rock which will than mine it. In some cases there will be multiple rocks of the same type of ore, but different ID's. In this case you could use the command "useObect(ID, ID).

- In line 5 we have "goto" which is a command telling the program which section to go to. In this example it is telling the section to "(:mine:)". As we learned earlier ":mine:" is the name of our section. When using the goto() command, you will always have to have the section name in the parenthesis including the ":" colon.

Summary: So what's happening in this script is: It starts, waits a minimum of half a second, and a maximum of one second, checks the fatigue - which will sleep if it is at a minimum of 90, or a maximum of 99, if not it skips this command, clicks the iron rock, than goes to the beginning and repeats.


I hope this was helpful, I will be posting more very soon Smile


Last edited by IceZ on Thu Dec 30, 2010 6:02 am; edited 1 time in total (Reason for editing : *stickied*)

lawlcakes
New user

Posts : 83
Join date : 2010-12-20

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by notforyou on Thu Dec 30, 2010 12:55 am

Good idea. For anyone that thinks they couldn't possibly learn to script for this, its really not as hard as it looks. Text scripting is by far the easiest scripting you can do and learn.

Your best bet in learning is tutorials like these, and also just loading a script and watching it run. Look at the script in notepad while its running on the bot and look for the part of the script its at. Pay attention and you will see what stuff does and the proper way to do it if its a good script.

There is really no 1 way to script things, there's usually multiple ways you can do one action or set of actions and they will all work. I wont really go into details on that, because this is your tutorial. Razz
avatar
notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by IceZ on Thu Dec 30, 2010 6:00 am

As Ryan and a few others do know... I offer both beginner and advanced scripting lessons via MSN. Only when I'm on though, Razz
avatar
IceZ
Admin

Posts : 239
Join date : 2010-11-30

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by zb0rnelm0z on Thu Dec 30, 2010 10:30 pm

IceZ wrote:As Ryan and a few others do know... I offer both beginner and advanced scripting lessons via MSN. Only when I'm on though, Razz

Might have to take some java ones Razz
I seem to be hopeless at it haha.

zb0rnelm0z
Leech Cop

Posts : 269
Join date : 2010-12-27

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by Guest on Mon Jan 03, 2011 7:05 am

ha ha, well put *law cakes* short and sweet.. Thanks for the tutorial Can't get any more simple then that, well put.

Guest
Guest


Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by paskaperse on Mon Jan 03, 2011 12:55 pm

But how to know the commands, :mine:
whats for casting a spell on npc?

paskaperse
New user

Posts : 11
Join date : 2011-01-02

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by notforyou on Mon Jan 03, 2011 1:31 pm

paskaperse wrote:But how to know the commands, :mine:
whats for casting a spell on npc?

http://rahbot.canadian-forum.com/t9-v22-rahbot-command-list

:mine: could be anything at all, its only a label. You could make it say :iOnlyFish: and have it mine or mage with the right commands under it.
avatar
notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by paskaperse on Mon Jan 03, 2011 1:55 pm

Oh thanks, this really helps

paskaperse
New user

Posts : 11
Join date : 2011-01-02

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by Secret on Sun Jan 23, 2011 1:02 am

I really like scripting but I often have troubles. Was wondering if you could add me on msn Very Happy

j0oba@hotmail.com thanks!

Secret
New user

Posts : 106
Join date : 2011-01-10

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by notforyou on Sun Jan 23, 2011 2:31 am

Any problems you have post in the support section with a good title describing the problem. That way when we help you the next person can hopefully search and find the answer.
avatar
notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by illern12 on Wed Feb 09, 2011 8:06 am

Thanks for this i learned allot =)

illern12
New user

Posts : 1
Join date : 2011-02-01

Back to top Go down

hi there...i need help pls?

Post by lucasleong on Mon Sep 05, 2011 3:44 am

hello there,i need some help here,i download the 2.2 version of rah bot..and i dunno how to get started it??do i need to crack or something???can u show me the full progress how to activated the rah bot and how to use it??

1st step?
2nd step?
3rd step?

if possible can u show me a video frm downloading rah bot to start using a rah bot??thanks...alot alot..

lucasleong
New user

Posts : 59
Join date : 2011-08-02

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by notforyou on Mon Sep 05, 2011 3:56 am

1. Download
2. Extract
3. Login
4. ????
5. profit
avatar
notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by lucasleong on Mon Sep 05, 2011 8:43 am

but it shows up a "green box"and it said cannot found any thing main bot??what does it means?

lucasleong
New user

Posts : 59
Join date : 2011-08-02

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by notforyou on Mon Sep 05, 2011 12:46 pm

It means you did not follow what I said, extract it.
avatar
notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by lucasleong on Mon Sep 05, 2011 7:05 pm

ok..i just extract,when i open it,it said:"java"is not recognized as an internal or external command,operable programs or batch files."???

i still dunno what do to next?

lucasleong
New user

Posts : 59
Join date : 2011-08-02

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by notforyou on Mon Sep 05, 2011 7:17 pm

Google that, or search on here. it was been discussed a ton of times. There is even a global announcement(in every single forum) about installing java properly. http://rahbot.canadian-forum.com/t981-the-end-all-how-to-install-java-thread

Any java problem you may have has nothing to do with the bot.
avatar
notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

hi...

Post by lucasleong on Mon Sep 05, 2011 10:48 pm

need help...i can run the bots open...but when i log in it said the client need to update??how do i need to do now??

lucasleong
New user

Posts : 59
Join date : 2011-08-02

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by notforyou on Tue Sep 06, 2011 1:39 am

Get the correct one....? Try the thread that does not say *outdated*, that one is outdated.

http://rahbot.canadian-forum.com/t393-rahbot-w-portals-woking-updated-6-10-11
avatar
notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by Dandini84 on Sat Oct 15, 2011 10:25 pm

notforyou wrote:Get the correct one....? Try the thread that does not say *outdated*, that one is outdated.

http://rahbot.canadian-forum.com/t393-rahbot-w-portals-woking-updated-6-10-11

When you click that link you get a page that says:

Information
Sorry, but only users granted special access can read topics in this forum.
avatar
Dandini84
New user

Posts : 114
Join date : 2010-12-25
Age : 32
Location : Connecticut

http://woodentreasuresct.site90.com

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by gnomepaste on Tue Jul 23, 2013 10:18 am

What is the id for attacking cows?
do i write
goto (:fight:)
Im just looking at a script for attacking chickens and there isnt an ID # used for fighting a specific creature. it just says
:start:
toggle("autologin on")
goto(:fight:)

:fight:
ifItemOnGround(381) goto(:feather:)
attack(3)
ifHPUnder(10) goto(:eat:)
wait(100)
ifFatigueOver(90)sleep()

gnomepaste
New user

Posts : 27
Join date : 2013-07-22

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by notforyou on Tue Jul 23, 2013 1:43 pm

Right click on whatever NPC you want to fight and look for the ID it will be after "Examine". I believe it is the first number but you can test this by going up to a chicken and seeing what number they show as by that script you already know chickens are 3. You could also just type in the word "cow" and it should attack the cow iirc but maybe not, better to use numbers anyway.
avatar
notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

Re: [Tutorial] Basic Scripting - Part 1

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum