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
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