jollyjumbuck
2010-03-17 03:36:02
Hi
I'm having a lot of trouble getting my script to consistently find the bank chest in the lumbridge cellar. it seems the colors are too similar to the surrounds to get a consistent hit. I have used FindColorTolerance and FindColorSpiralTolerance but they consistently hit off target even with a tightly defined search area - due to the constant small movement of the RS screen.
I have tried finding an item nearby and using coordinates relative to that point - eg the cabbage and the painting - which have unique colors. This has had more success but eventually the script will still hit off target after about 10 minutes of operation.
Here is the relevant extract of the script.
program New;
{.include SRL\SRL.scar}
var
x,y,c,d:integer;
const
Painting=723982; //find the painting
a=-11;
b=-57;
begin
If(FindColorSpiralTolerance(x,y,Painting,690,400,750,450,300)) then
begin
Mouse(x+a,y+b,0,0,true);
Writeln('Found Painting');
GetMousePos(c,d);
end else
Writeln('No Painting Found')
end.
I guess questions are:
1) Why does the relative coordinate approach not work - surely if the whole screen is moving then my reference point is moving at exactly the same time and in the same direction so I should theoretically keep hitting the chest by referencing off that unique color….?
2) Is there any other relatively easy way to hit the chest? My experience does not yet extend to BitMap referencing but if that is the only way then I will learn it.
Thanks for any advice.
caused
2010-03-17 03:51:04
Hi. I didnt knew that there was a bank in the cellar of lumbi castle o_O.
Anyways. To make a flawless function to find such an object, you would need to first scan for points on the screen in a certain color with FindColorsTolerance(…), than you would need to morph those points to boxes with TPAtoATPA, than you would need a function that would remove boxes which are too small or too big, after that you would need to hover the center of every box till the uptext shows the bank(which should usually be the case for the first mouse move).
If you wan't I'll write such a function for you ;].
~caused
silor
2010-03-17 06:00:38
Use FindObjTPA and you can debug the boxes using caused's DebugATPABounds. :)
jollyjumbuck
2010-03-17 07:01:57
Wow - ok so I was right about one thing and that was it doesn't sound like an easy task!
And yes Caused - is a bank chest that is accessible after a player has started Recipe for Disaster quest.
Have not yet used those functions/procedures (..don't want to start a flame war for getting the wrong term! :) that you guys have suggested (other than the FindColorTolerance) so will do some more study but yes any help would be mega appreciated and am happy to do any leg work to get it moving.
Thanks again.
Mr. Doctor
2010-03-17 07:07:21
Why is there so much randomness in Mouse? It wouldn't even click the target by the looks of it. You could also try Auto coloring, and
[/scar[COLOR="White"].[/COLOR]] tags around your script.
silor
2010-03-17 07:14:52
Yeah use auto coloring (in your Includes\SRL\Scripting Tools folder), if the chest has any trims or something similar use those and then get the item bounds (coords are in auto coloring program down left) and use the item bounds (width/height) with FindObjTPA, there's some tutorials to auto coloring somewhere here on the forums. :)
jollyjumbuck
2010-03-18 07:12:40
There is no randomness in the Mouse function - random set at 0,0. The +a and +b was to set the mouse position relative to an easier find color but seems the problem is in finding any color so the other suggestions being made might have to be explored as the solution - they are complex though at my level!
jollyjumbuck
2010-03-18 09:37:11
Ok am really struggling with the ACAv2 AutoColor - have attempted to code the scripts as suggested but not finding colors and don't have the technical muscle to debug.
Have tried the BitMap finding approach below to find the chest but also no luck.
What seems strange is if the tolerance is set to >200 it returns the Bitmap as found but finds it at the first coordinate of the search field….which it obviously is not at - why would this be?
If the tolerance is set at <100 then it returns as Bitmap not found.
Can anyone help me find this chest!!?? Comments on the script below appreciated as to how to make it work.
program New;
{.include SRL\SRL.scar}
var
x,y:integer;
BankChest4:integer;
begin
BankChest4 := BitmapFromString(28, 71, 'beNrt2GlT49gVBuDGCz' +
'YYDNg0DXiXtetql2XJ+8pmFkND09NMTyeVmWTy//9AXknAGDNB6mT' +
'mQ6qiuqVymdLjc+5y7hXv3v2PXisraCvxWGw1mVxfS2XW0qvJBL75' +
'4/yVWGwluP6c+FceU4jHk4lEMpnAHbnEn67/xHyS19fS7/M7Bx92d' +
'7a2ctvb7/O5/fe7+3u73x3hwmeYe7u7tXKRoaoCTRGuroqsKjBvPP' +
'46vKBLn0cQZrlwIHGMTgRTFlxDbplK21K+w1yBGXv+OoizUji0FMk' +
'11aYuO4bsmh4b3Vz6Ep8z62vVUtExFIVnmrrkGGTQqE9dNtoo/84P' +
'PJu2JisCg84cN+koJh5MJOKYJ8j69Z+2NjfKyF2VXppMqBnHQlrox' +
'qU4iwf7BhE8k6+PmvTQrk/CzLd/Lp1O7e/taSIHU4Zp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rkFwR0M9aWqireJ84t2bmtRQRUcn' +
'qF1v/B9sKXeWKuNxnA3QsE6xBHSCkzOHD7hj9qLI4NCLD9i5opio9' +
'nhx0f3H/TcXhnA0Nim8jEj+B+L9P4QJvseu/e7/F65/AVTKs9A=');
if FindBitmapToleranceIn(BankChest4, x, y, 600, 380, 780, 500,150) then
begin
Writeln('x='+IntToStr(x));
Writeln('Found Bitmap');
end else
Writeln('Didnt Find it!');
end.
Bionicle
2010-03-18 11:53:56
From: jollyjumbuck
Ok am really struggling with the ACAv2 AutoColor - have attempted to code the scripts as suggested but not finding colors and don't have the technical muscle to debug.
Have tried the BitMap finding approach below to find the chest but also no luck.
What seems strange is if the tolerance is set to >200 it returns the Bitmap as found but finds it at the first coordinate of the search field….which it obviously is not at - why would this be?
If the tolerance is set at <100 then it returns as Bitmap not found.
Can anyone help me find this chest!!?? Comments on the script below appreciated as to how to make it work.
program New;
{.include SRL\SRL.scar}
var
x,y:integer;
BankChest4:integer;
begin
BankChest4 := BitmapFromString(28, 71, '…big-ass bitmap…');
if FindBitmapToleranceIn(BankChest4, x, y, 600, 380, 780, 500,150) then
begin
Writeln('x='+IntToStr(x));
Writeln('Found Bitmap');
end else
Writeln('Didnt Find it!');
end.
Bitmaps on objects on the main screen don't work that well. bitmaps should be used on pictures, not 3d objects that can change view very easily. If you can, try using TPAs to find your chest :)
tarajunky
2010-03-18 15:10:52
Try SmartColors. That will begin with a range, and automatically select and refine the unique colors that best identify the object. If there's any true difference between the chest and its surroundings, it will eventually find the best possible colors to use as the script runs.
http://villavu.com/forum/showthread.php?t=52915
jollyjumbuck
2010-03-19 20:32:43
Ok thank you for that - picked up from the tutorials that DTM's would not have sufficient detail for a main screen object but didn't pick up that might be the case with Bitmaps as well. So will try the new suggestions and report back.
jollyjumbuck
2010-03-21 07:25:29
From: tarajunky
Try SmartColors. That will begin with a range, and automatically select and refine the unique colors that best identify the object. If there's any true difference between the chest and its surroundings, it will eventually find the best possible colors to use as the script runs.
http://villavu.com/forum/showthread.php?t=52915
Ok starting with something simple as a uniquely colored painting in the same room as the lumby bank chest I have the following SmartColors script:
begin
ClearDebug;
MakeObj('Painting', 10984529, 20, 0.055, 0.84, ['Pai', 'tin', 'aint', 'ing'], ['xamin']);
SmartColors('Painting');
end.
this returns:
SC Array: 0
first finder
Successfully executed
but I don't seem to have found anything. My understanding of the tut there is that SmartColor will click on the object - is that right? If so have I not defined enough parameters in the script?
jollyjumbuck
2010-03-22 06:59:06
Ok was able to get a solution thanks to the helpful suggestions on this forum.
Was able to work through a TPA solution with the help of a couple of the tutorials. I used a unique color of a nearby picture and set that as a relative reference point to find my bank chest.
I really would like to be able to use the SmartColors as it sounds like a perfect solution to a number of tricker color find problems, however, I just wasnt able to get it to function properly….not for a minute suggesting there is anything wrong with the scripts… purely just was not able to figure out what I needed to do to get it to work based on my early-stage scripting skills (or lack thereof!). I guess as more comment and material becomes available it will become easier for keen to learn scripters such as myself to include this with their scripts as well.
Thanks again though for all the good help.
jollyjumbuck
2010-03-22 07:10:48
Also, just as a reference point for possible future newbie scripters (as I was/am), I came across two tutorials on TPA's on the forums here. One which started at a much more basic level:
http://villavu.com/forum/showthread.php?t=32182and although I found this next one first, it was a bit tougher to understand from the basic level but I found it very helpful to go back to once I kind of got more of the concept from the first tutorial.
http://villavu.com/forum/showthread.php?t=21786Cheers.