SRL Archive - Archive

TomTuff - SRL Member Application


TomTuff

2010-09-05 14:02:07

How Long have You Played Runescape?
6 Year(s)


Are you affilated in anyway with Jagex LTD?
no

Were you Referred to SRL?



What is your general programming knowledge?
tidbits of visual basic and C


Are you a member of any other communities?
not actively.


Tell us about yourself…
From: TomTuff
I'm 15, i'm a sophomore in high school, taking honors classes, i've always enjoyed playing rs, but i enjoy finding ways to get around playing rs even more ;)



Please show us one (or multiple) of your scripts.
program AKC;

{=========================================================================]
[ ]
[ ]
[ NAME : AKC ]
[ WRITER : TomTuff ]
[ CATEGORY : Cooking ]
[ DESCRIPTION : Cooks fish (currently trout only) in al-kharid ]
[ NOTES : Start with player in bank. ]
[ ]
[=========================================================================]
[ VALID FISH ARGUMENTS ]
[ crayfish ]
[ chicken ]
[ shrimp ]
[ sardine ]
[ beef ]
[ anchovies ]
[ herring ]
[ pike ]
[ trout ]
[ salmon ]
[ tuna ]
[ lobster ]
[ swordfish ]
[ ]
[ ]
[=========================================================================]
[ Instructions ]
[=========================================================================]
[ 1. Have your display settings set to 32 bit TRUE color. ]
[ 2. Fill out DeclarePlayers. ]
[ (For further instructions on how to fill it out, visit this thread: ]
[ [url]http://www.villavu.com/forum/showthread.php?t=5410[/url]) ]
[ 3. If you want to use S.M.A.R.T., uncomment line 24, otherwise ]
[ drag the crosshair over the RS client window. ]
[ 4. Start script! ]
[=========================================================================}
//{.include SRL/SRL/misc/smart.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/misc/BuySell.scar}


var
{prog}
OTime,C,StartTime,LD,FishXP,Pl: integer;
{invent}
FishDTM,FishBMP: integer;
{objects}
UT: string;


procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Pl := HowManyPlayers - 1;

With players[0] do
begin
Name := ''; //character name
Pass := ''; //character pass
Nick := ''; //3 consecutive non capital letters of username
Active := True; //Use this player?
Pin := '';//Bank pin. Leave blank if you don't have one.
Strings[0] := ''; //fish name here; valid arguments listed above
Integers[0] := 10; //Loads to do
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;

{
With players[1] do
begin
Name := ''; //character name
Pass := ''; //character pass
Nick := ''; //3 consecutive non capital letters of username
Active := True; //Use this player?
Pin := '';//Bank pin. Leave blank if you don't have one.
Strings[0] := ''; //fish name here; valid arguments listed above
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;} {uncomment and copy this ass neccesary to add more players}
end;


procedure Antiban(I: integer);
var
ABChance: integer;

begin
case I of
0: ABChance := 60;
1: ABChance := 300;
2: ABChance := 600;
end;
case Random(ABChance) of
0: RandomRClick;
1: HoverSkill('cooking', false);
2: PickUpMouse;
4: RandomMovement;
5: BoredHuman;
6: ExamineInv;
end;
GameTab(tab_Inv);
end;


procedure antirandom;
begin
FindNormalRandoms;
LampSkill := 'cooking';
end;


procedure logo;
begin
ClearDebug;
WriteLn('A script by...');
Wait(1000);
WriteLn('_________ _______ _______ _________ _______ _______ ');
Wait(10);
WriteLn('\__ __/( ___ )( )\__ __/|\ /|( ____ \( ____ \ ');
Wait(10);
WriteLn(' ) ( | ( ) || () () | ) ( | ) ( || ( \/| ( \/ ');
Wait(10);
WriteLn(' | | | | | || || || | | | | | | || (__ | (__ ');
Wait(10);
WriteLn(' | | | | | || |(_)| | | | | | | || __) | __) ');
Wait(10);
WriteLn(' | | | | | || | | | | | | | | || ( | ( ');
Wait(10);
WriteLn(' | | | (___) || ) ( | | | | (___) || ) | ) ');
Wait(10);
WriteLn(' )_( (_______)|/ \| )_( (_______)|/ |/ ');
Wait(1100);
WriteLn('presenting...');
Wait(1000);
WriteLn(' _______ _ _______ ');
Wait(10);
WriteLn('( ___ )| \ /\( ____ \ ');
Wait(10);
WriteLn('| ( ) || \ / /| ( \/ ');
Wait(10);
WriteLn('| (___) || (_/ / | | ');
Wait(10);
WriteLn('| ___ || _ ( | | ');
WriteLn('| ( ) || ( \ \ | | ');
Wait(10);
WriteLn('| ) ( || / \ \| (____/\ ');
Wait(10);
WriteLn('|/ \||_/ \/(_______/ ');
Wait(1000);
WriteLn('Al Kharid Cooker');
Wait(1100);
ClearDebug;
end;


procedure SetDTM;
begin
case Players[CurrentPlayer].Strings[0] of
'crayfish': FishDTM := DTMFromString('mWAAAAHicY2FgYJjCxMAwFYj7gHgRED8Hil0D4k9AfB+IM20VgCQTQ5SJDJhGBvxAzIiEYQAA3ioHeg==');
'chicken': FishDTM := DTMFromString('mbQAAAHicY2VgYJjKxMCwFIj7gbgDSvMyMjBwAbEIEPMDMSsQr546BaiaCQ2jAn4gZkTDcAAAqzoFIw==');
'shrimp': FishDTM := DTMFromString('mWAAAAHicY2FgYJjPxMAwA4iXQLE6IwODChBrArEuEE/MCASqYkLCCMAPxIxIGAYAMwEEkw==');
'sardine': FishDTM := DTMFromString('mWAAAAHicY2FgYJjCxMDQD8QTgHg2EAczMjAEAXE4EPsAcermNKAqJiSMAPxAzIiEYQAAVvgFPQ==');
'beef': FishDTM := DTMFromString('mWAAAAHicY2FgYJjJxMCwCIg7gXgKEBczMjCkAXEpEDcDcZuMMFAVExJGAH4gZkTCMAAAU3kFBw==');
'anchovies': FishDTM := DTMFromString('mWAAAAHicY2FgYFjAxMAwE4iXAPEiIJ7CyMDQD8RTgXgWEGdl5wNVMSFhBOAHYkYkDAMAmnoGPg==');
'herring': FishDTM := DTMFromString('mbQAAAHicY2VgYJjKBMGdQDwNiBcA8QFGBoadQHwEiI8C8S4g3rByBVA1ExpGBfxAzIiG4QAAxVAI1g==');
'pike': FishDTM := DTMFromString('mbQAAAHicY2VgYNjPxMBwAIg3A/E+ID4NxM+A4neA+D0QvwPie0AcnxsPJJnQMCrgB2JGNAwHABf2CY4=');
'trout': FishDTM := DTMFromString('mbQAAAHicY2VgYDABYjMg1gRiUyB2BuIcIE4B4jIgLgHiNCBurK4GkkwMB3bsYFg4axZDR1MTAz9QBB0zomE4AACYawqK');
'salmon': FishDTM := DTMFromString('mbQAAAHicY2VgYNjHxMBwAIg3M0HYp4FYj5GBQQWIzYHYDIjVgLgjzAeomgkNowJ+IGZEw3AAAAQ+Bfk=');
'tuna': FishDTM := DTMFromString('mbQAAAHicY2VgYNjDxMBwAIg3A/FeID4NxMGMDAxuQBwFxDFA7AfE0ydMAKpmQsOogB+IGdEwHAAAXUoHOw==');
'lobster': FishDTM := DTMFromString('mWAAAAHicY2FgYDjExMBwFoj3A/EJIC5lZGBIB+ICIK4G4mRLeaAqJiSMAPxAzIiEYQAAi+QFwQ==');
'swordfish': FishDTM := DTMFromString('mWAAAAHicY2FgYNjPxMBwAIi3APFRIJ7KyMDQDcTzgbgfiFdVbAaqYkLCCMAPxIxIGAYA24EHRA==');
end;
end;


procedure SetBMP;
begin
case Players[CurrentPlayer].Strings[0] of
'crayfish': FishBMP := BitmapFromString(4, 4, 'meJzT8m1TsM2UNY2V0PPX9GlRtMuW' +
'NYsX1/ZWdasEikvqB4moOio7FgIFpQxCgOIAJC8Leg==');
'chicken': FishBMP := BitmapFromString(4, 4, 'meJzr7Vvc178EgiZNWQlEEyetAKKp' +
'09ZOmboagqbPWAdBQEEAvFMc+Q==');
'shrimp': FishBMP := BitmapFromString(4, 4, 'meJxr6Z7R2D61rmViTXN/ZX1PVWNf' +
'eV1Xfdtk3+SuwAyQYEv3DCA7KHNyZNH8jv65AFNuF+k=');
'sardine': FishBMP := BitmapFromString(4, 4, 'meJxzKHSImBU2ccXEaWun9i7uXbR7' +
'0dJ9S5PWJs7cMAPITtucmrkjHchYc2x1zr5sIBsAhSkbLw==');
'beef': FishBMP := BitmapFromString(4, 4, 'meJwTlmkThqEFC1cgs+FcZDYAhQIR' +
'VQ==');
'anchovies': FishBMP := BitmapFromString(4, 4, 'meJwrTkkpT08vTUstTknJjI7OjY/P' +
'T0wAklHhYfHR0amJiUCunZkZkJ2enJyfnQUAy98SRA==');
'herring': FishBMP := BitmapFromString(4, 4, 'meJzr65s6YcJ0IJo0acbsOYuBaO7c' +
'JUC0fPm6FSs3QNDqNZvhCADOmx5z');
'pike': FishBMP := BitmapFromString(4, 4, 'meJzzi/ILSQyJSA2PzoyGkPG58UmF' +
'SYn5CSnFKenl6dnVWZmVmTm1OXn1eYXNhQC69xMm');
'trout': FishBMP := BitmapFromString(4, 4, 'meJybNGnGjBnz585dsnjJaiAKCgrb' +
'snXvxk27li9fB2EA0bZt+zZv3g1BAOHWH3Q=');
'salmon': FishBMP := BitmapFromString(4, 4, 'meJyzdEi1ccl2cC908iqFkC4+lW7+' +
'tc7e5UDSM6jZJ6wDQvpH9gXFTgYAhg8Q9g==');
'tuna': FishBMP := BitmapFromString(4, 4, 'meJwlwgEKABAMAMAX8HaNNY012pLy' +
'Scp1uXBKBFBfESeSF7GHGFo35qm6zM+Y+7+X6huT');
'lobster': FishBMP := BitmapFromString(4, 4, 'meJyTNYuXt0pVss/l5eWTs0hUsE5X' +
'cshXdS2Xt0xWsM1UdixUdasEskVUHUXVnYEkAA6BCvo=');
'swordfish': FishBMP := BitmapFromString(4, 4, 'meJzrimnuimnuiG4EovlZ0xfnzlqW' +
'P3dl4YK1xYu3Va3dW7f5UOP2zRWrtlau3lG9DsgFAHWsG1Y=');
end;
end;


procedure SetUT;
begin
Case [Players[CurrentPlayer].Strings[0]] of
'crayfish': UT := 'aw crayfish';
'chicken': UT := 'aw chicken';
'shrimp': UT := 'aw shrimp';
'sardine': UT := 'aw sardine';
'beef': UT := 'aw beef';
'anchovies': UT := 'aw anchovies';
'herring': UT := 'aw herring';
'pike': UT := 'aw pike';
'trout': UT := 'aw trout';
'salmon': UT := 'aw salmon';
'tuna': UT := 'aw tuna';
'lobster': UT := 'lobster';
'swordfish': UT := 'aw swordfish';
end;
end;


procedure SetFishXP;
begin
case [Players[CurrentPlayer].Strings[0]] of
'crayfish': FishXP := 30;
'chicken': FishXP := 30;
'shrimp': FishXP := 30;
'sardine': FishXP := 40;
'beef': FishXP := 30;
'anchovies': FishXP := 30;
'herring': FishXP := 50;
'pike': FishXP := 80;
'trout': FishXP := 70;
'salmon': FishXP := 90;
'tuna': FishXP := 100;
'lobster': FishXP := 120;
'swordfish': FishXP := 140;
end;
end;


function CountInvFish: integer;
var
NumFish: integer;
begin
SetDTM;
NumFish := CountItems('dtm',FishDTM,[]);
FreeDTM(FishDTM);
Result := NumFish;
WriteLn(IntToStr(NumFish));
end;


procedure setcamera;
begin
MakeCompass('n');
SetAngle(true);
end;


procedure prog;
var p: integer;
begin
p := 0;
repeat
with players[p] do
begin
SetFishXP;
WriteLN('Player: ' + Players[currentplayer].name);
WriteLn('Fish Cooked: ' + IntToStr(C));
WriteLn('Loads Done: ' + IntTostr(LD));
WriteLn('Exp Gained: ' + IntToStr(C*FishXP));
p := p + 1;
end;
until p = pl;
end;


procedure OpenTheBank; //i luffs yew (over msn), slightly modified
begin
if(not (Loggedin)) then exit;
if LD = Players[currentplayer].Integers[0] then
begin
NextPlayer(Players[CurrentPlayer].Active);
Prog;
end else
begin
if BankScreen then exit;
setcamera;
if( not (OpenBankNPC)) then
if(not (OpenBankFast('akb'))) then
if(not (OpenBank('akb',false,false))) then
if(not (OpenBankGlass('akb',false,false))) then
begin
WriteLn('banking failed, logging out');
Logout;
end;
end;
Antiban(2);
end;


procedure WithdrawTheFood;
var
x,y,i,a: integer;
TP: TPointArray;
begin
if(not (Loggedin)) then exit;
if(not (BankScreen)) then OpenTheBank;
DepositAll;
FixBank;
FixBankTab;
Wait(100+random(25));
SetDTM;
if FindDTM(FishDTM, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
WriteLn('found du fishy');
Mouse(x,y,5,5,false);
ChooseOption('draw-All');
end else
begin
TP := FindItems(10526888, 6, UT, 28);
repeat
MMouse(TP[i].x, TP[i].y,4,4);
Mouse(x,y,0,0,false);
ChooseOption('All');
a := a + 1;
until(CountInvFish > 0) or (a>4);
end;
CloseBank;
if CountInvFish = 0 then logout;
FreeDTM(FishDTM);
end;


function FindRangeFloor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 7440298, MMX1, MMY1, MMX2, MMY2, 0);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 28.20) and (X <= 28.24) and (Y >= 27.05) and (Y <= 27.09) and (Z >= 19.34) and (Z <= 19.38) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


procedure WalkToRange;
var x, y, CColor: integer;
begin
if not LoggedIn then Exit;
setcamera;
antirandom;
antiban(1);
CColor := FindRangeFloor;
if( not( RadialWalkTolerance(CColor, 4, 30, 55,1,1,10))) then
if( not( FindSymbol(x,y, 'cook'))) then
begin
WriteLn('both walking functions failed, logging out...');
logout;
end else Mouse(x,y,2,2,true);
Wait(1000+random(200));
end;


function FindBankFloor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 6786228, MMX1, MMY1, MMX2, MMY2, 0);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 30.63) and (X <= 30.67) and (Y >= 29.42) and (Y <= 29.46) and (Z >= 16.88) and (Z <= 16.92) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


procedure WalkToBank;
var x, y,CColor: integer;
begin
if not LoggedIn then Exit;
setcamera;
antirandom;
antiban(1);
CColor := FindBankFloor;
if( not( RadialWalkTolerance(CColor, 195, 205, 53,1,1,10))) then
if( not( FindSymbol(x,y, 'bank'))) then
begin
WriteLn('both walking functions failed, logging out...');
logout;
end else Mouse(x,y,2,2,true);
Wait(1000+random(200));
end;


function ClickFishInInv: boolean;
var
x,y,ObjX,ObjY: integer;
begin
antiban(0);
antirandom;
SetDTM;
if FindDTM(FishDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
WriteLn('found du fishy');
Mouse(x,y,5,5,true);
result := true;
end else
begin
FreeDTM(FishDTM);
SetBMP;
if( not( FindObjectDeformed(ObjX,ObjY,'ang','nge',FishBMP,MSX1,MSY1,MSX2,MSY1))) then
begin
FreeBitmap(FishBMP);
result := false;
Logout;
end else
begin
FreeBitmap(FishBMP);
MMouse(ObjX,ObjY,5,5);
Mouse(ObjX,ObjY,0,0,true);
result := true;
exit;
end;
end;
FreeDTM(FishDTM);
end;


function FindTheRange: Boolean; //credits: Coh3n's guide, slightly modified/parts taken out
var
ObjX, ObjY,x, y, i,RangeBMP: integer;
TPA: TPointArray;
ATPA : T2DPointArray;
begin
if not LoggedIn then Exit;
if( not (ClickFishInInv)) then
begin
result := false;
logout;
end else
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.85);
FindColorsSpiralTolerance(x,y,TPA,1648046,MSX1, MSY1, MSX2, MSY2,10);
ATPA := SplitTPAEX(TPA,5,5);
if(Length(ATPA) = 0) then
begin
RangeBMP := BitmapFromString(4, 4, 'meJyT1tgnjQ35JhUDUWB6JRBJqqwF' +
'IinVzUAEAIr2EGc=');
if( not( FindObjectDeformed(ObjX,ObjY,'ang','nge',RangeBMP,MSX1,MSY1,MSX2,MSY1))) then
begin
FreeBitmap(RangeBMP);
Result := false;
Logout;
end else
begin
FreeBitmap(RangeBMP);
MMouse(ObjX,ObjY,5,5);
Mouse(ObjX,ObjY,0,0,true);
result := true;
exit;
end;
end;
SortATPAFromFirstPoint(ATPA, Point(MSCX,MSCY));
WriteLn('Length: ' + IntToStr(Length(ATPA[i])));
MiddleTPAEx(ATPA[i],x,y);
MMouse(x,y,4,4);
Mouse(x,y,0,0,true);
Result := True;
end;
Wait(4000+Random(1000));
end;


procedure cook;
begin
if FindTheRange then
begin
Mouse(257,414,5,5,false);
ChooseOption('All');
C := C + CountInvFish;
LD := LD + 1;
WriteLn('Completing load #' + IntToStr(LD));
end else logout;
end;


procedure CWait;
var time, WT: integer;
begin
WriteLn('Waiting for fish to cook...');
MarkTime(time);
WT := (CountInvFish * 2500 + Random(200));
while TimeFromMark(time) < WT do
begin
antirandom;
antiban(2);
end;
end;


procedure MainLoop;
begin
Logo;
SetUpSRL;
DeclarePlayers;
LoginPlayer;
repeat
repeat
OpenTheBank;
WithdrawTheFood;
WalkToRange;
cook;
CWait;
WalkToBank;
until (not LoggedIn);
NextPlayer(Players[CurrentPlayer].Active);
until(AllPlayersInactive);
prog;
end;


begin
MainLoop;
end.


JuKKa

2010-09-05 14:12:44

You know the basics, but there is still alot of improvement.
I'm not gonna vote just yet, because I haven't voted in such a long time, have to wait and see what others say.

Rich

2010-09-05 16:35:20

Very few failsafes. Like JuKKa said, you show the basics, but there's still plenty to learn. For instance, your anti-ban procedures could be compiled into one:
procedure Antiban(Level : string);
var
L : Integer;

begin
case Level of
'h' : L:= 60;
'm' : L:= 300;
'l' : L:= 600;
end;
case Random(L) of
0: RandomRClick;
1: HoverSkill('cooking', false);
2: PickUpMouse;
4: RandomMovement;
5: BoredHuman;
6: ExamineInv;
end;
GameTab(tab_Inv);
end;

The only failsafe you have in your walking is that if it doesn't succeed, it logs out. Perhaps check for symbols, or specific colours on the minimap?

What's the point of this? :
  MakeCompass('n');
MakeCompass('250.5');
Also, I'm not entirely sure how MakeCompass works, but AFAIK, that would set it to 250.5 degrees each time, looking very bot-like.

With:
procedure CWait;
var
WT: integer;
begin
WT := CountInvFish * 2500 + Random(1100);
Wait(WT);
end;
Perhaps use a different method of waiting (MarkTime) so that anti-randoms checks can take place whilst waiting.

It's obvious you know the basics, but for me you aren't showing enough skills to be entered in SRL Members, so it's a no from me.

Richard.

Daniel

2010-09-06 06:47:33

Yes.

Your attitude and perseverance is exquisite. Sure the script may be a bit dodgy here and there, but if you keep working at it the way you're going right now, then you'll definitely make a flawless script soon :)

The only area that I can really see that needs improvement is your fail-safes. Not many I can see except for the standard if(not(LoggedIn)) then Exit;.

Good luck. ;)

TomTuff

2010-09-06 13:03:17

thanks dan ^_^ also, the scripts been updated with multifish support and more failsafes.

HyperSecret

2010-09-06 13:29:27

I'm not a big fan of how you execute FindTheRange function. You should have a set of parameters x,y and use those to move the mouse and click the range. Instead you have FindTheRange then Click coords, not my likeing.

Use a GetMousePos(x,y) and return those coords to the caller and then you will be able to use those coords to click on the range. They should be random everytime, you can add more randomness if you want with the mouse function.

Besides that I like the flow of everything else. I would say 'No' just because I don't fully see that you can follow everything through correctly and that you don't understand some structures correctly.


Ex.


for i := 0 to 0 do
begin
WriteLn('Length: ' + IntToStr(Length(ATPA[i])));
MiddleTPAEx(ATPA[i],x,y);
MMouse(x,y,4,4);
Mouse(x,y,0,0,true);
Result := True;
end;

Should be:

  
WriteLn('Length: ' + IntToStr(Length(ATPA[0])));
MiddleTPAEx(ATPA[0],x,y);
Mouse(x,y,4,4,true);
Result := True;

since the i = 0 to 0 is only 0 there is no need for the loops.

Also, not a single UpText check in the whole script? How do you know you are actually on the range?

Keep it up though!

TomTuff

2010-09-06 14:17:15

From: HyperSecret
I'm not a big fan of how you execute FindTheRange function. You should have a set of parameters x,y and use those to move the mouse and click the range. Instead you have FindTheRange then Click coords, not my likeing.

Use a GetMousePos(x,y) and return those coords to the caller and then you will be able to use those coords to click on the range. They should be random everytime, you can add more randomness if you want with the mouse function.

Besides that I like the flow of everything else. I would say 'No' just because I don't fully see that you can follow everything through correctly and that you don't understand some structures correctly.


Ex.


for i := 0 to 0 do
begin
WriteLn('Length: ' + IntToStr(Length(ATPA[i])));
MiddleTPAEx(ATPA[i],x,y);
MMouse(x,y,4,4);
Mouse(x,y,0,0,true);
Result := True;
end;

Should be:

  
WriteLn('Length: ' + IntToStr(Length(ATPA[0])));
MiddleTPAEx(ATPA[0],x,y);
Mouse(x,y,4,4,true);
Result := True;

since the i = 0 to 0 is only 0 there is no need for the loops.

Also, not a single UpText check in the whole script? How do you know you are actually on the range?

Keep it up though!


findtherange clicks the range after the fish has been clicked in your inventory, and then the one that uses coords clicks the fish down in the bottom (the one you right click to do cook-fish, cook-5 fish, cook-10 fish, cook-x fish, cook-All fish, etc.)

mormonman

2010-09-06 14:22:54

You forgot to update your withdrawing procedure…it still only allows trout.

TomTuff

2010-09-06 16:00:53

From: mormonman
You forgot to update your withdrawing procedure…it still only allows trout.


updated, didn't see that, thanks ;)

cycrosism

2010-09-06 17:22:38

Sorry, the script isn't detailed enough.

Instead of using FindObj or FindObjCustom (Or whatever it's called) Make your own TPA's and make your script find them with FindColorsToleranceSpiral (I think that's the function).

Don't make the user set the colour of anything. You should make auto colours. A good start to finding the bank would be to find the symbol, then eventually learn other methods like making DDTMS of things in the area, such as trees and rocks.

Don't use coord clicking for your inv selecting, you never know what might happen and something might change spots, then your character will be there for a long time clicking the wrong item trying to cook that. Use bitmaps, they are very easy to use and work pretty much as fast as a coord click. (See my sig for how to use bitmaps - I have a big tutorial on it!)

I do see you have a TPA but you stated its from Coh3n's guide. Did you actually write this all up or did you just copy/paste and change a few parameters? Using bitmaps over DTMS will be better, as they are quicker to find and most of the times, smaller.

Good script, you are very close to becoming a SRL member

TomTuff

2010-09-06 20:42:52

From: cycrosism
Sorry, the script isn't detailed enough.

Instead of using FindObj or FindObjCustom (Or whatever it's called) Make your own TPA's and make your script find them with FindColorsToleranceSpiral (I think that's the function).

Don't make the user set the colour of anything. You should make auto colours. A good start to finding the bank would be to find the symbol, then eventually learn other methods like making DDTMS of things in the area, such as trees and rocks.

Don't use coord clicking for your inv selecting, you never know what might happen and something might change spots, then your character will be there for a long time clicking the wrong item trying to cook that. Use bitmaps, they are very easy to use and work pretty much as fast as a coord click. (See my sig for how to use bitmaps - I have a big tutorial on it!)

I do see you have a TPA but you stated its from Coh3n's guide. Did you actually write this all up or did you just copy/paste and change a few parameters? Using bitmaps over DTMS will be better, as they are quicker to find and most of the times, smaller.

Good script, you are very close to becoming a SRL member


i've edited it to use autocolor now for the walking functions, the idea of doing so didn't even occur to me :duh:

the coord clicking isn't for something in my inventory, it's for the icon that pops up in the chatbox after you use raw food on a range/fire. since it's the same no matter the food, i chose the center point with a good amount of randomness. It would be a waste to store 13 more DTMs/BMPs in the script.

the general idea for the procedure is taken from coh3n, but it's mostly by me

e: added 'loads to be done' type thing

cycrosism

2010-09-07 03:20:04

From: TomTuff
the coord clicking isn't for something in my inventory, it's for the icon that pops up in the chatbox after you use raw food on a range/fire. since it's the same no matter the food, i chose the center point with a good amount of randomness. It would be a waste to store 13 more DTMs/BMPs in the script.


I apologise, I must of read the function or something incorrectly. Glad to see you have made some improvements, keep up the good work.

TomTuff

2010-09-09 21:20:32

anyone else have anything to say?

Awkwardsaw

2010-09-09 23:28:19

yes, because you're cool, and i think you know enough to be a member

TomTuff

2010-09-09 23:33:05

From: Awkwardsaw
yes, because you're cool, and i think you know enough to be a member


te amo!

WT-Fakawi

2010-09-10 06:00:09

Yes!

TomTuff

2010-09-10 09:55:32

thanks fakawi you're awesome

E: when is the decision made? So in other words, when does the thread close for voting?

Cstrike

2010-09-10 21:25:27

Great job in understanding the fundamentals. I don't think I can vote (because of the 8 day rule and I don't think I've been here for 8 days as a member… maybe I have but I'll wait longer before I start voting).
EDIT: I just realized I've been here longer than that for sure.

A thing you may want to consider is the following:

1. Shortening [if possible]:

You could take this

procedure SetFishXP;
begin
case [Players[CurrentPlayer].Strings[0]] of
'crayfish': FishXP := 30;
'chicken': FishXP := 30;
'shrimp': FishXP := 30;
'sardine': FishXP := 40;
'beef': FishXP := 30;
'anchovies': FishXP := 30;
'herring': FishXP := 50;
'pike': FishXP := 80;
'trout': FishXP := 70;
'salmon': FishXP := 90;
'tuna': FishXP := 100;
'lobster': FishXP := 120;
'swordfish': FishXP := 140;
end;
end;

procedure SetFishXP (nameOfFish : String);
var fishName : TStringArray;
fishExp : TIntegerArray;
i : Integer;
begin
fishName := ['crayfish','chicken','shrimp','sardine','beef','anchovies','herring','pike','trout','salmon','tuna','lobster','swordfish'];
fishExp := [30, 30, 30, 40, 30, 30, 50, 80, 70, 90, 100, 120, 140];
for i:=0 to high(fishName) do
begin
if nameOfFish = fishName[i] then writeln ('Experience for '+nameOfFish+' = '+inttostr(fishExp[i]));
// Define whatever variable here with := fishExp[i];
end;
end;

Then later on just call something like
SetFishXP('swordfish');

This is what I do because I find it easier to add variables, plus the code has been reduced from 18 lines down to 13/14 lines (and I could compress it even more with the variables, but then it wouldn't look right).
What you did with the cases is great! Shows you know them and are comfortable [hopefully].
Remember, failsafes. What if someone types a name wrong :p


2. if not LoggedIn then Exit;
Try and add these to procedures so the program can exit faster.


3. How comfortable are you with TPA's?
3b) How comfortable with Wizzyplugin?


4. Where are your comments? I really like a script that has comments beside certain key lines. No one will really agree with me, but I like it because I can see your logic flow, let me give you an example of what I've done.
Note: This is not the best example of what I've done, but see how things can become complicated?
Note2: Do NOT go through this trying to understand it, for you may screw your mind up since it is even hard for me to follow my own code through when I'm not in the right mind… plus it is probably not really succinct in terms of code yet. Just look at the green stuff
     
//Returns TPoint from ATPA which is closest to current position
function SubPointDistances (ATPA : T2DPointArray) : TPoint;
var distArrLowest, tempdistArrLowest, distTPAInt, tempdistTPATInt : TIntegerArray;
distArrLowestTP : TPointArray;
currentTile : TTile;
i, j, k, z : Integer;
begin
if not LoggedIn then exit;
currentTile := GetMyPos; // Don't remove this, it's needed
writeln ('SubPointDist: Current tile = ('+inttostr(currentTile.x)+','+inttostr(currentTile.y)+')');
writeln ('high(ATPA) = ' + inttostr(high(ATPA)));
SetArrayLength (distArrLowest, high(ATPA)+1); // The array that holds all the *smallest* distances from each TPA
SetArrayLength (tempdistArrLowest, high(ATPA)+1);
SetArrayLength (distArrLowestTP, high(ATPA)+1);
for i:=0 to high(ATPA) do // For the entire ATPA do...
begin
SetArrayLength (distTPAInt, high(ATPA[i])+1);
SetArrayLength (tempdistTPATInt, high(ATPA[i])+1);
for j:=0 to high(ATPA[i]) do // For each TPA in ATPA do...
begin
distTPAInt[j] := Distance (currentTile.x, currentTile.y, ATPA[i][j].x, ATPA[i][j].y);
tempdistTPATInt[j] := Distance (currentTile.x, currentTile.y, ATPA[i][j].x, ATPA[i][j].y);
writeln ('ATPA['+inttostr(i)+']['+inttostr(j)+'] distance = '+inttostr(distTPAInt[j])+' ('+inttostr(ATPA[i][j].x)+','+inttostr(ATPA[i][j].y)+')'); // Debug
if j = high(ATPA[i]) then // When we reach the top of our TPA, do the following [only because I cant do this outside the for loop...]
begin
TMin (tempdistTPATInt); // Return the integer thats the SMALLEST distance from the TIntegerArray
writeln ('Minimum distance (tempdistTPAInt[0])= '+inttostr(tempdistTPATInt[0]));
distArrLowest[i] := tempdistTPATInt[0];
tempdistArrLowest[i] := tempdistTPATInt[0];
for k:=0 to high(ATPA[i]) do // This goes back and gives us the TPoint that matches up with the smallest distance, and stores it in an array for future decisions
begin
if distArrLowest[i] = distTPAInt[k] then
begin
distArrLowestTP[i] := ATPA[i][k];
end;
end;
end;
end;
end;
for z:=0 to high(ATPA) do // Debug output to get a nice chart :)
begin
writeln ('distArrLowest['+inttostr(z)+'] = '+inttostr(distArrLowest[z])+' @ distArrLowestTP['+inttostr(z)+'] ('+inttostr(distArrLowestTP[z].x)+','+inttostr(distArrLowestTP[z].y)+')');
end;
TMin (tempdistArrLowest);
for z:=0 to high(ATPA) do
begin
if tempdistArrLowest[0] = distArrLowest[z] then
begin
writeln ('Smallest distance is ['+inttostr(z)+'] = '+inttostr(distArrLowest[z])+' @ distArrLowestTP['+inttostr(z)+'] ('+inttostr(distArrLowestTP[z].x)+','+inttostr(distArrLowestTP[z].y)+')');
result := distArrLowestTP[z];
end;
end;
end;

5. What about failsafes for things like the bank opening? Maybe I missed it– if so please forgive me and ignore #5.


The only question I'd have to for you is:
If you don't get in this time, what will you do next time to make yourself better? What can you bring to the SRL community that is unique? Doesn't have to be something amazing, for example: I would answer "I want to bring scripts to the SRL community that are based around Walking and acting like 'real life humans' to avoid getting reported. Something like that– be creative :)

keep up the good work!

Tniffoc

2010-09-10 21:44:34

Autocolor by ACA2. Holding my vote. If you know what ACA is doing, then OK. If you don't know what its doing for you, then that might change some things.

Example of function(s) in question: FindRangeFloor: Integer

TomTuff

2010-09-11 01:38:05

From: Tniffoc
Autocolor by ACA2. Holding my vote. If you know what ACA is doing, then OK. If you don't know what its doing for you, then that might change some things.

Example of function(s) in question: FindRangeFloor: Integer


in a nutshell, it sets the CTS, uses findcolorspiraltolerance to find the assigned color, stores the TPA in the variable arP, if the length of arp is 0 then it resets the CTS and exits. if arP > 0, then it stores the colors in an intiger array (arC). If it finds duplicates, it deletes them. it then uses colortoxyz to store the colors in the variables declared by ColorToXYZ(x,y,z) and gets the color from arC. it then looks through the values of x,y, and z to detirmine if they're right, and if they are sets the result to arC.

Tniffoc

2010-09-13 23:06:15

I would like to see an autocolor function written without the aid of ACA2. Still holding my vote.

bugger0001

2010-09-15 13:48:31

You've kept it nice and simple. I must say I appreciate simple scripts that achieve their goal. Okay, let's see how have you managed yours.

In WithdrawTheFood you have the following lines:

repeat
MMouse(TP[i].x, TP[i].y,4,4);
Mouse(x,y,0,0,false);
ChooseOption('All');
a := a + 1;
until(CountInvFish > 0) or (a>4);

I don't actually get it. You don't initialize integer i before that part and I don't actually see the point of using a TPA to click the same point all four times.



Now there's one thing in FindRangeFloor and the same in FindBankFloor I'm not too convinced about. Could someone please explain me why is the following good, because I'm not too much into CTS2 :P

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00); //I mean THIS here!?
FindColorsSpiralTolerance(MMCX, MMCY, arP, 7440298, MMX1, MMY1, MMX2, MMY2, 0);

And then there's one more thing I absolutely hate in your script:
procedure cook;
begin
if FindTheRange then
begin
Mouse(257,414,5,5,false); //That's it! Are you sure you can rely that much on FindTheRange?
ChooseOption('All');
C := C + CountInvFish;
LD := LD + 1;
WriteLn('Completing load #' + IntToStr(LD));
end else logout;
end;

And one more thing. Actually that's more like a suggestion, because timing isn't always a good way of handling stuff:
procedure CWait;
var time, WT: integer;
begin
WriteLn('Waiting for fish to cook...');
MarkTime(time);
WT := (CountInvFish * 2500 + Random(200));
while TimeFromMark(time) < WT do
begin
antirandom;
antiban(2);
end;
end;

Instead of this, try making a counting function, that would count raw fishes in your inventory. If 0 then it means you've cooked all the fishies. And then add a timer there as a failsafe ;)


Now to sum it all up, I must say that you show good knowledge concerning the SRL include. But there are things in your script that I find a bit too simple to be a proper solution and therefore it makes your script just a little not enough to please me.

None the less, Good luck with your application and if you don't make it now, then I see the potential of you becoming a member soon enough!

BraK

2010-09-15 14:20:39

Expanding on what cstrike said about your about your fishxp function. you could combine it with some of your other setup functions(ie. Setting Var UT in the same function.) You have 4 setup procedures all using the same string to determine the presets for the script.

Another good thing for you to look up would be for to do loops. There are a few places that you use repeat..until that really could have done with the previously stated loop. It would also solve the initializing var i that bugger0001 mentioned. Here's a tut that I'd recommend by NCDS.

Also look into adding uptext checks when object finding. You set the Var UT for a reason.

You have a good attitude which is a bonus and you show a willingness to learn.

I vote Yes.

@cstrike thanks for adding that bit about shortening the function. I was looking for it awhile back. Rep+

E: I thought I would post what cstrike helped me with. It might shed some light one what I meant by combining the Var setup functions.

Old Function:

Function Clean : boolean;   // new function testing Cleans in various patterns
var
slot : array [1..14] of integer;
i, c : integer;

begin
case random(20) of
0..4 : begin slot[1] := 1; slot[2] := 2; slot[3] := 3; slot[4] := 4; slot[5] := 8; slot[6] := 7; slot[7] := 6; slot[8] := 5; slot[9] := 9; slot[10] := 13; slot[11] := 14; slot[12] := 10; slot[13] := 11; slot[14] := 12; end;
5..9 : begin slot[1] := 1; slot[2] := 5; slot[3] := 9; slot[4] := 13; slot[5] := 14; slot[6] := 10; slot[7] := 6; slot[8] := 2; slot[9] := 3; slot[10] := 7; slot[11] := 11; slot[12] := 12; slot[13] := 8; slot[14] := 4; end;
10..14 : begin slot[1] := 4; slot[2] := 3; slot[3] := 2; slot[4] := 1; slot[5] := 5; slot[6] := 6; slot[7] := 7; slot[8] := 8; slot[9] := 12; slot[10] := 11; slot[11] := 10; slot[12] := 9; slot[13] := 13; slot[14] := 14; end;
15..19 : begin slot[1] := 1; slot[2] := 2; slot[3] := 3; slot[4] := 4; slot[5] := 8; slot[6] := 12; slot[7] := 11; slot[8] := 7; slot[9] := 6; slot[10] := 10; slot[11] := 14; slot[12] := 13; slot[13] := 9; slot[14] := 5; end;
end;
begin
invmouse(1,3);
Wait(RandomRange(600,800));
if not(isuptextmulticustom(['Grim', 'rimy'])) then
begin
result := True;
Debug('using Clean Herbs');
exit;
end else
begin
Debug('Cleaning Herbs.');
for i := 1 to 14 do
begin
invmouse(slot[i],1);
wait(200 + random(200));
end;
while not(isuptextmulticustom(['Clean', 'lean'])) do
begin
wait(RandomRange(200, 300));
Inc(c);
if (c = 20) then
begin
result := false;
nextplayer(false);
exit;
end;
end;
incex(players[currentplayer].Integers[SRL_Cleaned], 14);
incEx(Stats_CustomVars[SRL_cleaned], 14);
players[currentplayer].Extendeds[SRL_XP]:= (players[currentplayer].Extendeds[SRL_XP] + (14 * xph));
result := true;
end;
end;
end;

Notice how nasty my case of statment looks. Here is the new version.

Function Clean2 : boolean;
var
CC : TIntegerArray;
c, i :integer;
begin
case random(24) of
0..2 : CC := [1,2,3,4,8,12,11,10,14,13,9,5,6,7];
3..5 : CC := [1,2,6,5,9,13,14,10,11,12,8,7,3,4];
6..8 : CC := [1,2,6,7,3,4,8,12,11,10,14,13,9,5];
9..11 : CC := [1,2,6,5,9,13,14,10,11,12,8,4,3,7];
12..14 : CC := [1,2,3,4,8,12,11,7,6,5,9,13,14,10];
15..17 : CC := [1,5,9,13,14,10,11,12,8,4,3,7,6,2];
18..20 : CC := [1,5,9,13,14,10,6,2,3,7,11,12,8,4];
21..23 : CC := [1,5,9,13,14,10,6,2,3,4,8,7,11,12];
end;
begin
invmouse(1,3);
Wait(RandomRange(600,800));
if not(isuptextmulticustom(['Grim', 'rimy'])) then
begin
result := True;
Debug('using Clean Herbs');
exit;
end else
begin
Debug('Cleaning Herbs.');
for i := 0 to High(CC) do
begin
invmouse(CC[i],1);
wait(200 + random(200));
end;
while not(isuptextmulticustom(['Clean', 'lean'])) do
begin
wait(RandomRange(200, 300));
Inc(c);
if (c = 20) then
begin
result := false;
nextplayer(false);
exit;
end;
end;
incex(players[currentplayer].Integers[SRL_Cleaned], 14);
incEx(Stats_CustomVars[SRL_cleaned], 14);
players[currentplayer].Extendeds[SRL_XP]:= (players[currentplayer].Extendeds[SRL_XP] + (14 * xph));
result := true;
end;
end;
end;

It looks a lot cleaner right. Well change those CC var assignment to something like this:


case lowercase(FishName) of
'trout' : begin
cc := set var;
cd := set next var;
ce := set another var;
cf := set another var;
end;

'salmon' : begin
cc := set var;
cd := set next var;
ce := set another var;
cf := set another var;
end;

end;

Hope this helps some and/or gives you some ideas of what you could do with it.

~BraK

E: had to edit my Tintegerarray stament forgot to set for i := 0 to High(CC) do

Cstrike

2010-09-16 10:16:00

You're welcome :)
It's funny that you mention that, because I remember reading it in a tutorial on here somewhere and couldn't find it. I almost gave up, but accidentally found Variants on the SRL wiki. Hell, with one TVariantArray I could have like 5+ arrays in one :D


@TomTuff, if you wanted my vote you would've had to have replied to my stuff, as I do not give out votes without getting further information about the applicant. I'm unsure to why you didn't… since that means I vote 'no' unless something exceptional has occurred. In this case, nothing exceptional had occured– and then I tend to base the vote on responses to questions I give.

WT-Fakawi

2010-09-16 10:55:46

Draw. Fakawi's says: in!….but he'll wait another 60 hours.

TomTuff

2010-09-17 01:28:37

hey guys sorry for not responding to very many posts D: school started and the hw load is wayyyyyyy more than what i was expecting on top of practice….

i wish i had time to update my script with all of your feedback, but i really can't =( i'll try and make some time this sunday, though, and attempt to incorporate everything you guys recommended

E: did what you guys reccomended just now, i thought it was gonna take a while so i kept a text doc… copying that over along with new & improved script

I made this over a course of day, and kept my reply in a txt document, so it might look a bit sketchy

CStrike:
1. Thanks for the advice on the TVariantArray (that is what it's called, right?)! at first i didnt

understand how the 2 arrays lined up with eachother but then i saw how high works… got it, great lesson

all in its own =)

2. These were already in the script, just as "if(not (Loggedin)) then exit;"

3. TPA's/Wizzy's pluggin are pretty intuitive for me, although i may have to occasionaly look at a tut to

see how different functions work :P

4. No comments, i guess i could add them for you :P

5. It's one big failsafe
    if( not (OpenBankNPC)) then // if openbankNPC fails then
if(not (OpenBankFast('akb'))) then // if OpenBankFast fails then
if(not (OpenBank('akb',false,false))) then // if openbank fails then
if(not (OpenBankGlass('akb',false,false))) then //if openbankglass fails then logout




bugger0001:
the i's are sort of like placeholders, they just make it work. It Attempts to withdraw the food until

CountInvFish {there are xxx fish} > 0, or until a { ATTEMPTS } is > 4… so it only tries 4 times

E: read Brak's post, replaced with for..to..do

in the cook procedure, it has already used the fish on the range. the coords are the large icon that

appears in the chatbox, and it's in the same spot for every food. those coords are on the center of every

food, and so i figured that another 13 BMPs in the script would be a waste…

CountInvFish does count # of raw fishes in inventory, but i will implement the idea of waiting till it's

0… thanks =)

Brak
thanks, made the withdraw procedure a for..to..do, variables now actually initialize =P

added uptext checks when withdrawing food and when finding range.

SCRIPT:
program AKC;

{=========================================================================]
[ ]
[ ]
[ NAME : AKC ]
[ WRITER : TomTuff ]
[ CATEGORY : Cooking ]
[ DESCRIPTION : Cooks fish (currently trout only) in al-kharid ]
[ NOTES : Start with player in bank. ]
[ ]
[=========================================================================]
[ VALID FISH ARGUMENTS ]
[ crayfish ]
[ chicken ]
[ shrimp ]
[ sardine ]
[ beef ]
[ anchovies ]
[ herring ]
[ pike ]
[ trout ]
[ salmon ]
[ tuna ]
[ lobster ]
[ swordfish ]
[ ]
[ ]
[=========================================================================]
[ Instructions ]
[=========================================================================]
[ 1. Have your display settings set to 32 bit TRUE color. ]
[ 2. Fill out DeclarePlayers. ]
[ (For further instructions on how to fill it out, visit this thread: ]
[ [url]http://www.villavu.com/forum/showthread.php?t=5410[/url]) ]
[ 3. If you want to use S.M.A.R.T., uncomment line 24, otherwise ]
[ drag the crosshair over the RS client window. ]
[ 4. Start script! ]
[=========================================================================}
//{.include SRL/SRL/misc/smart.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/misc/BuySell.scar}


var
{prog}
OTime,C,StartTime,LD,FishXP,Pl: integer;
{invent}
FishDTM,FishBMP: integer;
{objects}
UT: string;


procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Pl := HowManyPlayers - 1;

With players[0] do
begin
Name := ''; //character name
Pass := ''; //character pass
Nick := ''; //3 consecutive non capital letters of username
Active := True; //Use this player?
Pin := '';//Bank pin. Leave blank if you don't have one.
Strings[0] := ''; //fish name here; valid arguments listed above
Integers[0] := 10; //Loads to do
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;

{
With players[1] do
begin
Name := ''; //character name
Pass := ''; //character pass
Nick := ''; //3 consecutive non capital letters of username
Active := True; //Use this player?
Pin := '';//Bank pin. Leave blank if you don't have one.
Strings[0] := ''; //fish name here; valid arguments listed above
BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;} {uncomment and copy this ass neccesary to add more players}
end;


procedure Antiban(I: integer);
var
ABChance: integer;

begin
case I of
0: ABChance := 60;
1: ABChance := 300;
2: ABChance := 600;
end;
case Random(ABChance) of
0: RandomRClick;
1: HoverSkill('cooking', false);
2: PickUpMouse;
4: RandomMovement;
5: BoredHuman;
6: ExamineInv;
end;
GameTab(tab_Inv);
end;


procedure antirandom;
begin
FindNormalRandoms;
LampSkill := 'cooking';
end;


procedure logo;
begin
ClearDebug;
WriteLn('A script by...');
Wait(1000);
WriteLn('_________ _______ _______ _________ _______ _______ ');
Wait(10);
WriteLn('\__ __/( ___ )( )\__ __/|\ /|( ____ \( ____ \ ');
Wait(10);
WriteLn(' ) ( | ( ) || () () | ) ( | ) ( || ( \/| ( \/ ');
Wait(10);
WriteLn(' | | | | | || || || | | | | | | || (__ | (__ ');
Wait(10);
WriteLn(' | | | | | || |(_)| | | | | | | || __) | __) ');
Wait(10);
WriteLn(' | | | | | || | | | | | | | | || ( | ( ');
Wait(10);
WriteLn(' | | | (___) || ) ( | | | | (___) || ) | ) ');
Wait(10);
WriteLn(' )_( (_______)|/ \| )_( (_______)|/ |/ ');
Wait(1100);
WriteLn('presenting...');
Wait(1000);
WriteLn(' _______ _ _______ ');
Wait(10);
WriteLn('( ___ )| \ /\( ____ \ ');
Wait(10);
WriteLn('| ( ) || \ / /| ( \/ ');
Wait(10);
WriteLn('| (___) || (_/ / | | ');
Wait(10);
WriteLn('| ___ || _ ( | | ');
WriteLn('| ( ) || ( \ \ | | ');
Wait(10);
WriteLn('| ) ( || / \ \| (____/\ ');
Wait(10);
WriteLn('|/ \||_/ \/(_______/ ');
Wait(1000);
WriteLn('Al Kharid Cooker');
Wait(1100);
ClearDebug;
end;


procedure SetDTM;
begin
case Players[CurrentPlayer].Strings[0] of
'crayfish': FishDTM := DTMFromString('mWAAAAHicY2FgYJjCxMAwFYj7gHgRED8Hil0D4k9AfB+IM20VgCQTQ5SJDJhGBvxAzIiEYQAA3ioHeg==');
'chicken': FishDTM := DTMFromString('mbQAAAHicY2VgYJjKxMCwFIj7gbgDSvMyMjBwAbEIEPMDMSsQr546BaiaCQ2jAn4gZkTDcAAAqzoFIw==');
'shrimp': FishDTM := DTMFromString('mWAAAAHicY2FgYJjPxMAwA4iXQLE6IwODChBrArEuEE/MCASqYkLCCMAPxIxIGAYAMwEEkw==');
'sardine': FishDTM := DTMFromString('mWAAAAHicY2FgYJjCxMDQD8QTgHg2EAczMjAEAXE4EPsAcermNKAqJiSMAPxAzIiEYQAAVvgFPQ==');
'beef': FishDTM := DTMFromString('mWAAAAHicY2FgYJjJxMCwCIg7gXgKEBczMjCkAXEpEDcDcZuMMFAVExJGAH4gZkTCMAAAU3kFBw==');
'anchovies': FishDTM := DTMFromString('mWAAAAHicY2FgYFjAxMAwE4iXAPEiIJ7CyMDQD8RTgXgWEGdl5wNVMSFhBOAHYkYkDAMAmnoGPg==');
'herring': FishDTM := DTMFromString('mbQAAAHicY2VgYJjKBMGdQDwNiBcA8QFGBoadQHwEiI8C8S4g3rByBVA1ExpGBfxAzIiG4QAAxVAI1g==');
'pike': FishDTM := DTMFromString('mbQAAAHicY2VgYNjPxMBwAIg3A/E+ID4NxM+A4neA+D0QvwPie0AcnxsPJJnQMCrgB2JGNAwHABf2CY4=');
'trout': FishDTM := DTMFromString('mbQAAAHicY2VgYDABYjMg1gRiUyB2BuIcIE4B4jIgLgHiNCBurK4GkkwMB3bsYFg4axZDR1MTAz9QBB0zomE4AACYawqK');
'salmon': FishDTM := DTMFromString('mbQAAAHicY2VgYNjHxMBwAIg3M0HYp4FYj5GBQQWIzYHYDIjVgLgjzAeomgkNowJ+IGZEw3AAAAQ+Bfk=');
'tuna': FishDTM := DTMFromString('mbQAAAHicY2VgYNjDxMBwAIg3A/FeID4NxMGMDAxuQBwFxDFA7AfE0ydMAKpmQsOogB+IGdEwHAAAXUoHOw==');
'lobster': FishDTM := DTMFromString('mWAAAAHicY2FgYDjExMBwFoj3A/EJIC5lZGBIB+ICIK4G4mRLeaAqJiSMAPxAzIiEYQAAi+QFwQ==');
'swordfish': FishDTM := DTMFromString('mWAAAAHicY2FgYNjPxMBwAIi3APFRIJ7KyMDQDcTzgbgfiFdVbAaqYkLCCMAPxIxIGAYA24EHRA==');
end;
end;


procedure SetBMP;
begin
case Players[CurrentPlayer].Strings[0] of
'crayfish': FishBMP := BitmapFromString(4, 4, 'meJzT8m1TsM2UNY2V0PPX9GlRtMuW' +
'NYsX1/ZWdasEikvqB4moOio7FgIFpQxCgOIAJC8Leg==');
'chicken': FishBMP := BitmapFromString(4, 4, 'meJzr7Vvc178EgiZNWQlEEyetAKKp' +
'09ZOmboagqbPWAdBQEEAvFMc+Q==');
'shrimp': FishBMP := BitmapFromString(4, 4, 'meJxr6Z7R2D61rmViTXN/ZX1PVWNf' +
'eV1Xfdtk3+SuwAyQYEv3DCA7KHNyZNH8jv65AFNuF+k=');
'sardine': FishBMP := BitmapFromString(4, 4, 'meJxzKHSImBU2ccXEaWun9i7uXbR7' +
'0dJ9S5PWJs7cMAPITtucmrkjHchYc2x1zr5sIBsAhSkbLw==');
'beef': FishBMP := BitmapFromString(4, 4, 'meJwTlmkThqEFC1cgs+FcZDYAhQIR' +
'VQ==');
'anchovies': FishBMP := BitmapFromString(4, 4, 'meJwrTkkpT08vTUstTknJjI7OjY/P' +
'T0wAklHhYfHR0amJiUCunZkZkJ2enJyfnQUAy98SRA==');
'herring': FishBMP := BitmapFromString(4, 4, 'meJzr65s6YcJ0IJo0acbsOYuBaO7c' +
'JUC0fPm6FSs3QNDqNZvhCADOmx5z');
'pike': FishBMP := BitmapFromString(4, 4, 'meJzzi/ILSQyJSA2PzoyGkPG58UmF' +
'SYn5CSnFKenl6dnVWZmVmTm1OXn1eYXNhQC69xMm');
'trout': FishBMP := BitmapFromString(4, 4, 'meJybNGnGjBnz585dsnjJaiAKCgrb' +
'snXvxk27li9fB2EA0bZt+zZv3g1BAOHWH3Q=');
'salmon': FishBMP := BitmapFromString(4, 4, 'meJyzdEi1ccl2cC908iqFkC4+lW7+' +
'tc7e5UDSM6jZJ6wDQvpH9gXFTgYAhg8Q9g==');
'tuna': FishBMP := BitmapFromString(4, 4, 'meJwlwgEKABAMAMAX8HaNNY012pLy' +
'Scp1uXBKBFBfESeSF7GHGFo35qm6zM+Y+7+X6huT');
'lobster': FishBMP := BitmapFromString(4, 4, 'meJyTNYuXt0pVss/l5eWTs0hUsE5X' +
'cshXdS2Xt0xWsM1UdixUdasEskVUHUXVnYEkAA6BCvo=');
'swordfish': FishBMP := BitmapFromString(4, 4, 'meJzrimnuimnuiG4EovlZ0xfnzlqW' +
'P3dl4YK1xYu3Va3dW7f5UOP2zRWrtlau3lG9DsgFAHWsG1Y=');
end;
end;


procedure SetUT;
begin
Case [Players[CurrentPlayer].Strings[0]] of
'crayfish': UT := 'aw crayfish';
'chicken': UT := 'aw chicken';
'shrimp': UT := 'aw shrimp';
'sardine': UT := 'aw sardine';
'beef': UT := 'aw beef';
'anchovies': UT := 'aw anchovies';
'herring': UT := 'aw herring';
'pike': UT := 'aw pike';
'trout': UT := 'aw trout';
'salmon': UT := 'aw salmon';
'tuna': UT := 'aw tuna';
'lobster': UT := 'lobster';
'swordfish': UT := 'aw swordfish';
end;
end;


procedure SetFishXP(nameOfFish: String);
var
fishName: TStringArray;
fishExp: TIntegerArray;
i: integer;
begin
fishName := ['crayfish','chicken','shrimp','sardine','beef','anchovies','herring','pike','trout','salmon','tuna','lobster','swordfish'];
fishExp := [30, 30, 30, 40, 30, 30, 50, 80, 70, 90, 100, 120, 140];
for i := 0 to high(FishName) do
begin
if nameOfFish = fishName[i] then FishXP := fishExp[i];
end;
end;


function CountInvFish: integer;
var
NumFish: integer;
begin
SetDTM;
NumFish := CountItems('dtm',FishDTM,[]);
FreeDTM(FishDTM);
Result := NumFish;
WriteLn(IntToStr(NumFish));
end;


procedure setcamera;
begin
MakeCompass('n');
SetAngle(true);
end;


procedure prog;
var p: integer;
begin
p := 0;
repeat
with players[p] do
begin
SetFishXP(Players[CurrentPlayer].Strings[0]);
WriteLN('Player: ' + Players[currentplayer].name);
WriteLn('Fish Cooked: ' + IntToStr(C));
WriteLn('Loads Done: ' + IntTostr(LD));
WriteLn('Exp Gained: ' + IntToStr(C*FishXP));
p := p + 1;
end;
until p = pl;
end;


procedure OpenTheBank; //i luffs yew (over msn), slightly modified
begin
if(not (Loggedin)) then exit;
if LD = Players[currentplayer].Integers[0] then
begin
NextPlayer(Players[CurrentPlayer].Active);
Prog;
end else
begin
if BankScreen then exit;
setcamera;
if( not (OpenBankNPC)) then
if(not (OpenBankFast('akb'))) then
if(not (OpenBank('akb',false,false))) then
if(not (OpenBankGlass('akb',false,false))) then
begin
WriteLn('banking failed, logging out');
Logout;
end;
end;
Antiban(2);
end;


procedure WithdrawTheFood;
var
x,y,i,a: integer;
TP: TPointArray;
begin
if(not (Loggedin)) then exit;
if(not (BankScreen)) then OpenTheBank;
DepositAll;
FixBank;
FixBankTab;
Wait(100+random(25));
SetDTM;
if FindDTM(FishDTM, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
SetUT;
if (GetUpText <> UT) then
begin
WriteLn('No uptext match exiting');
exit;
end else
begin
WriteLn('found du fishy');
Mouse(x,y,5,5,false);
ChooseOption('draw-All');
end;
end else
begin
TP := FindItems(10526888, 6, UT, 28);
for i := 0 to high(TP)
begin
MMouse(TP[i].x, TP[i].y,4,4);
Mouse(x,y,0,0,false);
ChooseOption('All');
a := a + 1;
if CountInvFish > 0 then exit;
if a > 3 then logout;
end;
end;
CloseBank;
if CountInvFish = 0 then logout;
FreeDTM(FishDTM);
end;


function FindRangeFloor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 7440298, MMX1, MMY1, MMX2, MMY2, 0);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 28.20) and (X <= 28.24) and (Y >= 27.05) and (Y <= 27.09) and (Z >= 19.34) and (Z <= 19.38) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


procedure WalkToRange;
var x, y, CColor: integer;
begin
if not LoggedIn then Exit;
setcamera;
antirandom;
antiban(1);
CColor := FindRangeFloor;
if( not( RadialWalkTolerance(CColor, 4, 30, 55,1,1,10))) then
if( not( FindSymbol(x,y, 'cook'))) then
begin
WriteLn('both walking functions failed, logging out...');
logout;
end else Mouse(x,y,2,2,true);
Wait(1000+random(200));
end;


function FindBankFloor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 6786228, MMX1, MMY1, MMX2, MMY2, 0);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 30.63) and (X <= 30.67) and (Y >= 29.42) and (Y <= 29.46) and (Z >= 16.88) and (Z <= 16.92) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


procedure WalkToBank;
var x, y,CColor: integer;
begin
if not LoggedIn then Exit;
setcamera;
antirandom;
antiban(1);
CColor := FindBankFloor;
if( not( RadialWalkTolerance(CColor, 195, 205, 53,1,1,10))) then
if( not( FindSymbol(x,y, 'bank'))) then
begin
WriteLn('both walking functions failed, logging out...');
logout;
end else Mouse(x,y,2,2,true);
Wait(1000+random(200));
end;


function ClickFishInInv: boolean;
var
x,y,ObjX,ObjY: integer;
begin
antiban(0);
antirandom;
SetDTM;
if FindDTM(FishDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
WriteLn('found du fishy');
Mouse(x,y,5,5,true);
result := true;
end else
begin
FreeDTM(FishDTM);
SetBMP;
if( not( FindObjectDeformed(ObjX,ObjY,'ang','nge',FishBMP,MSX1,MSY1,MSX2,MSY1))) then
begin
FreeBitmap(FishBMP);
result := false;
Logout;
end else
begin
FreeBitmap(FishBMP);
MMouse(ObjX,ObjY,5,5);
Mouse(ObjX,ObjY,0,0,true);
result := true;
exit;
end;
end;
FreeDTM(FishDTM);
end;


function FindTheRange: Boolean; //credits: Coh3n's guide, slightly modified/parts taken out
var
ObjX, ObjY,x, y, i,RangeBMP: integer;
TPA: TPointArray;
ATPA : T2DPointArray;
begin
if not LoggedIn then Exit;
if( not (ClickFishInInv)) then
begin
result := false;
logout;
end else
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.85);
FindColorsSpiralTolerance(x,y,TPA,1648046,MSX1, MSY1, MSX2, MSY2,10);
ATPA := SplitTPAEX(TPA,5,5);
if(Length(ATPA) = 0) then
begin
RangeBMP := BitmapFromString(4, 4, 'meJyT1tgnjQ35JhUDUWB6JRBJqqwF' +
'IinVzUAEAIr2EGc=');
if( not( FindObjectDeformed(ObjX,ObjY,'ang','nge',RangeBMP,MSX1,MSY1,MSX2,MSY1))) then
begin
FreeBitmap(RangeBMP);
Result := false;
Logout;
end else
begin
FreeBitmap(RangeBMP);
if (GetUpText <> 'nge') then exit;
MMouse(ObjX,ObjY,5,5);
Mouse(ObjX,ObjY,0,0,true);
result := true;
end;
end;
end;
Wait(4000+Random(1000));
end;


procedure cook;
begin
if FindTheRange then
begin
Mouse(257,414,5,5,false);
ChooseOption('All');
C := C + CountInvFish;
inc(ld);
WriteLn('Completing load #' + IntToStr(LD));
end else logout;
end;


procedure CWait;
begin
WriteLn('Waiting for fish to cook...');
while CountInvFish > 0 do
begin
antirandom;
antiban(2);
wait(1000+random(100));
end;
end;


procedure MainLoop;
begin
Logo;
SetUpSRL;
DeclarePlayers;
LoginPlayer;
repeat
repeat
OpenTheBank;
WithdrawTheFood;
WalkToRange;
cook;
CWait;
WalkToBank;
until (not LoggedIn);
NextPlayer(Players[CurrentPlayer].Active);
until(AllPlayersInactive);
prog;
end;


begin
MainLoop;
end.

i most likely missed some stuff, if i did tell me

BraK

2010-09-17 02:38:37

When I mention combining the Setup procedures. I meant something a little different. So as a side project for you. I want you to look at Naum's Array tut here. I want to see you combine the procedure SetUT and Fishxp. Also think about looking at/using Tstringarray for finding uptext.

E: You might want to update the script on you first post to the newer version. So that others won't get confused about that being the up to date version.

@R1ch
I guess that would be better as you can see what was improved.

Rich

2010-09-17 04:29:27

I prefer it when you don't edit the script after we've told you what's wrong.

Sir R. M8gic1an

2010-09-17 04:34:59

From: Rich
I prefer it when you don't edit the script after we've told you what's wrong.


Shows commitment to his work.

Nice script btw, lots of interesting techniques.

Welcome to Jah People.

~RM