Little Known Facts/Problems of SRL Scripting
--> Introduction <--
Well it occurs to me that many of are fine scripters who arent' actually involved in the Development process of SRL don't quite now all the secret In's and Out's of this fine Include so i figured i'd Make This Thread to go over some of the Misunderstood points of SRL, If you feel you have something Correct to add to this please post it, if it is not Correct I will explain how it really works to the best of my knowledge.
--> Varables <--
Let's go over some of the simple variables that aren't well documented first.
BenMouse -> Sets Benlands Spline Mouse if True and RSN/Mutants Spline Mouse if False, Originally Benland's Mouse had afew Bugs that needed Tweaked so we Added this Variable incase you had problems with it, It seems Benland has now tweaked all the bugs out of his version so this should be set to True from SRL 2.1 and Later.
MouseSpeed -> Sets the Speed of the Various Mouse Movements, I Personally Find Lower is Faster and Higher is Slower(correct me if I'm wrong please) Personally I Find MouseSpeed=25 to be around the normal speed of the Mouse Movements I Like so that's what my scripts come preset to, Experment and Decide What Speed you Like.
RandomPlayer -> Set to False to Login Players in Order from 0->Last Player or Set to True to Randomly Pick Players at each NextPlayer call in your Script. I Personally Belive if you Login the Same Players in the Same Order Everytime it could become detectable but that's a personal Belief so you may set this however you would like.
FileName -> If you use the SRL Player Array Forms or Character Data Files then FileName will be the name of the file to retreive the Array from in this Script you Only need to Set the First Name of the DataFile in this array as ".srl" will be automaticly added to this. If you Do Not set this then the Default will always be "Chars.SRL". You may Easily Add Player Array Forms to your scripts just by including PlayerForm.Scar from the Misc Folder and Calling SetUpPlayers from your Script instead of Declareplayers. If you Do Not like forms you may also use the PlayerForm to setup your Character DataFile then use LoadUs to Load the Array from the Datafile.
--> The Player Array <--
Now it seems that most new SRL scripters have the hardest time understanding this simple array, You must use atleast Player[0] in this Array to take advantage of SRL, The Player NickName is the most important setting on this array without it your AntiRandoms WILL NOT work. Also by not declaring the length of this array you will also get many runtime errors from various points in SRL. I highly suggest copying the DeclarePlayers from the Blank Template script into All of your scripts unless you use the PlayerForm. Once again Even if your Script is a SinglePlayer script you MUST use Player[0] of this Array or you will get many Runtime Errors, Math Errors, or nonworking Antirandoms. Lets BreakDown the begining of the PlayerArray to try and make you understand alil more about why you get errors when it is not set properly
PHP Code:
HowManyPlayers :=6;
If you set this to 6 then you need 6 Players declared, Player[0] -> Player[5] If you have a Player[6] then you will get a Out-of-Range Error or if you don't set a Player[5] or so then you will get a Out-of-Range error eventually when Player 5 is required.
PHP Code:
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
This basicly sets the Length of the Player Array to What you Set in HowManyPlayers make sure you have that many Player Data spots filled out or you will get a Runtime Error.
You should also have the following Snippet of Code in EVERY script you ever write or use after Declaring the Player Array, This will make sure the NickNameBMP that is used in RandomFinding will be created incase the player starts the script logged in.
PHP Code:
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars); // Screenname for FIRST Player in case of already loggedin.
--> SetUpSRL <--
I know this is the simplest thing in the world but alot of people forget to add this and get massive amounts of runtime errors for all kinds of stuff, Very simply put this as the first line of script in your main loop or your setup loop. It will Set all the SRL Variables, Load the Global Bitmaps, Set all the Timers, Disquise Scar and Much more without this in your script it WILL NOT work.
--> SRL Template Script <--
This Basic script has been provided to you to show you the VERY basics of SRL scripting, You will see and be able to copy directly from this script how to setup the Player Array in your script, You will also be able to copy the basic PlayerStats Progress Report and you will see how to properly use SRL you need to break out of each loop or else you script will "lockup" and will not login the next player when needed. Remember Study this script it has been written by one of the masterminds of Scar Scripting i know it seems stupid and quite basic yet it is the "Hello World" script that you will learn the how to be a SRL scripter. Just because you can script in scar doesn't mean you can make a 24 hour script with SRL, we give you the include to power your greatest creations you must provide the knowledge and creativity to make it work.
--> SRL Manual <--
This Manual has Every procedure written for SRL inside it in a neat, searchable, commented database. Before you ask a question please load this manual and search for the procedure you are having trouble with and make sure your question isn't already answered. 99% of the questions posted on these forums have been answered by copying the text from this manual and posted as a reply. If you have read the manual and still can't make since of why your procedure/script isn't working properly then feel free to post a topic in one of the many Forums that deal with this but remember if you post the topic in the wrong forum ( such as at the bottom of Script Post and not in a Help/Bug Reporting forum ) then you question will probably go unknown about and unanswered. This great Bible of SRL Scripting can be obtained in the RAR file you got scar out of in a nicely compiled HTML Microsoft Help File or can even be Read Directly online from this Forum in the same Format. So Please before asking questions that are easily answered look thru this Execellent Source of Information and see if you can work the problem out on your own without bugging the very busy developers of this Include, Remember the more time we spend answering questions and updating scripts the less time we work on the include and since that's honestly the only reason this forum is open let us do our work in providing you with the best Scar Runescape Resource Libary Ever Created.
I will be adding much more to this Guide as i have more time. If you feel you have something to add please post it here and i will move it to the front pages of the guide.