SRL Archive - Research & Development Lounge

Chinchompas Public Testing


Iraqnid

2008-06-01 17:50:09

I've started work on a red chinchompa script.

I'd just like to get a little feedback before I start: Is this a good idea due to the large amount of people and random events at the red chinchompa grounds?

What i've done so far: (mostly editions to parts of Hy71194's fight cave runner)


program ChinChompaz; //By Iraqnid. Early days.
//{.include SRL/SRL/Misc/Smart.scar}
{.include srl/srl.scar}
Var i,x,y,k,ChinAmount,chin,closedup,closeddown,closed2,closed3,boxfellup,boxfelldown,StartTime,HuntLvlPre,
fallen,ChinAmountPre,failed :integer;

(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| DeclarePlayer - Declares your username, etc. ||
|| ||
\\_________________________________________________________________*)
procedure DeclarePlayer;
begin
HowManyPlayers := 1; //Amount of Characters using
NumberOfPlayers(HowManyPlayers); //Don't touch
CurrentPlayer := 0; //Player to start with (eg. Players[0] = 0)

Players[0].Name := '/'; //Username
Players[0].Pass := '/'; //Password
Players[0].Nick := '/'; //3-4 small letters of the username
Players[0].Active := True; //Using Character? True = yes; False = no
(*Players[0].Booleans[0] := True; //True=High Alch; False=Low Alch
Players[0].Booleans[1] := True; //True=Fire Staff; False=Fire Runes
Players[0].Integers[0] := 17; //Slot number of item to alch
Players[0].Integers[1] := 200; //Amount to Alch*)
end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| LoadDTMs - Loads all the DTMs || // ownt. exit; radial linearwalk bitmapfromstring dtmfromstring dtmrotated finddtm tform fflag( players nextplayer( if(not loggedin)then freedtm freebitmap freeform tdtmpointdef tpa walkpath( tpointarray reportvars record tpoint label goto for while repeat case players
|| By: Iraqnid ||
\\_________________________________________________________________*)
Procedure LoadDTMs;
begin

closedup := DTMFromString('78DA636462646038CE00064C108A21372D958' +
'10B483342F98C20D61154351DF575A86AFE018943A86AE27CB531' +
'CD398DAA26D8450DAEE63F100000B8F40CA0');

closeddown := DTMFromString('78DA63FCC1C0C0F085010C982014435156260' +
'317906684F2197F02890FA86A52626351D57C06128F216C56A8D8' +
'8C9E0A54356F80C443547372220C51D5BCC5B4AB2CC10C55CD272' +
'0F103554D669801AA9A6F4082931145CD94E614B89AFF40000076' +
'79190B');

closed2 := DTMFromString('78DA634C63646058C900064C108AA1A6B8988' +
'10B48036518FE03016312420D23544D6A901E032B129F3115C8DA' +
'8CAA664A5332AA9A4C206B1DAA9AEEAA581435008E6A0D92');

closed3 := DTMFromString('78DA63B466646058C80006CC108A212D3E8E8' +
'10B48036518FE0301A33990351722C7045593E0A7035703028C96' +
'40D632543521AEEA286A007A9F0977');

boxfellup := DTMFromString('78DA6314666460B8CF00068C108A61627B3B0' +
'32B94FF1F08186581AC07A86A72220CE16AC0E25A087398A062FD' +
'7509286A00C7ED0B12');

boxfelldown := DTMFromString('78DA6314646460B8C600064C108A2133CC808' +
'10B48036518FE0301232F90751B554D65B2395C0D08307E0712D7' +
'51D54C6A6F4755F38981B039B240D60354358BFA7251D5280359B' +
'750D5CCEDCE425563C088E19E55D38A50D4000066E71665');

end;



(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| FindInvChins - Locates and if necessary moves chins ||
|| edited from DrunkPotions by: Hy71194 ||
|| by: Iraqnid ||
\\_________________________________________________________________*)
Procedure FindInvChins;
begin
MMouseItem(1)
if not IsUptext('Red') then
begin
for i := 2 to 28 do
begin
if ExistsItem(i) then
begin
MMouseItem(i);
Wait(10+Random(300));
if IsUptext('Red') then
begin
GetMousePos(x,y);
MouseSpeed := 9 + random(2) - random(2);
HoldMouse(x,y,True);
MMouseItem(1);
GetMousePos(x,y);
ReleaseMouse(x,y,True);
WriteLn('Keep Chins in slot 1 please :)');
wait(100 +random(100));
exit;
end;
end;
end;
Writeln('There are no chins in your Invent');
end;
end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| CountChins - Counts how many Chins you have in your inv ||
|| By: munk,Hy71194, Edit by Iraqnid ||
|| Thanks to Drizzt :) ||
\\_________________________________________________________________*)
Procedure CountChins;
var
i,x,y: integer;
count: string;
begin

chin := DTMFromString('78DA63CC656260D8C1C80002109281C1469E9' +
'D4112CAFF0F048C25986A402C2E243E631950CD1E026A2A816A0E' +
'125003B2EB0801353940352708A8C902AA394C404D3A11EE4906A' +
'A3940849ABDF8D500001E9310D8');
for i := 1 to 4 do
begin
if not FindDtm(chin,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
try
FreeDtm(chin);
except
Break;
end;
Break;
end;
if FindDtm(chin,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
//writeln(inttostr(x) + ' ' + inttostr(y)); // Debugging use.
count := GetTextAtEx(x-16, y-12, 0, statchars, False, False, 0, 1, 65535, 5, true, tr_AlphaNumericChars);
count := Trim(TrimOthers(count));
if not(count='') then
begin
ChinAmount := StrToInt(count);
try
FreeDtm(chin);
except
Break;
end;
Break;
end else
begin
WriteLn('Error Counting Chompa Amount - Exiting.');
try
FreeDtm(chin);
except
Break;
end;
Break;
end;
end;
FTWait(1);
end;
end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| LayTraps - Lays all your Traps || // ownt. exit; radial linearwalk bitmapfromstring dtmfromstring dtmrotated finddtm tform fflag( players nextplayer( if(not loggedin)then freedtm freebitmap freeform tdtmpointdef tpa walkpath( tpointarray reportvars record tpoint label goto for while repeat case players
|| By: Iraqnid ||
\\_________________________________________________________________*)
Procedure LayTraps;
begin
MakeCompass('N');
SetAngle(true);
for i := 2 to 28 do
begin
if ExistsItem(i) then
begin
MMouseItem(i);
Wait(10+Random(100));
if IsUptext('Lay') then
k := k + 1;
case random(6) of
0,1,2,3,4: begin
GetMousePos(x,y);
Mouse(x,y,4,4,true);
end;

5: begin
GetMousePos(x,y);
Mouse(x,y,4,4,false);
wait(80+random(100));
Mouse(x-random(30),y+22+random(9),0,0,True);
end;
end;
end;

if FindBlackChatMessage('here.') then
begin
findcolortolerance(x,y,5274538,231,144,301,225,20);
MakeCompass('N');
SetAngle(true);
Mouse(x - 20 - random(10),y + 40 + random(20),0,0,true);
end;

if k = 5 then
exit;

if IsChatBlackTextAnyLine('raps') then
exit;

wait(4000 + random(200) - random(200));
end;
end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| FindHighClosed - Locates finds chins from a high angle ||
|| by: Iraqnid ||
\\_________________________________________________________________*)
function FindHighClosed: boolean;
begin
MakeCompass('N');
SetAngle(true);
if not FindDtm(closedup,x,y,MSX1, MSY1, MSX2, MSY2) then
begin
Result := false;
exit;
end;
if FindDtm(closedup,x,y,MSX1, MSY1, MSX2, MSY2) then
begin
Result := true;
exit;
end;
end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| FindLowClosed - Locates finds chins from a low angle ||
|| by: Iraqnid ||
\\_________________________________________________________________*)
function FindLowClosed: boolean;
begin
MakeCompass('N');
SetAngle(false);
if not FindDtm(closeddown,x,y,MSX1, MSY1, MSX2, MSY2) then
begin
Result := false;
exit;
end;
if FindDtm(closeddown,x,y,MSX1, MSY1, MSX2, MSY2) then
begin
Result := true;
exit;
end;
end;

(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| Collapsed - searches for collapse message in chatbox ||
|| by: Iraqnid ||
\\_________________________________________________________________*)
function Collapsed: boolean;
begin
if not IsChatBlackTextAnyLine('ollaps') then
begin
Result := false;
exit;
end;
if IsChatBlackTextAnyLine('ollaps') then
begin
Result := true;
exit;
end;
end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| FindHighBoxFell - finds collapsed boxes on the floor ||
|| by: Iraqnid ||
\\_________________________________________________________________*)
function FindHighBoxFell: boolean;
begin
MakeCompass('N');
SetAngle(true);
if not FindDtm(boxfellup,x,y,MSX1, MSY1, MSX2, MSY2) then
begin
result := false;
exit;
end;
if FindDtm(boxfellup,x,y,MSX1, MSY1, MSX2, MSY2) then
begin
result := true;
exit;
end;
end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| FindLowBoxFell - finds collapsed boxes on the floor ||
|| by: Iraqnid ||
\\_________________________________________________________________*)
function FindLowBoxFell: boolean;
begin
MakeCompass('N');
SetAngle(false);
if not FindDtm(boxfelldown,x,y,MSX1, MSY1, MSX2, MSY2) then
begin
result := false;
exit;
end;
if FindDtm(boxfelldown,x,y,MSX1, MSY1, MSX2, MSY2) then
begin
result := true;
exit;
end;
end;



(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| CheckTraps - Checks the trap status || // ownt. exit; radial linearwalk bitmapfromstring dtmfromstring dtmrotated finddtm tform fflag( players nextplayer( if(not loggedin)then freedtm freebitmap freeform tdtmpointdef tpa walkpath( tpointarray reportvars record tpoint label goto for while repeat case players
|| By: Iraqnid ||
\\_________________________________________________________________*)
procedure CheckTraps;
begin
if not Collapsed then
begin
if not FindHighClosed then
begin
if FindLowClosed then
begin
writeln('Found closed box while in low mode');
MMouse(x,y,5,5);
if IsUpText('heck') or IsUpText('ismantle') then
begin
writeln('confirmed closed box')
end;
end;
end;
if FindHighClosed then
begin
writeln('Found closed box while in high mode');
MMouse(x,y,5,5);
if IsUpText('heck') or IsUpText('ismantle') then
begin
writeln('confirmed closed box')
end;
end;
end;
if Collapsed then
begin
if not FindHighBoxFell then
begin
if FindLowBoxFell then
begin
writeln('Found fallen box while in low mode');
end;
end;
if FindHighBoxFell then
begin
writeln('Found fallen box while in high mode');
end;
end;
end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| Randoms - Deals with the randoms || // ownt. exit; radial linearwalk bitmapfromstring dtmfromstring dtmrotated finddtm tform fflag( players nextplayer( if(not loggedin)then freedtm freebitmap freeform tdtmpointdef tpa walkpath( tpointarray reportvars record tpoint label goto for while repeat case players
|| By: Iraqnid ||
\\_________________________________________________________________*)
(*Procedure Randomness;
begin
FindNormalRandoms;
FindInventoryRandoms
FindNonInventoryRandoms

case random(2) of
0: FTWait(4);
1: FTWait(2);

end;*)


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| SetMeUp - Sets up the script || // ownt. exit; radial linearwalk bitmapfromstring dtmfromstring dtmrotated finddtm tform fflag( players nextplayer( if(not loggedin)then freedtm freebitmap freeform tdtmpointdef tpa walkpath( tpointarray reportvars record tpoint label goto for while repeat case players
|| By: Iraqnid ||
\\_________________________________________________________________*)
Procedure SetMeUp;
begin
(*SmartSetup('world66', False, True);
WriteLn('Setting up Smart... Please Hold...');
Wait(5000 + random(5000));
SetTargetDC(SmartGetDC);
While not(SmartReady) do Wait(100);*)

SetupSRL;
LoadDTMs;
k := 0;
fallen := 0;
failed := 0;
StartTime := Getsystemtime;
MouseSpeed := 14;
//DeclarePlayer;
//LoginPlayer;
activateclient;
wait(100 + random(400));
//SetRun(true);
//GetAllLevels;
//HuntLvlPre := GetSkillInfo('Hunter',False);

end;


(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| Proggy - Displays Info To The Debug Window ||
|| By: Hy71194 + PerHour is based off work by Tarajunky ||
\\_________________________________________________________________*)

Procedure Proggy;
Var Secon,Ratee,HuntLvlPost:Integer;
begin
//CountChins;
Secon := (1+((Getsystemtime-StartTime)/1000));
Ratee := (3600*(ChinAmount - ChinAmountPre))/(Secon);
HuntLvlPost := GetSkillInfo('Hunter',False);
WriteLn('');
WriteLn('It was '+(TheTime)+' on '+(TheDate(1))+' when this proggy was written:');
WriteLn('');
WriteLn('/-----------[ChinChompa catcher! By Iraqnid]----------\');
WriteLn('|-------------------[Version 1.00]--------------------|');
WriteLn(Padr('| -Chin # In Inv : '+IntToStr(ChinAmount)+'!',54)+'|');
WriteLn(Padr('| -(~)Chins / Hour : '+IntToStr(Ratee)+'!',54)+'|');
WriteLn(Padr('| -Chins gained : '+IntToStr(ChinAmount - ChinAmountPre)+'!',54)+'|');
WriteLn(Padr('| -Hunter Level before : '+IntToStr(HuntLvlPre)+'!',54)+'|');
WriteLn(Padr('| -Hunter Level after : '+IntToStr(HuntLvlPost)+'!',54)+'|');
WriteLn(Padr('| -Hunter Levels gained : '+IntToStr(HuntLvlPost - HuntLvlPost)+'!',54)+'|');
WriteLn('| ~~~~ Thanks for using! ~~~~ |');
WriteLn('| Please post up your proggies! |');
WriteLn('\_____________________________________________________/');
WriteLn('');
end;

Procedure MainLoop;
Begin
//FindChins;
//CountChins;
//LayTraps;
k := 5
repeat
CheckTraps;
until isfkeydown(9);
Proggy;
end;

begin
SetMeUp;
//FindChins;
//CountChins;
//ChinAmountPre := ChinAmount
Mainloop;
end.



*UPDATE*

Script can find chins in invent and count them.

The script can find closed traps most of the time: but I haven't started work on what it does when it finds them: just testing if it can find them.

Can I have some tips on where to go with this now?

Mark

2008-06-01 19:14:39

sorry to say m8 but a good start would be somet like this lol
program New;
{.include SRL/SRL.scar}

procedure LoadDTM;
begin
TrapDTM:= DTMFromString('78DA6314646060E06140013B9224182481342' +
'310FF07020021C70567');
end;
procedure SetTrap;
begin
GameTab(4);
if (FindDTM(TrapDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Mouse(x,y,5,5,true);
writeln('you set-up a trap!');
end else
writeln('You dont havea trap!');
exit;
end;
end.

you should start with setting up the trap first lol then finding if it caught anything:f:

Harry

2008-06-01 19:35:39

Lol, I see you like my script <3

WriteLn(Padr('| -(~)Enters / Hour : '+IntToStr(Ratee)+'!',54)+'|');

Hah, you enter somewhere to kill Chinchompas's?

And your / my count procedure would not work because of your DTM - my DTM is different, so the text is in a different spot = it will not work correct.

Dracody

2008-06-01 20:24:26

Is the username a real one? make sure not to keep it in there if it is, because you could lose your accounts as it happened to some other guys …:spongebob:

Harry

2008-06-01 20:50:03

Ouch. I changed your pass and have PMed it to you.

Don't make that mistake again about leaving your pass in a script!! :)

Hobbit

2008-06-01 20:56:37

Removed Username and Pass

Iraqnid

2008-06-01 21:31:22

It's kind of obvious that i'm a noob to this kind of thing :X.
cheers for the professionalism.

Also the count procedure does work: I have tested it extensively.

I simply had to make sure the parent of your DTM was the same parent as the DTM I created, and then everything was just fine and dandy.

Nava2

2008-06-02 21:57:31

I think you have this in the wrong forum haha, but anyways…

Failsafes.. make some more ;)

Nava2

Iraqnid

2008-06-03 08:18:37

Updated script and first post: comments appreciated.

turbobk

2008-06-06 06:21:17

You could change this:
(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| Collapsed - searches for collapse message in chatbox ||
|| by: Iraqnid ||
\\_________________________________________________________________*)
function Collapsed: boolean;
begin
if not IsChatBlackTextAnyLine('ollaps') then
begin
Result := false;
exit;
end;
if IsChatBlackTextAnyLine('ollaps') then
begin
Result := true;
exit;
end;
end;

TO THIS

(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| Collapsed - searches for collapse message in chatbox ||
|| by: Iraqnid ||
\\_________________________________________________________________*)
function Collapsed: boolean;
begin
Result := IsChatBlackTextAnyLine('ollaps');
end;


It will always return false unless it finds 'ollaps' in the chatbox, in which case it will return true. This is just one simple way how you could improve the coding and manke it more faster and efficient.

Good luck :)