PDA

View Full Version : How to make a perfect script (Planning stage)



BobboHobbo
07-04-2013, 05:58 AM
How to make a perfect script (Planning stage of Development)


Everyone wants to make a perfectly running script, in the minimal amount of time. That will run endless without anything stopping it. But theres always PROBLEMS when you begin making your Mr Perfecto scripts.


There are many stages of making a script, but the most important one, that we will take a look at today is:
- Planning


Planning/Options

Planning is easily on the most important stage of script development, in this stage you will need to plan out all the steps in which the script will undertake. If you can create a mind map of what you want your script to exactly be doing, without a doubt you will be able to script and create that script with minimal errors, and if you do have errors. You will easily be able to know where the problem lies and can work to fix it from there. If a script is poorly layed out, it takes hours to get it cleaned and fixed up so it all works correctly! so why not just do it right the first time and save yourself the trouble later!

In this example im aiming to make the script do the following:

Check if Glory/Duel Ring is currently wielded
Teleport to Karamja
Pick bananas off the trees
Teleport to Castle Wars via Duel Ring
Bank
Repeat

It may sound simple this way, but you need to think further ahead, with all the other little details that need to be payed attention too!







http://img5.imageshack.us/img5/346/1vue.png

When creating your script, you have to think beyond what you want your script to achieve, and think of the smaller details of what will you do if this or that function fails? A major part of planning your script includes planning your FAILSAFES! in the picture above, I have minimal failsafes covering my functions. For example teleporting to Karamja, What if the script misclicked the teleport to Karajma button, or it did click but took longer then normal to load the new location? You need to have something built in the script to cover these fails. With failsafes, to be completely safe I advise using a failsafe, within another failsafe in case the failsafe decides its not going to work out, you need something too boot your account off to save it from attempting things multiple times, deeming you as a stupid bot. Bellow I have structured a semi failsafed outline of my script.

How the script should be displayed on a Mind map:

http://img585.imageshack.us/img585/51/albd.png

Here in this mind map we have a more structured, failsafed mindmap, Its not completely failsafed but it has the just to it to help you understand WHY YOU NEED TO have these systems in place in order to have your script running for a long time!


So why is Planning so important?

It gives you a set of things to work off, so you dont miss things
When scripts get large, having a great structure helps eliminate any bugs!
Cleaner script, as you know the functions/procedures you need!
Fail proofing your script, you can work backwards when your complete, to see if you met the standards of your plan!

Ian
07-04-2013, 06:08 AM
I never thought about drawing a script out on a mindmap like this, neat idea. Usually what I do is do the core of the script, then go though each part and think "If this fails, what do I need to do to make it recover?" It's really important to look through each function to see what could go wrong, how to avoid it, and then what to do if it still goes wrong.

Anyhow good guide, I'm sure it will be a handy resource for those who are having trouble getting their scripts to run as long as they would like :)

rj
07-04-2013, 01:57 PM
Nice guide, though it should be noted that this checking stuff must be done quickly, for the script to be fast :)

grats
07-04-2013, 01:59 PM
I never thought about drawing a script out on a mindmap like this, neat idea. Usually what I do is do the core of the script, then go though each part and think "If this fails, what do I need to do to make it recover?" It's really important to look through each function to see what could go wrong, how to avoid it, and then what to do if it still goes wrong.

Anyhow good guide, I'm sure it will be a handy resource for those who are having trouble getting their scripts to run as long as they would like :)
http://en.wikipedia.org/wiki/Flowchart

BobboHobbo
07-04-2013, 02:37 PM
Nice guide, though it should be noted that this checking stuff must be done quickly, for the script to be fast :)

I believe if your going to make a script, mirroring the movements of a human, would be deemed as common sense :P.

The Killer
07-04-2013, 04:01 PM
Perfect script? There is no such thing as "perfect", only "better than you expect".

;)

I'v never drawn a picture before... But I do plan stuff which helps
Nice tutorial, something different :P

Sjoe
07-04-2013, 04:14 PM
Love it, nice guide:)

Itankbots
07-04-2013, 04:44 PM
Very nice...I still have your banana picking script :P It is a perfect script for sure...Still works with a few modifications to keep it up to date with rs updates :D

Ian
07-04-2013, 04:53 PM
http://en.wikipedia.org/wiki/Flowchart

He used the phrase mind map so that's what I used, although now that you point it out it does look like a flowchart :p

BobboHobbo
07-04-2013, 04:55 PM
Very nice...I still have your banana picking script :P It is a perfect script for sure...Still works with a few modifications to keep it up to date with rs updates :D

Haha oh really, no wonder the prices of Bannana (5)'s is dropping ;). And yeah I updated it too, but never released, banana prices are pretty good, dont want it dropping back to 550 like before haha.

And thanks guys :).

StickToTheScript
07-04-2013, 04:58 PM
Nice stuff! That was a good read. I have never thought of doing that..... :p

That will definitely help! :D

grats
07-04-2013, 07:50 PM
He used the phrase mind map so that's what I used, although now that you point it out it does look like a flowchart :p

I linked them just because it seemed you didn't know of a flowchart from the "I never thought of drawing it out" part lol
you can call it whatever you want, doesn't bug me

denart5
07-05-2013, 02:14 AM
Hmmm interesting. Most guides teach you something specific but this... is something that is ALWAYS useful.

Cage
06-23-2014, 03:50 PM
Great tutorial. It has made me realise the ironically obvious benefits of creating an effective plan first. Sure, plans will likely change as I actually code, but at least I will have a solid track to run on. :) Cheers!

Quentini
11-06-2014, 03:51 PM
Thank you for this. Very useful starting out.

yaro
10-26-2015, 11:44 PM
Love, nice guide!

Tector
12-12-2015, 11:45 PM
very nice idea. Will use it when i am ready to script. learning atm.