PDA

View Full Version : General FailSafes



Pyro
07-02-2007, 10:45 AM
Ok mi making this up as i go. And is sibject to probably change over the next few days. But to start us off

Failsafes are generally used incase "somethign goes wrong" now i know good scripts well should go wrong right? Well they do. For some reason or another stuff happens , we may get a hard random, may just lag to much and misclick. Whatever That isnt the point. The point is we need failsafes. So we will start off with some easy ones....



Loggedin


if(not(loggedin))then exit;


and


if(not(loggedin))then nextplayer(false))


These are two very important statements. And you will see this in every good script for rs. If you dont then smash your screen with a hammer.

Ok first off. if(not(loggedin))then exit;

Well basically this is used at the start of procedures in the loop. So that when the procedure is called. If we arent loggedin well theres no point going through the procedure looking for colors and crap because we arent even loggedin. Also used in loops to break. For example if your in a loop just throw this in there. Then atleast if something goes wrong and whatever your waiting for doesnt show up it wont sit in same loop forever. Just until it logs out :p
Ok and if(not(loggedin))then nextplayer(false)
is used for the end of your main loop. SO say somethign horrible has gone wrong. And you are on player[0]. It has skipped all the procedures because as soon as it went into them it exited because of the earlier work we have done. Now we are at end of main loop. We dont want to go through it all again extiting everything if we arent even loggedin do we?

So we use if(not(loggedin)) then nextplayer(false) to then go onto the nextplayer. And revert the current player that something went wrong with to active:=false. because we have thrown this at the end of our main loop ( well we should and if you havnt, will do in the future) it will now beign at the top of the loop, essentially starting the script all over again :p but without that player!

God ok now we got that sorted and if you have sifted through all that then theres more to come :p


TimeMarking

WEll timemarking is generally used to break out of loops.


var
mark:integer;

marktime(mark)
repeat
clickmouse(234,234,true)
if(timefrommark(mark)>10000)then break;
until(findmscolor(x,y,43564))



So we take the above. We are clicking in a certain place looking for a color. WE are clicking at certain co ords and we actually arent sure if its going to work as it only works 95% of time ( we are just making this up btw). So we mark the time BEFORE we enter the loop. THis is important otherwise it will just keep marking the time. We need to declare the marker as a integer as we have done with the variable "mark". So we mark the time then enter the loop. Now just say the color doesnt come up and we dont have the marktime there pursay. Then we will be in a endless loop and we will come back to our computers with the login screen been up for 5 hours.

With the marktime there. WE put a "timefrommark" statement in there. Which is a srl function that results in a boolean. We say from the marker called "mark" if it has been 10000 milliseconds (aka 10 seconds) then just break the loop and continue on with script. GOt it? ANother way is to add it to the until factor


var
mark:integer;

marktime(mark)
repeat
clickmouse(234,234,true)
if(timefrommark(mark)>10000)then break;
until(findmscolor(x,y,43564)) or (timefrommark(mark)>10000))



Ok if you have got this far good work. Although i doubt many of you would have. I will continue on with this as i get more bored :p

Pyro
07-02-2007, 10:46 AM
reserved incase i need more room :p

Santa_Clause
07-02-2007, 11:05 AM
I will shoot you for reserving first post! Argh, haha nice tutorial. I hope this will get bigger.

JuKKa
07-02-2007, 12:33 PM
Heheee, looks good! (online with my cell xd)

Markus
07-02-2007, 01:20 PM
Nice tut!

rkroxpunk
07-02-2007, 02:49 PM
add "else" statements? looking good though

Pyro
07-02-2007, 10:02 PM
Meh else statements should have been discussed in earlier things. Most people already know else statements and also counters for breaking out of loops. But ill add them if neccesary.

Sumilion
07-02-2007, 10:15 PM
He's alive =\

Lalaji
07-02-2007, 10:21 PM
well i kinda get the mark time thing...

Thanks!!

Pyro
07-03-2007, 12:40 AM
Yeah reading through it its sometimes hard to understand what the hell im going on about. Hopefully it will give you basic understanding to go off and make little test scripts to see how it works.

And yes um im now alive :p

crossback7
07-03-2007, 03:08 AM
Sumilion seems a bit disappointed that you are. And this was helpful thanks.

SKy Scripter
07-03-2007, 03:16 AM
hmm i rember when i was a leecher my faverote people was Pyro and StarBlaster100. sadly i have no favorite people anymore but i still look up to you ;) glad to see you come back. :)

Pyro
07-03-2007, 10:11 AM
hmm i rember when i was a leecher my faverote people was Pyro and StarBlaster100. sadly i have no favorite people anymore but i still look up to you ;) glad to see you come back. :)

Aww really? Haha. Wow thanks. Add me on msn. Ive seen some of your work. Pretty awesome.

Cross : hmm i dunno. IM sure he was excited. That slash was just a typo :p

Sumilion
07-03-2007, 11:14 AM
Ahh yes, you always added the people you thought were interesting didnt you ...

Santa_Clause
07-03-2007, 11:39 AM
Oh No! Sumilion is offended! Isn't Pyro the one with that Yew Cutter? Why'd you stop selling it?

Rikje
07-03-2007, 02:40 PM
thx for that tut. it was just where i was looking for. :D

Ruroken
07-03-2007, 06:41 PM
Ahh yes, you always added the people you thought were interesting didnt you ...

Rofl. Sumilion is JEALOUS :p

...don't worry sumilion, i still like you ;)

Nice tut pyro. Nice to see you again :D

Sumilion
07-03-2007, 06:58 PM
Crap he still likes me ...

for your information Pyro also added me.

Venom666
07-03-2007, 09:49 PM
good tut, ill be checking in the future for more info :).

Pyro
07-04-2007, 08:13 AM
Oh No! Sumilion is offended! Isn't Pyro the one with that Yew Cutter? Why'd you stop selling it?

Its just a bitch. Honestly. Forever more every piece of work will be free or private. Selling is such a hassle to set up auths and what not. Its just easier to release it for free.

No i added sum. I think? I just always add people that are cool or nice or whatever.

Santa_Clause
07-04-2007, 10:42 AM
Ooo I'm cool! Pick me! Pick me!

SKy Scripter
07-04-2007, 06:30 PM
no no! dont add santa lolz! he ask to many questions.... -.- jk santa..

Pyro
07-04-2007, 10:08 PM
Ooo I'm cool! Pick me! Pick me!

Well the convo would go hi, hi..... and then it would end

I had something to say to sky so... :p

Santa_Clause
07-05-2007, 12:26 AM
no no! dont add santa lolz! he ask to many questions.... -.- jk santa..

And you need too much money for your own good...:f:

Pyro
07-05-2007, 01:48 AM
Well really. my msn is always there for people to add :p. Even if you get thrown into my msn noob group. Always there to help with advanced problems. But i cant be bothered with color finding, mouse moving etc. Or setting up scar. That just annoys me :p But if anyone has problems with learning failsafes and needs help feel free to add me :p