SRL Archive - First Scripts

Part Made Script - Big one


HarryJames

2008-11-07 21:03:24

This is my script, its not complete yet (duh).
It is for softening clay in edgeville and this is my first script baically (havent coded in about a year).
I will finnish script, add proggy, antiban, antirandoms.


Thoughts?

program EdgevilleClaySoftener;
{.include srl/srl.scar}

const
username='';
password='';

var
BankBooth=3691620;
EmptyBucket, FullBucket, SoftClay, HardClay, x, y: Integer;
x := MMCX;
y := MMCY;

Procedure login;
begin
mouse(410,459,4,6,true);
Wait(250+Random(400));
mouse(378,546,4,6,true);
Wait(250+Random(400));
TypeSend(username);
Wait(250+Random(400));
TypeSend(password);
Wait(1250+Random(700));
mouse(316,351,4,6,true);
End;

Procedure Start;
Begin
if not(loggedIn) then login;
Wait(1250+Random(1400));
makecompass('n');
CheckInvenAtStart;
End;

Procedure CheckInvenAtStart;
Begin
If (findbitmap(SoftClay, x, y))Then
writeln('Please start with only hard clay. (no soft clay)');
If (findbitmap(EmptyBucket, x, y))Then
writeln('Please start with full buckets. (no empty ones)');
If not (findbitmap(HardClay, x, y))Then
writeln('Please start with 14 hard clay.');
If not (findbitmap(FullBucket, x, y))Then
writeln('Please start with 14 full buckets.');

End;

Procedure DeclareBitmaps;
Begin
EmptyBucket := BitmapFromString(15, 11, 'beNqrccsOkq6Kk4v3l' +
'ACiZB9JZAQUaSgvT4+Pjw0L87UWBqJ0fymISjTFEJFoN3G44iB7Ea' +
'A4UASP4pTY2KiQkGBfX08LIYgIHsXhzqJAk4EIqAvIBiI0xXCHQZy' +
'RFB2dmZRYkJEOdAnE8bgUZ6ck56alluRkVxUV5kcbF8eZAg0HOsnO' +
'gN9Smw+IjNV5gEhHiRuIirIyKwryO/LteosdgSrLEswqk81rUi3rM' +
'6zyQ2XQEFBZV6EDUCVEMURlU5ZNa44tUAoiC1cAZEwocwKinqYmoP' +
'uBBgJVoqmBKJhc4Qwl21o76uuAJgONBXqhr6UFTRkQTa1yBSKgMqD' +
'sDADEXp6P');
FullBucket := BitmapFromString(14, 11, 'beNqrcauKk/O1FrYz4D' +
'dW56mqnoWMGsrL0+PjY8PCXEwEPS2EgMhSmw9NDRzBVQbZi+BSA0E' +
'psbFRISHBvr5AA/GrBCKgmUAE1IJfGdD2pOjozKTEgox0oHeACJfK' +
'7JTk3LTUkpzsqqLC4jjTaDdxoGKgs4EhAPQdMBCASEeJG4iKsjIrC' +
'vJbc2yBqCzBrDLZvCbVsj7DKj9UBg01ZdlAEFAN0ExkxUBBoPaOfL' +
'uuQofeYke4MqADciKM8qONcakHsoGCTZWVHfV1QCmgm4Few6oexC4' +
'p7mtpmQEAWEG3Yg==');
HardClay := BitmapFromString(7, 5, 'beNqbmDC5NnhafciMxjAgY2' +
'JVYF9FQGeJ7/z2qEWd0UByVnM4UAqoACi7emLCyv74Zb1xEKm5rRF' +
'A2S0zUtdPTYZLLemOAcrumpe5bVb6pmkpECkQAgCuBjVU');
SoftClay := BitmapFromString(12, 14, 'beNp9z7EKgDAMRdHd1n6R' +
'g+AgCIIiFHRxcHBxcBD8fSORZ0hK4U7JoSWtG6si1l9L4xBPaMsA8' +
'7X9k0zOVWBb55NJtvdeZZncHkOpJDOaqyw7pxJZyUwaJcGuGJCVzO' +
'45cFaCwSQZRX9lDD9Cd+XBe/sD/Ap+hw==');
End;

Procedure Soften;
Begin
If (findbitmap(FullBucket, x, y))Then
Mouse(x, y, 5, 5, true);
Wait(200+Random(400));
If (findbitmap(SoftClay, x, y))Then
Mouse(x, y, 5, 5, true);
Wait(600+Random(400));
Mouse(254, 438, 5, 5, false);
Wait(200+Random(400));
Mouse(245, 780, 5, 5, true);
End;

Procedure WalkToWell;
Begin
SymbolAccuracy := 0.5;
if (FindSymbol(x, y, 'water source')) then
begin
Mouse(x, y, 5, 5, True);
SymbolAccuracy := 0.8;
wait(500+Random(1000));
end;
End;
Procedure FindWell;
Begin
If (findbitmap(EmptyBucket, x, y))Then
Mouse(x, y, 5, 5, true);
if (FindColorSpiralTolerance(x, y, 2900815, MMX1, MMY1, MMX2, MMY2, 5)) then
MMouse(x, y, 5, 5);
if(IsUpText('ell'))then
Mouse(x, y, 5, 5, true);

End;



////////////////////////// Main Loop /////////////////////
Begin
SetupSRL;
ActivateClient;
ClearDebug;
Start;
DeclareBitmaps;
repeat
Soften;
WalkToWell;
FindWell;
until(false)

End.



Tell me how much it will epically fail :D

joelster134

2008-11-08 05:24:38

umm learn standards, read tuts on radial walk/DTM's (instead of bitmaps) and try to use

MMouse
along with

Mouse
~Joel~~

HarryJames

2008-11-08 05:39:32

I am adding standards and everything else for a good script when its working.

Tniffoc

2008-11-08 08:45:26

You don't need to make your own login method. SRL has done that for you. You should make a procedure called DeclarePlayers; like this :

Players[0].Name := 'username';
Players[0].Pass := 'password';
Players[0].Nick := 'nic' // Three letters of your username. NOT THE FIRST LETTER!!!
Then when your script starts, just make sure you call DeclarePlayers before you call a thing in SRL called LoginPlayer.

Just as a note, SRL also has a logout function… Logout; (I never would have guessed that name :) )

I see that you are beggining to learn colors/DTMs instead of bitmaps, this is good because those are more relieable and most of all, take up less memory therefore making the script faster.

When you use DTMs and bitmaps especially, make sure that you free them or they will just sit in your computer's memory until you re-boot. This will cause your computer to run out of memory (memory leak). Here is how to free a DTM:

FreeDTM(someDTM);

Your standards are still off a bit in some places, it's almost like you don't keep it constant throughout the whole script.
This:

Procedure FindWell;
Begin
If (findbitmap(EmptyBucket, x, y))Then
Mouse(x, y, 5, 5, true);
if (FindColorSpiralTolerance(x, y, 2900815, MMX1, MMY1, MMX2, MMY2, 5)) then
MMouse(x, y, 5, 5);
if(IsUpText('ell'))then
Mouse(x, y, 5, 5, true);

End;
…should be changed to something like this and in other places too:

Procedure FindWell;
begin
if (findbitmap(EmptyBucket, x, y)) then
Mouse(x, y, 5, 5, true);
if (FindColorSpiralTolerance(x, y, 2900815, MMX1, MMY1, MMX2, MMY2, 5)) then
MMouse(x, y, 5, 5);
if(IsUpText('ell'))then
Mouse(x, y, 5, 5, true);
end;

Well, that's all I can think of at the moment, so ya….


EDIT: Thought of another thing : When you get more advanced, you will want SRL to check for and solve random events. This is done by calling FindTalk; and FindNormalRandoms; You can read tutorials of the SRL manual to find out about these and other random solving functions/procedures.

turbobk

2008-11-08 08:48:42

Man this is an EPIC fail, sorry for being so negative and rude, but it's very late here and i just saw this.

Read through a few of the learner tutorials.. That'll help you alot.