In this Tutorial I will teach you how to use SrlPlayerForm,
but first I am going to tell you about multi player and teach
you the advantages to SrlPlayerForm.
The types of Multi Player
1. Normal Array Type
SCAR Code:
HowManyPlayers := 4;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='d4nger r4nga';
Players[0].Pass :='sunny';
Players[0].Nick :='d4n'; //3-4 letters from name
Players[0].Active:= True;
Players[0].Booleans[1]:= True; // True if new rocks. False if old. (new rocks have veins)
Players[0].Booleans[2]:= true; // Pick equipped?
Players[0].Strings[1]:= 'iron'; // type of ore
Players[0].Integers[1]:=1000; // # of loads
Players[1].Name :='d4nger r4nga';
Players[1].Pass :='sunny';
Players[1].Nick :='d4n'; //3-4 letters from name
Players[1].Active:= True;
Players[1].Booleans[1]:= True; // True if new rocks. False if old.
Players[1].Booleans[2]:= true; // Pick equipped?
Players[1].Strings[1]:= 'iron'; // type of ore
Players[1].Integers[1]:=100; // # of loads
Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='pc'; //3-4 letters from name
Players[2].Active:= false;
Players[2].Booleans[1]:= True; // True if new rocks. False if old.
Players[2].Booleans[2]:= true; // Pick equipped?
Players[2].Strings[1]:= 'tin'; // type of ore
Players[2].Integers[1]:=100; // # of loads
Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='d4n'; //3-4 letters from name
Players[3].Active:= false;
Players[3].Booleans[1]:= True; // True if new rocks. False if old.
Players[3].Booleans[2]:= true; // Pick equipped?
Players[3].Strings[1]:= 'coal'; // type of ore
Players[3].Integers[1]:=100; // # of loads
Advantages
Allows Muliplayer
Disadvatages
Security When posting scripts you leave your pass in the Script.(I have done on purpose it is a banned account)
Fidgety is rather hard to setup a you have to type a lot.
Messy there is a lot of code and if not all of the slot are used it has to be commented out.
Next SrlPlayerForm
Disadvantages
None
Adantages
Neat only one line of code
Easy once you know how to use it take seconds to setup
Speed if you are using you can save you players details so you dont have to type in again
Security you canot upload a script that contains you pass
and more
Now to the fun bits
SrlPlayerForm and how to use.
First you must declare Srl using,
To use SrlPlayerForm you must first declare its include.
This is declared with,
SCAR Code:
{.include srl/srl/misc/users.scar}
Next you must call SrlPlayerForm using,
SCAR Code:
SRLPlayerForm(True, [], [], [], []);
If you are following in scar you should now have a script that looks like this.
SCAR Code:
program New;
{.include srl/srl.scar}
{.include srl/srl/misc/users.scar}
begin
SRLPlayerForm(True, [], [], [], []);
end.
Thats it done for creating a the form if you run it you have fields in which you can enter your username, password, nickname and whether the char is active.
So if thats it done what are the brackets
The brackets are where you can enter your own custom fields
there is a simple rule to entering your own fields and that is,
BISE
BISE stands for BOOLEAN, INTEGER, STRING, EXTENDED.
Say you want to allow the user to input his bank pin as a string you would use
SCAR Code:
SRLPlayerForm(True, [B], [I], [S], [E]);
as the bank pin is a string it would be
SCAR Code:
SRLPlayerForm(True, [], [], ['Bank Pin'], []);
What you put inside the square brackets is the label that will be given to the field
as they are entered as an array you can enter more than one field and seperate them with a comma, eg
SCAR Code:
SRLPlayerForm(True, [], [], ['Bank Pin', 'Ore Type'], []);
The same rule applies whether your using booleans integers strings or extended variable types.
How to use.
To use custom fields you call them using:
SCAR Code:
Players[Player].Data type[position in array]
where [Player] is the player you want to find which is an integer to lookup a specific players details, or you can use [CurrentPlayer] to lookup the currently active players details
Datatype is the data type of the field you want to look up (BISE) eg Integer
[Position in array] The position of the field you want to read.
Example.
If we used
SCAR Code:
SRLPlayerForm(True, [], ['Loads'], ['Ore Type'], []);
to use how many loads you want the active player to mine, you would use
SCAR Code:
players[currentplayer].Integers[0];
when you set the type you use integerS booleanS etc. You add an S to the end.
Remember that it is an array so the first place is 0
If you had
SCAR Code:
SRLPlayerForm(True, [], ['wait time','Loads'], ['Ore Type'], []);
then [0] would be Wait time and [1] would be loads.
To simplify
3 steps
1. Call the includes
SCAR Code:
{.include srl/srl.scar}
{.include srl/srl/misc/users.scar}
2. Set up the form
SCAR Code:
SRLPlayerForm(True, ['bank','multiplayer'], ['Loads', 'Time Between Clicks','minutes to sleep'], ['Ore Type', 'srl ID', 'srl pass'], []);
3. Call/Use the Data
SCAR Code:
paws:=(players[currentplayer].Integers[1]*1000);
if(invents = Players[CurrentPlayer].Integers[0]) then