SRL Archive - Outdated Tutorials

Adding Randoms to Your Scripts


WhiteShadow

2006-04-11 23:26:59

Updated, 1/31/06 due to SRL changes. RAWRR.
Adding Randoms to Your Scripts By WhiteShadow


This tutorial will cover how and where to add randoms to your scripts.

Alright, so you first have to include the include. Obviously :

program New; 
{.include SRL/SRL.Scar}

begin
SetUpSRL; //Loads
end.

There now you have access to all the functions in SRL's core folder. Thankfully the only function you need to call is FindNormalRandoms; Since it summed all the randoms up for you already..

{*******************************************************************************
function FindNormalRandoms: Boolean;
by: The SRL Developers Team!... all time sexiness by Mutant
Description: Calls the 'normal' random checks.
*******************************************************************************}

function FindNormalRandoms: Boolean;
var
i: Integer;
begin
for i := 1 to 16 do
begin
case I of
1: CloseWindow;
2: if FindTalk then
Result := True;
3: if FindDead then
Result := True;
4: if FindMod then
Result := True;
5: if FindMime then
Result := True;
6: if FindMaze then
Result := True;
7: if FindQuiz then
Result := True;
8: if FindDemon then
Result := True;
9: if FindScapeRune then
Result := True;
10: if FindTalk then // Call it twice
Result := True;
11: if FindLamp(LampSkill) then // Maybe we missed it?
Result := True;
12: if (FindNewBox) then
begin
Result := True;
if (UseBoxSolver) then
SolveBox
else
GambleNewBox;
end;
13: if FindTrade then
Result := True;
14:
begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
15: SaveToChatLog;
16: if RC then
Result := True;
end;
Wait(1);
end;
end;


Before that though, I want you all to know something.

Nick, is important, very important. Why? Because your going to get ownd by randoms the whole time, and then complain about how SRL doesn't solve randoms correctly. All talking randoms are solved by looking for a bitmap mask of your Nick in the mainscreen!

What is Nick?! It's 3 - 4 letters of your username, so if my username was Isamcool then a good Nick would be amco. Yeah so grab a 3 -4 letter chunk out of the center of your username.

Here's one way to set nicks. Multiple player preferably. So DeclarePlayers; saves all the information on the characters. Then you use LoginPlayer, thankfully LoginPlayer; creates the bitmapmask of the Nick everytime you use it, so this is all you need to do.

program New;
{.include SRL/SRL.Scar}

procedure DeclarePlayers;
begin
HowManyPlayers := 1; //Number of players
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

begin
SetUpSRL;
DeclarePlayers;
LoginPlayer;
end.

Then there's also just this.

program New; 
{.include SRL/SRL.Scar}

const
Nickk = 'ern';

begin
SetUpSRL;
NickNameBMP := CreateBitmapMaskFromText(Nickk, UpChars);
end.

Create the bitmapmask of the current player's Nick with the variable NickNameBMP. That's all that matters.

After all the setup with the includes, and Nicks just call FindNormalRandoms everywhere you see needed.

Bits

procedure WaitisChopping;
begin
while(Chopping)do
begin
Wait(200);
FindNormalRandoms;
end;
end;

procedure WaitisMining;
var
TimeMark : Integer;
begin
MarkTime(TimeMark);
repeat
Wait(200);
FindNormalRandoms;
if(TimeFromMark(TimeMark) > 30000)then
Exit;
until(isChatMessage('succ'))
end;

Never not call FindNormalRandoms in a 2 second range. You should always have your script scanning for randoms continously for best results.


The END.
Sorry, I'm rly busy atm. Quick-wrte, eeek. :P

Sdcit

2006-04-11 23:35:53

Also we will have findnormalrandoms in version 1. Which finds all normal randoms un skill related.

WhiteShadow

2006-04-11 23:38:27

From: Sdcit
Also we will have findnormalrandoms in version 1. Which finds all normal randoms un skill related.


Let's save the will have's for later. :p

XxKanexX

2006-04-11 23:52:15

Good job. It's good someone finally made one of these tutorials. Alot of new people to scar always ask this question ;)

phantombmx

2006-04-12 02:18:26

From: XxKanexX
Good job. It's good someone finally made one of these tutorials. Alot of new people to scar always ask this question ;)


yeah like me :p nah i dont ask.. i just figure it out myself.. trial and error.. thats how 1 of my accounts got banned.. tryin too many things that messed up on it.. :o

great tut whiteshadow!!

WhiteShadow

2006-04-12 02:23:16

@Kane -Yea, many beginers ask this alot. The reason why I made it. :P

@PhantomBmx -Thanks.

c0de

2006-04-12 09:22:49

Great tut :) I'm going to use it in my future scripts :D hahaha :)

WhiteShadow

2006-04-12 18:53:37

From: c0de
Great tut :) I'm going to use it in my future scripts :D hahaha :)


Good to hear. :)

SamTheSam

2006-05-25 00:55:10

Thanks alot! Great tut!

WhiteShadow

2006-05-25 01:03:31

From: SamTheSam
Thanks alot! Great tut!


Yea but since SRL has been updated it's a bit unaccurate, let me update right now.

leader

2006-05-25 20:47:39

I might use it as well. Thanks

Azzon

2007-01-28 03:04:47

Thank you for this, it has been a great help and what I once thought was going to be complicated proved to be very simple, thanks to the work of many others…now to learn more about using this so I can make an anti-evilbob random procedure…

WhiteShadow

2007-02-01 03:25:00

Updated.

JAD

2007-02-10 11:21:48

GREAT tut! i have been wondering how to put randoms in scripts.. this tut will help me a lot in future scripts. thanks man.

syberium

2007-02-10 14:13:57

hey man awsome tut. but my problem is how can i make it search for randoms with out clicking on invbag?? cuz for my script if it goes spellbook–>castspell–>invbag–>spellbook–>repeat, then its not human like at all! its need to just do spellbook–>cast–Cast–Cast and ya u get the point. could i do like if(Findtalk) then
begin
findnormalrandoms;
end;

or sometin so like if the box guy comes and sais hey (username) here ya go! then it will search? im not quite sure how help is needed thanks!

JAD

2007-02-15 23:53:00

after reading the tutorial over a few times, theres 1 thing i don't get. what does
until(isChatMessage('succ'))


mean? when would you ever get the chatmessage('succ')? thats the only thing that confused me, great tut though.

WhiteShadow

2007-02-17 01:28:37

successfully mined or something like that. :P

steve claget

2007-04-10 23:50:14

Thanks this Tut is going to come in handy when i start scripting.

enoyhs

2007-04-22 06:55:53

Thanks a lot ;) I will include these when I will start scripting…

PwNZoRNooB

2007-04-30 01:00:53

Thanks, I needed this.

wobbii

2007-04-30 18:32:44

this this helped me with randoms a bit. good job.

red1

2007-06-02 15:20:25

Oh my freaking god thank you!

I asked some guys at sythe bout how to make an anti random or just give me one and a tut.
they gave me links to already made flax picker and spinner.
Which ruins the whole point of trying to learn it.
I'll be more active here since i am still learning and all.

Alligaattor

2007-06-10 14:30:51

where that FindNormalRandoms function
suposed to put, i'm still noob xD


here?
program new;
{.include SRL/SRL.Scar}


function FindNormalRandoms: Boolean;
var
i: Integer;
begin
for i := 1 to 16 do
begin
case I of
1: CloseWindow;
2: if FindTalk then
Result := True;
3: if FindDead then
Result := True;
4: if FindMod then
Result := True;
5: if FindMime then
Result := True;
6: if FindMaze then
Result := True;
7: if FindQuiz then
Result := True;
8: if FindDemon then
Result := True;
9: if FindScapeRune then
Result := True;
10: if FindTalk then // Call it twice
Result := True;
11: if FindLamp(LampSkill) then // Maybe we missed it?
Result := True;
12: if (FindNewBox) then
begin
Result := True;
if (UseBoxSolver) then
SolveBox
else
GambleNewBox;
end;
13: if FindTrade then
Result := True;
14:
begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
15: SaveToChatLog;
16: if RC then
Result := True;
end;
Wait(1);
end;
end;

WhiteShadow

2007-06-13 21:13:10

program New;
{.include SRL/SRL.Scar}

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Total players?
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; // Start Player.

Players[0].Name:= 'Username';
Players[0].Pass:= 'Password';
Players[0].Nick:= 'Nick';
Players[0].Active:= True;
end;


begin
SetUpSRL;
DeclarePlayers;
LoginPlayer;
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
// ^^ in case we were already logged in
end.

Then just call FindNormalRandoms; whereever you want your script to scan for randoms, remember user set up was important because talking randoms, are found by scanning your screen for your nick!

So no, you do not have to paste in FindNormalRandoms function into your script. Simple write "FindNormalRandoms;" where ever needed.

I hope that clears it up a little, reread my tutorial a bit. :)

Lalaji

2007-06-30 21:13:51

are there amny special randoms i need to add the choipping?

Stevee

2007-06-30 23:36:23

thx, like the find norm randoms

crossback7

2007-06-30 23:42:25

Does this solve the randoms or just find them? Cause it looks like the only one it solves is the box.