PDA

View Full Version : Dragon Imp Catcher Pk Honor Need Help



Hellian
08-18-2014, 12:47 PM
Im trying to make a dragon imp catcher for PkHonor, I got it where it will right click imp with find color tolerance an click catch imp using bitmap, but it keeps clicking imps without waiting for it to finish catching the one that it alrady clicked on. Im not sure how to script it to wait after clicking an imp.

Also its not very accurate at clicking the imps can someone help me with that also. I really want to learn to script.

This is what I have so far


program DragonImp;
{$i srl/srl.simba}

var
X, Y:Integer;
Dragon:Integer;

Procedure ClickImps;
begin
if FindColorTolerance(X, Y, 2703496, 2, 3, 515, 341, 15) then
MMouse(X, Y, 1, 1);
wait(randomrange(150, 250));
ClickMouse(X, Y, mouse_Right);
wait(randomrange(150, 250));
if FindBitmapToleranceIn(Dragon, X, Y, 2, 3, 515, 314, 145) then
begin
Mmouse(x, y, 1, 1);
ClickMouse2(mouse_Left);
wait(randomrange(150, 250));
end;
end;

begin
MouseSpeed := 15;
SetupSRL;
Dragon := BitmapFromString(137, 17, 'meJztVlsOwyAM43ZcYL+7/zGYt' +
'IoMyIMEQlmronygDGxi07D4escnnnhiKFIevoDympASxHYFHM Oxok' +
'PGEIJGT6WDgNm35kt8J3egLi9fDiiYzGhutSa63rTt4W6N7/oxa+b' +
'L8RLWy5oZNEHDVAxrMtXDZA35BnEPkylfJgXFytbRbDGwAAJ0 JCMO' +
'Z03Z6LDmIQ+cKZPyE9a3pikqnwbOP5gXHzgah9rVZafR1DjKr wbW4' +
'PUkAnYWU3SsqV+99vbyu5TIXAul16OJIzs31381Y9YIFJrjcf dqUh' +
'yS5TRr9KeChkM2rq7OZ1qzToT/tCbWT0NjWdPQyjze3nWWEAEiU5O' +
'i4cWGPIXsZo2aRWDnqojFHwku2fwkZH50zFyPb1pMfGs9ZPlU zZyY' +
'FI4oWQR2roobxPlFrWC8jTVHIVe3Zm8Vy/Wpu/21rNlbxVqJqG5/J' +
'vWKKj4bDS5s');

repeat
ClickImps;
until(false)
FreeBitmap(Dragon);
end.

Spotify
08-18-2014, 05:38 PM
So currently what you have it doing is running through a constant loop and that's why it doesn't wait to catch the impling. Btw PkHonor has oldschool right clicking menus, so if you go to your settings in PkHonor and turn "Game Menus" to off, you can just use this. Idk what the actual text is in the right click menu but you can replace it;

ChooseOption('Catch');


So in order to wait till you're done trying to catch the imp, you can do a variety of things. The easiest and least efficient method would be to have a function that tells you if you get xp like this;

Function FindXp : Boolean;
var
x, y:Integer;
Begin
if FindColorTolerance(x, y, xpdropcolor, x1, y1, x2, y2, 5) then
Result := true;
End;

Grab the color of the number that drops down when you get xp, and change x1, y1, x2, y2 to a box around your xp counter. This function will just return true during the time the xp is visible sooooo you can change your script to this;


program DragonImp;
{$i srl/srl.simba}

var
X, Y:Integer;
Dragon:Integer;

Function FindXp : Boolean;
var
x, y:Integer;
Begin
if FindColorTolerance(x, y, xpdropcolor, x1, y1, x2, y2, 5) then
Result := true;
End;

Procedure ClickImps;
var
x, y, a, b:Integer; //It's better to declare your variables locally in the procedure rather than at the top(globally)
begin
if FindColorTolerance(X, Y, 2703496, 2, 3, 515, 341, 15) then
Mouse(x, y, 0, 0, false); //Changed to Mouse, this will move the mouse and click, false = right click, true = left click
wait(randomrange(150, 250));
if FindBitmapToleranceIn(Dragon, a, b, 2, 3, 515, 314, 145) then //It's best to keep your variables seperate so there are no mix ups.
begin
Mouse(a, b, 1, 1, true); //Again changed the mmouse and clickmouse combination to just Mouse.
WaitFunc(@FindXp, 50, 25000); //This will wait until findxp becomes true, it will check every 50ms, and quit after 25 seconds if it doesn't find it.
end;
end;

begin
MouseSpeed := 15;
SetupSRL;
Dragon := BitmapFromString(137, 17, 'meJztVlsOwyAM43ZcYL+7/zGYt' +
'IoMyIMEQlmronygDGxi07D4escnnnhiKFIevoDympASxHYFHM Oxok' +
'PGEIJGT6WDgNm35kt8J3egLi9fDiiYzGhutSa63rTt4W6N7/oxa+b' +
'L8RLWy5oZNEHDVAxrMtXDZA35BnEPkylfJgXFytbRbDGwAAJ0 JCMO' +
'Z03Z6LDmIQ+cKZPyE9a3pikqnwbOP5gXHzgah9rVZafR1DjKr wbW4' +
'PUkAnYWU3SsqV+99vbyu5TIXAul16OJIzs31381Y9YIFJrjcf dqUh' +
'yS5TRr9KeChkM2rq7OZ1qzToT/tCbWT0NjWdPQyjze3nWWEAEiU5O' +
'i4cWGPIXsZo2aRWDnqojFHwku2fwkZH50zFyPb1pMfGs9ZPlU zZyY' +
'FI4oWQR2roobxPlFrWC8jTVHIVe3Zm8Vy/Wpu/21rNlbxVqJqG5/J' +
'vWKKj4bDS5s');

repeat
ClickImps;
until(false)
FreeBitmap(Dragon);
end.

Hellian
08-18-2014, 06:49 PM
wow thanks, man you have been a big help and taught me stuff I didn't know.. This is just a work in progress, I want to make it bank an all for a finally product, but right now just trying to learn. Once, I get the catching down to where it works really good then ill try to add banking.

I was wondering if you could help me out on another script im writing its a herblore script making super prayer pots, I got it to withdraw and bank really good, but it will only make one pot then it will bank, how do I set it up so that it will make all 14 pots then bank..

Wow thanks, man the chooseoption is really nice, glad you told me about this. Any other little helpful things like that?

I got it running pretty nice now, but to get better imp finding, it misses the imp often an will sit and wait the 25 seconds before searching for a new one because of the wait function. Would it be better to use dtms to find the imps?

Here is the script now

program DragonImp;
{$i srl/srl.simba}

var
totalxp, xpperhour, madehour, impscaught: Integer;

Procedure Proggy;
Begin
ClearDebug;
totalxp := round((impscaught)*3120)
xpperhour := round((impscaught)/(gettimerunning/3600000.0))*(8000)
madehour := round((impscaught)/(gettimerunning/3600000.0));
writeln(' Time Running: '+ MsToTime(GetTimeRunning,3))
writeln(' Total Xp Gained: ' + inttostr(totalxp))
writeln(' Xp/hr: ' + inttostr(xpperhour))
writeln(' Imps Caught: ' + inttostr(impscaught))
writeln(' Imps Caught Per Hour: ' + inttostr(madehour))
End;

Function FindXp: Boolean;
var
X, Y: Integer;
begin
if FindColorTolerance(x, y, 3381759, 402, 75, 509, 128, 0) then
Result := True;
end;

Procedure ClickImps;
var
X, Y, A, B: Integer;
begin
if FindColorTolerance(X, Y, 2703496, 2, 3, 515, 341, 15) then
Mouse(X, Y, 1, 1, false);
wait(randomrange(150, 250));
ChooseOption('Catch');
WaitFunc(@FindXp, 50, 25000);
IncEx(impscaught, 1);
Proggy;
end;

begin
MouseSpeed := 15;
SetupSRL;
repeat
ClickImps;
until(false);
end.

Spotify
08-19-2014, 09:16 PM
Yeah the imps move around a lot... What you could do instead of Mouse is change it to

MoveMouse(x, y);
Wait(20);
ClickMouse(x, y, 1);


This will instantly move the mouse to where it found the imp and click, but in my opinion it looks sloppy and I only use it in special occasions, this being one of them.

But if you wanna get more advanced you can do this,

MoveMouse(x, y)
Wait(20);
if (IsUpText('rag')) then //After it moves the mouse, if it sees the text 'rag' from the word Dragon, it will click
ClickMouse(x, y, 1);

if (Not (IsUpText('rag'))) then //If the text isn't there, it will restart the procedure
ClickImps;

Hellian
08-19-2014, 11:11 PM
Yeah the imps move around a lot... What you could do instead of Mouse is change it to

MoveMouse(x, y);
Wait(20);
ClickMouse(x, y, 1);


This will instantly move the mouse to where it found the imp and click, but in my opinion it looks sloppy and I only use it in special occasions, this being one of them.

But if you wanna get more advanced you can do this,

MoveMouse(x, y)
Wait(20);
if (IsUpText('rag')) then //After it moves the mouse, if it sees the text 'rag' from the word Dragon, it will click
ClickMouse(x, y, 1);

if (Not (IsUpText('rag'))) then //If the text isn't there, it will restart the procedure
ClickImps;



Ok thanks will try this out in a little bit, im having trouble with the color on the imps, I can get a good color or dtm to use for them where it finds them good.

Spotify
08-20-2014, 04:35 AM
Ok thanks will try this out in a little bit, im having trouble with the color on the imps, I can get a good color or dtm to use for them where it finds them good.

Don't use DTM's or Bitmaps for moving objects lol, won't work.

Hellian
08-21-2014, 12:45 PM
Don't use DTM's or Bitmaps for moving objects lol, won't work.

Well got it to find the imps with findcolortolerance, but its not getting the uptext or something just hovers over the imp doens't click.


Alright I added more to script, right now it will catch a full invetory tele home open bank(not to trust worthy)
deposit the imps an withdraw more jars an close bank..

Im running into an error that the flowers at home are to close to the color I picked for my imps, I need to find a better way for it to distinguish imps from other objects. Here is what I have so far, any advice or tips would be greatly appreciated.

program DragonImp;
{$i srl/srl.simba}

var
kingly, jars, totalxp, xpperhour, madehour, impscaught: Integer;

Procedure Proggy;
Begin
ClearDebug;
totalxp := round((impscaught)*3120)
xpperhour := round((impscaught)/(gettimerunning/3600000.0))*(8000)
madehour := round((impscaught)/(gettimerunning/3600000.0));
writeln(' Time Running: '+ MsToTime(GetTimeRunning,3))
writeln(' Total Xp Gained: ' + inttostr(totalxp))
writeln(' Xp/hr: ' + inttostr(xpperhour))
writeln(' Imps Caught: ' + inttostr(impscaught))
writeln(' Imps Caught Per Hour: ' + inttostr(madehour))
End;

Function FindXp: Boolean;
var
X, Y: Integer;
begin
if FindColorTolerance(x, y, 3381759, 402, 75, 509, 128, 0) then
Result := True;
end;

Procedure ClickImps;
var
X, Y: Integer;
begin
if FindColorTolerance(X, Y, 1147552, 4, 2, 514, 338, 12) then
begin
MoveMouse(x, y);
Wait(200);
ClickMouse(x, y, 1);
WaitFunc(@FindXp, 50, 5000);
IncEx(impscaught, 1);
Proggy;
end;
end;

Procedure TeleHome;
var
X, Y: Integer;
begin
if FindDtm(Kingly, X, Y, 677, 430, 738, 463) then
begin
mouse(741, 186, 1, 1, true);
wait(250);
mouse(570, 238, 1, 1, true);
end;
end;

Procedure Bank;
var
X, Y: Integer;
begin
if FindColorTolerance(X, Y, 6982298, 4, 2, 514, 338, 4) then
begin
Mouse(X, Y, 1, 1, false);
wait(randomrange(150, 250));
ChooseOption('quickly');
end;
end;

Procedure Store;
var
X, Y: Integer;
begin
if FindColorTolerance(X, Y, 1193056, 373, 288, 420, 312, 11) then
begin
Mouse(X, Y, 1, 1, true);
wait(randomrange(150, 250));
end;
end;

Procedure WithdrawJars;
var
X, Y: Integer;
begin
if FindBitmapToleranceIn(Jars, X, Y, 34, 82, 75, 125, 145) then
begin
Mouse(X, Y, 1, 1, false);
wait(randomrange(150, 250));
ChooseOption('All');
end;
end;

Procedure ShutBank;
var
X, Y: Integer;
begin
if FindColorTolerance(X, Y, 1646114, 482, 22, 497, 36, 5) then
Mouse(X, Y, 1, 1, true);
end;



begin
MouseSpeed := 40;
SetupSRL;
Kingly := DTMFromString('mrAAAAHic42BgYDjMxMBwAIgPAfF+KD4GxE eh4kcZgXwg3g/Ee4F4FxAfgvJBtJm1GYOymgxDgbE2g3mYH4NtZTmDo7sLg0FSA oOQMB8DJ9AOfJiRAIYBAK35ElY=');

Jars := BitmapFromString(21, 21, 'meJx90ttP01AcB3D9FxRFLgGC4z' +
'bade16Pb2drhe2dmtXtgGK6ANykcsYAsYYbxgeADEBDSYmGEy EB9S' +
'IIZr44B/nD0Z4YIPkl5OT0+/n92tPSrCIYNHVK1cikW6SpFfXPq6s' +
'bL5e3nj+YrU8/wzq5av1jXefdj4fbG3tTkzMBcEARSUg39YWJ05sh' +
'ZMxhqb5BCttb3+FJBBoBfu9vcP9/V8HB793v/wQBNWw+yBTzaEnww' +
'g8jySkAYEwTPz2/c/Pw79HR//ef9hZfrM+OV220t61WzereX1LM8t' +
'KgqAgpI+NzxpJ2zSdtbXNcnnJtlPTM4/hZKq04Hj+9Yb6mryxvQ1G' +
'j4/PYGxBuFRaBLi2vlmaW4RWcALnrh9ewps7I7puQiyZdCp8/e3WX' +
'PmJZaUmlxaVnNeL+LrGhpqcVMSW7o7Wns6T0Qtgj8tJD48+jF BEOx' +
'mVA/cSTiC+pSsCPEJRXTRzO9YLJbp2ZdNORFGQvoTHNS0So6OsiDJ' +
'ulBMqpQTZXkEiRZm1jdZoV6/E1TXV4DFZ7qASnXG2m+GQ5xE8IkSZ' +
'FBUtF8BKSmqFR0W2JucMOy6aPYwY5SQ5myVFlZJ0PQhhpRCOK 4bq5' +
'2KSDtNvNDdV87ii99Aiq7lyJgt5yfRp2cC5PC2btGIyiqUGOU o2Lu' +
'LHcxOI4FXZy0AMOccQ5wqMYjOqjfuLtGrHZRPutmLPcSKhikY YE7B' +
'VuKOmBiCMw2JC62Oh9BTwhN6XUJ0zfmZPr47DlGjSsg0kVZjC 2RGc' +
'L7I4zeE0j71kfpAzPA67F/Gubo2RHVZJ8diFJG9k3JExKxzlkxnBz' +
'GYePOorTApJH37Lan76+VGD0zK84YtJPxydD+8/BSJagTlwV7LDdH' +
'EaWbmL+On90ylkhRAz8kOS0+8OziKn3x4cVtMF7OUF0au+t3M doML' +
'hklUc0tL5/pE5WN17I3ZuUNX8M17TVgqeQkbTfQllzqrS9vLR1a9x' +
'TlXb/0w0KBU=');
repeat
ClickImps;
TeleHome;
Bank;
Store;
WithdrawJars;
ShutBank;
until(false);
FreeDTM(Dragon);
FreeBitmap(Jars);
end.

Spotify
08-23-2014, 12:38 AM
So currently it looks like you're using a dtm to determine if the inventory is full or not. It also seems to be very inaccurate from what I've tested. An EXTREMELY simple way to determine if the inventory is full is this function;

if (InvCount = 28) then
Begin
Blahblahblah
End;


Also a really helpful function to find objects is FindObjCustom, it works like FindColorTolerance except it checks uptext as well as color.

if FindObjCustom(x, y, ['Text'], [Color], tolerance) then
Begin
BlahBlahblah;
End;

The best part about this function is it will check every object with the color, and if it matches the uptext, it will stop on the object.

hellian46
08-23-2014, 03:55 AM
Alright thanks alot will be updating it alot tomorrow an testing it out.

I really appreciate all the help...

edit: this is hellian, this is my old account I just got back lol.

hellian46
08-23-2014, 10:03 PM
Also I would like to point out that the inv will already be full since im using jars to catch imps so how will the inv full work?

Spotify
08-24-2014, 08:19 AM
Also I would like to point out that the inv will already be full since im using jars to catch imps so how will the inv full work?

Oh good point, I forgot about that.

Yeah just make a DTM of a full dragon impling jar and set the coordinates to the last inventory slot, so if it finds the dtm in that area, the function will return true.

hellian46
08-25-2014, 02:02 PM
Oh good point, I forgot about that.

Yeah just make a DTM of a full dragon impling jar and set the coordinates to the last inventory slot, so if it finds the dtm in that area, the function will return true.


Got that working, but the FindColorTolerance uptext doesn't work, it will find the color an hover over imp an just keep doing it, since its not getting the uptext.