Blue90
2011-11-09 16:34:41
Wonder where its at, as I am reading the intermediate section of scripting*scar*version, and currently, I am unable to find bitmap loader to extract a color…
2011-11-09 16:34:41
2011-11-09 16:36:42
2011-11-09 18:10:33
2011-11-09 18:28:06
From: Shuttleu
i think he means like in scar, you can put in the bitmap string and it will show the bitmap, Simba is missing this and i have mentioned it before
~shut
2011-11-09 19:11:16
2011-11-09 19:14:07
From: Blue90
http://villavu.com/forum/showpost.php?p=618674&postcount=3
I ment how its used in the tut
2011-11-09 19:22:16
2011-11-09 19:23:15
From: Blue90
:P i should have done that before, sorry :(
2011-11-09 20:10:41
) to this script program ClickWillowLogs;
{.include SRL/SRL.scar}//Remember to include this in ALL of your scripts if you want to use functions from SRL.
function ClickLogs: Boolean;
var
Logs, x, y : Integer;{Declared locally this time because we are only using it in this function. :)
We also need to declare 'x, y' so that the coordinates of the bitmap can be stored in them}
begin
Logs := BitmapFromString(5, 5, 'beNpzkIzwVyAShfjIQUggCvCQ' +
'9XGRtjUXc7KWACJ3B0l3AM9zEjg=');
GameTab(tab_Inv);//GameTab stands for all the different tabs in the RS interface. "(tab_Inv)" clicks on the inventory tab. A full list of the gametabs can be found in Gametab.scar in your SRL folder.
if FindBitmapToleranceIn(Logs, x, y, MIX1, MIY1, MIX2, MIY2, 15) then//Remember that MI = Main Inventory.
begin
Writeln('Found Willow log bitmap!');
MMouse(x, y, 4, 4);//Moves the mouse to the bitmap. Remember MMouse from earlier?
if IsUpText('illow') then//Checks the uptext of the object. Uptext is the text in the upper left corner of the RS main screen.
begin
Wait(200 + Random(100));//You should always have a random wait after checking an uptext because the uptext doesn't appear at the millisecond you mouse over the object.
Mouse(x, y, 0, 0, True);//No randomness is needed because the mouse is already on the object.
Result := True;//Make the result true after it has clicked the logs.
end else
Writeln('Couldn''t find the correct uptext of the logs.');
end else
Writeln('Couldn''t find the log bitmap');
FreeBitmap(Logs);//You MUST include this line. This frees the bitmap, otherwise it will say loaded and make your script much slower.
end;
begin
ClearDebug;
SetupSRL;//Don't forget this line in ANY of your RS scripts!
ActivateClient;//This is needed so the script switches to the RS window. If you have a DeclarePlayers procedure, it is not needed, as it is already built in.
Wait(1000 + Random(500));//This is just in case of possible lag, that SCAR has time to switch to the RS client.
if ClickLogs then//The condition will be true if it clicks the log. See the connection between that and the actual function?
Writeln('We have clicked the Willow logs!')
else
Writeln('We have not clicked the Willow logs.');
end.
2011-11-09 20:32:00
Bmp := BitmapFromString(181, 157, 'a really long string');
Logs := BitmapFromString(5, 5, 'beNpzkIzwVyAShfjIQUggCvCQ' +
'9XGRtjUXc7KWACJ3B0l3AM9zEjg=');
2011-11-09 21:19:48
:= BitmapFromString(48, 41, 'meJzNmO1TE1cUxp3+IY46fugAOj' +
'E0I2USAyYWEAZsoShFXmISiAiVUUeEAVIoUF5SUQkJL4IEQgwIjRS' +
'GtlM/2LH/lz549Myde7Mv2fBB5pmdzeZyz2+fc87eu3n//sv6O114' +
'4czXRThCBd84RdlKL2tJGmlNhRdd50rKMBuOfEIkEg99CxW7K3SoC' +
'Ex/AEWRPrKkMSKPagvB4EiSotjdV9SP0sWswhjMRkdVWZ3RGo+LLP' +
'rIwOJXFFQaxveoL5FH9PBoKpfB/4rMhrG0DNHn4WxKw8zcmqHMIKm' +
'VY/JGsuqrEycgnQHfeqr0Z1BhLPOA5LSn+qTLa0hlyCO2njUeADi6' +
'+4pDDy4Ee22+7vMtIWtIojmGBazP451agMpGnjj7fzvXHMSVU6dse' +
'fFYhWGe8vE51+B06cNfi5r81rIm8VijotCXJ+bJnJJ74cIbPrvN5r' +
'DbRSTDYj4WfxCxqfFHVsO1a3U11VcrKiq8Xk9ZWa5ZYx7LxYOI7Td' +
'vsn663gik2uqrlVe8JQ6HZZ58/On034KCPp+/ra2lqemHutqaqipn' +
'aWlRQUFOPEjosfDc6ex8sRhficWg2emp8MDAJaeTigowhjwcmnjEh' +
'491pI6OntshKNDehpSVuy8ZwmQt72Ppd4TuDnWSwIOq9paX62cKMF' +
'o8RQ43bzNyFTUCpYx0q7X1RkMDmouKOdcJef3Kx5zbwUBXRxApA4+' +
'vteV6Q311ZaXb5SKLzNwpe0Xr+9EGI49+D/n9oUAAVAFfO4oH/nxf' +
'W/udx4MWy9Wis/aS7PVjAo9uChFT65up9WQqkVxaWFyIxmJz0cczv' +
'w8NDP18p0eqIrVs6ApdFPvLsjm7fxy+++//t2/e/rV/+Ho3s53aSi' +
'aSiZW1eDQWmYqMhEcki0Qe6Zx51A2hVn4lmOXl9Uzm8Eiv/97ZOUi' +
'nM6nUbmJ9a3V1E19NTj6+f/+RVqOJtvBFfg8yxFCREAgMICHhfGt7' +
'j3herL0Ez9T0bF/fIPGoVmStDeKxsAdDFARlGAiJA8/LdGZjY5t4Z' +
'mae9vcP9/Tc06lqiU16+8uJB9FFHmTt1at98CQ3dxKJNHgikbnBod' +
'He3oeGKSv+vGpovZBKCZJoMT8i7u39I4p40gLP7Ox8ODyOEsKT0mT' +
'jS+uFmDiGV93D5PBB5vlc0sTzfGXjydP46OgkSqir667JhV56LTWZ' +
'KbQP3FB5qISOSvojz7NnC2Nj01RCPl/QTBVZWE8xLRz4c/9fSUCSe' +
'KLR5YmJCJUQHuFmLLLmD/KSlQemccuDZz72HC0/PDxGJdTc3G74tp' +
'irP7xGqDwQlTQ/EuPxVbTYLyMT8Ke+vpF3RDqxxF8SzJCwRdTjVDk' +
'Ec3DwRuJZXFwbH58BTE1Nncm9ouiPIZKaNRQMrxfcYvRIXFpKAIYe' +
'hlowal7U549JYTAFIn0C+9hiaHmCEUmywqgO5Ll/5lgiG0uLRKsMm' +
'Id/iTLpjD6bKDW6uv8RJ7ScLzNSl2mdV2ZevwBDW3o60g6fJP46yh' +
'7SMP5FlEZKJ9IAsYvpIzYV4pwc4gMgk7N6');
2011-11-09 21:41:08
program new;
var
Bmp, w, h, x, y: Integer;
begin
Bmp := *your bitmap*;
GetBitmapSize(Bmp, w, h);
DisplayDebugImgWindow(w, h);
DrawBitmapDebugImg(Bmp);
GetClientDimensions(w, h);
if FindBitmapToleranceIn(Bmp, x, y, 0, 0, w, h, 30) then
MoveMouse(x, y);
FreeBitmap(Bmp);
end.
2011-11-09 21:42:11
2011-11-09 21:53:12
2011-11-09 21:55:04
2011-11-09 23:15:47
From: Blue90
oh it worked, its just the fact how do i test those on runescape?
2011-11-09 23:18:18
2011-11-09 23:32:37
2011-11-10 02:21:18
program ClickWillowLogs;
{.include SRL/SRL.scar}//Remember to include this in ALL of your scripts if you want to use functions from SRL.
function ClickLogs: Boolean;
var
Logs, x, y : Integer;{Declared locally this time because we are only using it in this function. :)
We also need to declare 'x, y' so that the coordinates of the bitmap can be stored in them}
begin
Logs := BitmapFromString(5, 5, 'beNpzkIzwVyAShfjIQUggCvCQ' +
'9XGRtjUXc7KWACJ3B0l3AM9zEjg=');
GameTab(tab_Inv);//GameTab stands for all the different tabs in the RS interface. "(tab_Inv)" clicks on the inventory tab. A full list of the gametabs can be found in Gametab.scar in your SRL folder.
if FindBitmapToleranceIn(Logs, x, y, MIX1, MIY1, MIX2, MIY2, 15) then//Remember that MI = Main Inventory.
begin
Writeln('Found Willow log bitmap!');
MMouse(x, y, 4, 4);//Moves the mouse to the bitmap. Remember MMouse from earlier?
if IsUpText('illow') then//Checks the uptext of the object. Uptext is the text in the upper left corner of the RS main screen.
begin
Wait(200 + Random(100));//You should always have a random wait after checking an uptext because the uptext doesn't appear at the millisecond you mouse over the object.
Mouse(x, y, 0, 0, True);//No randomness is needed because the mouse is already on the object.
Result := True;//Make the result true after it has clicked the logs.
end else
Writeln('Couldn''t find the correct uptext of the logs.');
end else
Writeln('Couldn''t find the log bitmap');
FreeBitmap(Logs);//You MUST include this line. This frees the bitmap, otherwise it will say loaded and make your script much slower.
end;
begin
ClearDebug;
SetupSRL;//Don't forget this line in ANY of your RS scripts!
ActivateClient;//This is needed so the script switches to the RS window. If you have a DeclarePlayers procedure, it is not needed, as it is already built in.
Wait(1000 + Random(500));//This is just in case of possible lag, that SCAR has time to switch to the RS client.
if ClickLogs then//The condition will be true if it clicks the log. See the connection between that and the actual function?
Writeln('We have clicked the Willow logs!')
else
Writeln('We have not clicked the Willow logs.');
end.. I replaced the bitmap with this code := BitmapFromString(48, 41, 'meJzNmO1TE1cUxp3+IY46fugAOj' +
'E0I2USAyYWEAZsoShFXmISiAiVUUeEAVIoUF5SUQkJL4IEQgwIjRS' +
'GtlM/2LH/lz549Myde7Mv2fBB5pmdzeZyz2+fc87eu3n//sv6O114' +
'4czXRThCBd84RdlKL2tJGmlNhRdd50rKMBuOfEIkEg99CxW7K3SoC' +
'Ex/AEWRPrKkMSKPagvB4EiSotjdV9SP0sWswhjMRkdVWZ3RGo+LLP' +
'rIwOJXFFQaxveoL5FH9PBoKpfB/4rMhrG0DNHn4WxKw8zcmqHMIKm' +
'VY/JGsuqrEycgnQHfeqr0Z1BhLPOA5LSn+qTLa0hlyCO2njUeADi6' +
'+4pDDy4Ee22+7vMtIWtIojmGBazP451agMpGnjj7fzvXHMSVU6dse' +
'fFYhWGe8vE51+B06cNfi5r81rIm8VijotCXJ+bJnJJ74cIbPrvN5r' +
'DbRSTDYj4WfxCxqfFHVsO1a3U11VcrKiq8Xk9ZWa5ZYx7LxYOI7Td' +
'vsn663gik2uqrlVe8JQ6HZZ58/On034KCPp+/ra2lqemHutqaqipn' +
'aWlRQUFOPEjosfDc6ex8sRhficWg2emp8MDAJaeTigowhjwcmnjEh' +
'491pI6OntshKNDehpSVuy8ZwmQt72Ppd4TuDnWSwIOq9paX62cKMF' +
'o8RQ43bzNyFTUCpYx0q7X1RkMDmouKOdcJef3Kx5zbwUBXRxApA4+' +
'vteV6Q311ZaXb5SKLzNwpe0Xr+9EGI49+D/n9oUAAVAFfO4oH/nxf' +
'W/udx4MWy9Wis/aS7PVjAo9uChFT65up9WQqkVxaWFyIxmJz0cczv' +
'w8NDP18p0eqIrVs6ApdFPvLsjm7fxy+++//t2/e/rV/+Ho3s53aSi' +
'aSiZW1eDQWmYqMhEcki0Qe6Zx51A2hVn4lmOXl9Uzm8Eiv/97ZOUi' +
'nM6nUbmJ9a3V1E19NTj6+f/+RVqOJtvBFfg8yxFCREAgMICHhfGt7' +
'j3herL0Ez9T0bF/fIPGoVmStDeKxsAdDFARlGAiJA8/LdGZjY5t4Z' +
'mae9vcP9/Tc06lqiU16+8uJB9FFHmTt1at98CQ3dxKJNHgikbnBod' +
'He3oeGKSv+vGpovZBKCZJoMT8i7u39I4p40gLP7Ox8ODyOEsKT0mT' +
'jS+uFmDiGV93D5PBB5vlc0sTzfGXjydP46OgkSqir667JhV56LTWZ' +
'KbQP3FB5qISOSvojz7NnC2Nj01RCPl/QTBVZWE8xLRz4c/9fSUCSe' +
'KLR5YmJCJUQHuFmLLLmD/KSlQemccuDZz72HC0/PDxGJdTc3G74tp' +
'irP7xGqDwQlTQ/EuPxVbTYLyMT8Ke+vpF3RDqxxF8SzJCwRdTjVDk' +
'Ec3DwRuJZXFwbH58BTE1Nncm9ouiPIZKaNRQMrxfcYvRIXFpKAIYe' +
'hlowal7U549JYTAFIn0C+9hiaHmCEUmywqgO5Ll/5lgiG0uLRKsMm' +
'Id/iTLpjD6bKDW6uv8RJ7ScLzNSl2mdV2ZevwBDW3o60g6fJP46yh' +
'7SMP5FlEZKJ9IAsYvpIzYV4pwc4gMgk7N6');. I will most likely do what rick said, I feel that he gave me a good direction to go towards on learning more about the code. Thanks Rick! :)
2011-11-10 05:50:43
2011-11-10 21:17:13
From: Rick
I would recommend making your bitmap smaller (there's a white strip along the top of the image; remove that) and possibly increasing the tolerance in 'FindBitmapToleranceIn'.
If that doesn't work, you could try to use DTM's.
Edit: And to answer your question, yes, you could include SMART. But for now I would just open the image in paint and try to recognise it there.
Try playing around with this:
program new;
var
Bmp, w, h, x, y: Integer;
begin
Bmp := *your bitmap*;
GetBitmapSize(Bmp, w, h);
DisplayDebugImgWindow(w, h);
DrawBitmapDebugImg(Bmp);
GetClientDimensions(w, h);
if FindBitmapToleranceIn(Bmp, x, y, 0, 0, w, h, 30) then
MoveMouse(x, y);
FreeBitmap(Bmp);
end.
2011-11-11 01:48:19