SRL Archive - Outdated Tutorials

How to not leave you pass in a script/Srl Player Form tut


Waddo

2008-06-02 07:22:07

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

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,
{.include srl/srl.scar}

To use SrlPlayerForm you must first declare its include.
This is declared with,
{.include srl/srl/misc/users.scar}

Next you must call SrlPlayerForm using,
SRLPlayerForm(True, [], [], [], []);

If you are following in scar you should now have a script that looks like this.

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
SRLPlayerForm(True, [B], [I], [S], [E]);
as the bank pin is a string it would be
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
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:
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
SRLPlayerForm(True, [], ['Loads'], ['Ore Type'], []);
to use how many loads you want the active player to mine, you would use
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
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

{.include srl/srl.scar}
{.include srl/srl/misc/users.scar}

2. Set up the form
 SRLPlayerForm(True, ['bank','multiplayer'], ['Loads', 'Time Between Clicks','minutes to sleep'], ['Ore Type', 'srl ID', 'srl pass'], []);


3. Call/Use the Data

  paws:=(players[currentplayer].Integers[1]*1000);

if(invents = Players[CurrentPlayer].Integers[0]) then

Waddo

2008-06-02 07:23:13

reserved for sumit duno what yet tho =] but you never know.

Edit:If any of you admins or mods notice any speling mistakes or grammar mistakes could you corect them if you have nothing better to do ty.

Nava2

2008-06-02 08:19:18

There is already a tutorial on this, yours is still good though :)

Sumillion did one.

Nava2

PvH

2008-06-02 08:24:21

Yea there is one already.
But this one is easier to understand IMO
great tut waddo;)
rep++:)

Waddo

2008-06-02 08:30:24

ty i made it so it was easy to understand and also so it would attract more attention to the newcomers hense it is in beginner tut's as we dont want newcomers losing their acounts and us getting a bad rep =]

Dan Cardin

2008-06-02 13:16:58

wouldnt it be easiest to save your usernames and passwords to an ini file and get it from that? Then you'll always have it. Just save it in your scripts folder, make yourself a neat little function for getting all of the info(saved into srl, or the script its in) and add it into the main proc of the scripts you use. Easy-peasy

Waddo

2008-06-02 18:31:47

2 b honest that sounds 10000000 times more complicated

lol
especially if you want variables =] this also teaches SrlPF

Baked0420

2008-06-02 18:43:42

this is a pretty good tut, I already understood it, except for one thing, which I never saw covered yet, not only by you but nay tut, extended. What is extended used for and does it hold numbers, words, or true/false also? or something else different? probably something different because you could just you integers, strings, or booleans for what I said, I don't see why they would make extended to be the same as one of them. So what does this "extended" do exactly?

Nava2

2008-06-02 18:50:16

Extendeds are any number with a decimal. Example:

2 <- Integer.

2.0 <- Extended.

Hope that clarifies! :)

Nava2

Baked0420

2008-06-02 19:00:05

oooohhh, thanks so much Nava2, now that you said it I think I saw it once or twice before, guess I just didn't see it enough to stick in my head. Because Integers are whole numbers, so if you need any other number (not whole) you would have to use extended, yea I get it, unless what I just sai is wrong lol. But thanks, rep+.

Waddo

2008-06-02 19:33:52

yer an extended or in pascal a real data type is a number which is not whole

the word integer means whole number

AnonyMouse

2008-06-03 02:46:16

Good Tut, I'll add multiplayer to my up and coming first power chopper. ^.^

Waddo

2008-06-27 14:02:32

no problem

I Jake I

2008-07-04 09:40:49

VERY NICE! I didn't even know about this until now!

randy marsh

2008-07-04 20:40:58

i left my password in the other day and my account got stolen..

Waddo

2008-07-05 06:55:27

i know but atleast you got account back did you lose anything

well now you know this so you can use this in future

BraK

2010-12-06 13:43:43

Nicely Writen Tutorial if a little old. Still hold relevance hope some of you inspiring Script Writers get something from this. Thanks Waddo for writing it. Edited to fixed some of the Grammar mistakes.

~BraK

Gu3st...

2010-12-06 14:13:40

It's broken now, and has been for a long time :(

BraK

2010-12-06 14:30:04

Maybe this will inspire someone to fix it.

~BraK

Gu3st...

2010-12-06 14:31:10

Hopefully :)

BraK

2010-12-06 14:40:35

From: Zyt3x
Hopefully :)


I might even take a stab at it when I go fly home to my family tomorrow. It'll give me something to do on the 9+ hour flight and my layover. :) My wife also told my not to worry about finishing this section to fast as we have a good internet connection there now. So I won't be completely gone from the forums.

~BraK