[Tut]Advanced Scripting Tutorial

View previous topic View next topic Go down

[Tut]Advanced Scripting Tutorial

Post by kroniik on Tue Mar 01, 2011 4:18 pm

Hello there, i am aware that there is a basic scripting tutorial and i thought why not make a tutorial to make a more advanced script. This hopefully will be benificial to new scriptors, and help them make good advanced scripts.

I am going to build this tutorial in the steps i use to create a script Smile

Things you will need for this tutorial:
Command List
Item List
NPC List
Syntax For RahBot

So lets get started, lets make a small all in one, consisting of woodcutting, fletching, mining and smelting... This is a script that may take long to do, but dont just copy and paste, Learn.

Step one - Setting up options for script
Code:

;Kroniik's Advanced Tutorial Script


:option:
getOption($var0,"What Script Would You Like To Run","Woodcutting","Fletching","Mining","Smelting")
ifVarEqual(0,$var0)goto(:option1:)
ifVarEqual(1,$var0)goto(:option2:)
ifVarEqual(2,$var0)goto(:option3:)
ifVarEqual(3,$var0)goto(:option4:)

This is now bringing up a table with the options chose, "woodcutting" etc.
You can have up to 10 variables $var0-$var9.

Now you have entered this information you want to check it in the bot to make sure you have no bugs in it, so go to save as and enter the name "Kroniiks tutorial.rah" and change the type of file to all files.

Now go into the bot and make sure that the black box comes up with your options, if this works move on to step 2.

Step 2 - Setting up further options
Code:

;Kroniik's Advanced Tutorial Script


:option:
getOption($var0,"What Script Would You Like To Run","Woodcutting","Fletching","Mining","Smelting")
ifVarEqual(0,$var0)goto(:option1:)
ifVarEqual(1,$var0)goto(:option2:)
ifVarEqual(2,$var0)goto(:option3:)
ifVarEqual(3,$var0)goto(:option4:)

:option1:
getOption($var1,"Which Woodcutting Script Would You Like To Run?","Normal Trees","Oak Trees","Willow Trees")
ifVarEqual(0,$var1)goto(:normaltrees:)
ifVarEqual(1,$var1)goto(:oaktrees:)
ifVarEqual(2,$var1)goto(:willowtrees:)


This Script now says if you click the option for woodcutting on the first page that comes up another page will come up telling you what trees you can cut.

This is what your script should look like when all your options are put in:
Code:
;Kroniik's Advanced Tutorial Script


:option:
getOption($var0,"What Script Would You Like To Run","Woodcutting","Fletching","Mining","Smelting")
ifVarEqual(0,$var0)goto(:option1:)
ifVarEqual(1,$var0)goto(:option2:)
ifVarEqual(2,$var0)goto(:option3:)
ifVarEqual(3,$var0)goto(:option4:)

:option1:
getOption($var1,"Which Woodcutting Script Would You Like To Run?","Normal Trees","Oak Trees","Willow Trees")
ifVarEqual(0,$var1)goto(:normaltrees:)
ifVarEqual(1,$var1)goto(:oaktrees:)
ifVarEqual(2,$var1)goto(:willowtrees:)

:option2:
getOption($var2,"Which Fletching Script Would You Like To Run?","Arrow Shafts","Shortbows","Longbows")
ifVarEqual(0,$var2)goto(:arrowshaft:)
ifVarEqual(1,$var2)goto(:shortbow:)
ifVarEqual(2,$var2)goto(:longbow:)

:option3:
getOption($var3,"Which Mining Script Would You Like To Run?","Copper","Tin","Iron")
ifVarEqual(0,$var3)goto(:coppermine:)
ifVarEqual(1,$var3)goto(:tinmine:)
ifVarEqual(2,$var3)goto(:ironmine:)

:option4:
getOption($var4,"Which Smelting Script Would You Like To Run?","Bronze","Iron")
ifVarEqual(0,$var4)goto(:bronzesmelt:)
ifVarEqual(1,$var4)goto(:ironsmelt:)

;----------Woodcutting------------
:normaltrees:

:oaktrees:

:willowtrees:

;----------Fletching-----------
:arrowshaft:

:shortbow:

:longbow:

;----------Mining------------
:coppermine:

:tinmine:

:ironmine:

;----------Smelting-------------
:bronzesmelt:

:ironsmelt:

Save your script and check that it works, then proceed to step 3.


REMEMBER: if you miss out capital letters you can create a bug in your script
for example:
walkto(x , y) < Wrong
walkTo(x , y) < Right

kroniik
New user

Posts : 36
Join date : 2011-01-30
Location : Essex, England

Back to top Go down

Re: [Tut]Advanced Scripting Tutorial

Post by kroniik on Tue Mar 01, 2011 5:31 pm

Step 3 - Making Your Scripts For Woodcut
Code:
;Kroniik's Advanced Tutorial Script


:option:
getOption($var0,"What Script Would You Like To Run","Woodcutting","Fletching","Mining","Smelting")
ifVarEqual(0,$var0)goto(:option1:)
ifVarEqual(1,$var0)goto(:option2:)
ifVarEqual(2,$var0)goto(:option3:)
ifVarEqual(3,$var0)goto(:option4:)

:option1:
getOption($var1,"Which Woodcutting Script Would You Like To Run?","Normal Trees","Oak Trees","Willow Trees")
ifVarEqual(0,$var1)goto(:normaltrees:)
ifVarEqual(1,$var1)goto(:oaktrees:)
ifVarEqual(2,$var1)goto(:willowtrees:)

:option2:
getOption($var2,"Which Fletching Script Would You Like To Run?","Arrow Shafts","Shortbows","Longbows")
ifVarEqual(0,$var2)goto(:arrowshaft:)
ifVarEqual(1,$var2)goto(:shortbow:)
ifVarEqual(2,$var2)goto(:longbow:)

:option3:
getOption($var3,"Which Mining Script Would You Like To Run?","Copper","Tin","Iron")
ifVarEqual(0,$var3)goto(:coppermine:)
ifVarEqual(1,$var3)goto(:tinmine:)
ifVarEqual(2,$var3)goto(:ironmine:)

:option4:
getOption($var4,"Which Smelting Script Would You Like To Run?","Bronze","Iron")
ifVarEqual(0,$var4)goto(:bronzesmelt:)
ifVarEqual(1,$var4)goto(:ironsmelt:)

;----------Woodcutting------------
:normaltrees:
sleep(90,99)
useObject(1)
wait(200)
ifInvFull()goto(:banknormal:)
goto(:normaltrees:)

:banknormal:
walkTo(188,652).
walkTo(207,646).
walkTo(218,637).
goto(:banknormal2:)

:banknormal2:
openBank()
wait(2000)
DepositAll(14)
wait(2000)
ifBankAmountOver(1000,14)stop()"@red@1000 Logs Cut, To Prevent Mods Getting Suspicious The Script Is Now Stopping..."
goto(:walktonormal:)

:walktonormal:
walkTo(207,646).
walkTo(188,652).
ifNotAt(188,652)goto(:walktonormal:)
goto(:normaltrees:)

:oaktrees:

:willowtrees:

;----------Fletching-----------
:arrowshaft:

:shortbow:

:longbow:

;----------Mining------------
:coppermine:

:tinmine:

:ironmine:

;----------Smelting-------------
:bronzesmelt:

:ironsmelt:

This has now successfully added the Normal Tree script, Which starts at draynor bank or in the woods to the east. Cuts trees until your inventory is full then banks and repeats. Easy right?

Now enter basically the same data for the other woodcutting scripts, you will have to change to where it walks and where it banks and the id's of the items and objects, you can find the items at the top of the page.
Dont forget to change the labels..
As far as i know you will need to find the object id out ingame, as there are no lists for them.

Once all of the woodcutting scripts are build the script should look like this:
Code:


Save your script and test it.
If your script works, proceed to step 4

kroniik
New user

Posts : 36
Join date : 2011-01-30
Location : Essex, England

Back to top Go down

Re: [Tut]Advanced Scripting Tutorial

Post by kroniik on Tue Mar 01, 2011 6:00 pm

This is not complete at all... Its late now, will continue soon.

kroniik
New user

Posts : 36
Join date : 2011-01-30
Location : Essex, England

Back to top Go down

Re: [Tut]Advanced Scripting Tutorial

Post by iwannabot on Thu May 24, 2012 4:09 pm

Even though it is not complete it definately helps, Gonna finish it now that ur back on? I think your other post saying you were back was this month, jw.

iwannabot
New user

Posts : 20
Join date : 2011-07-09

Back to top Go down

Re: [Tut]Advanced Scripting Tutorial

Post by notforyou on Fri May 25, 2012 2:54 am

He has not been back since that post though. Probably because people were dicks to him.

notforyou
Admin

Posts : 2939
Join date : 2010-12-18

Back to top Go down

Re: [Tut]Advanced Scripting Tutorial

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