SRL Archive - Help

hello i decided to start playing rs again.. already ran into problems.


tom99

2012-01-02 20:24:45

so here is my problem this dont work

if(FindBitmapMaskTolerance(kylling,x,y,2,2,666,336,30,15)) then
mouse(x,y,1,1,true);
its suppose to I'm used to scar and don't get why it don't work.
btw this is the image im searching
please help if you can.

Edit:
Oh i forgot to show the error i get, here it is.

Error: Exception: Mask is invalid. Width/Height: (32,23). WhiteHi/BlackHi: (-1,735) at line 56
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, 3]

Brandon

2012-01-02 20:33:07

I have a question for u as this happened to me on my way to making a GetItemByID colour version..

That image is a PNG.. did you mask it already? Is that the original image without the mask? Did you flatten and greyscale it?

tom99

2012-01-02 20:36:15

i used bmp when i got the error and yes i did both flatten and greyscale it so not original image. this compile perfectly fine in scar and how i always used it with scar. but simba give this error :(

Brandon

2012-01-02 20:58:42

From: tom99
i used bmp when i got the error and yes i did both flatten and greyscale it so not original image. this compile perfectly fine in scar and how i always used it with scar. but simba give this error :(



Function MaskBitmap: Boolean;
var
meh, X, Y: Integer;
Bleh: TMask;

begin
meh := BitmapFromString(32, 23, 'meJx9ldtqIkEQhlETNbNZD3HXeN' +
'7V1YBHFhEvfC5fQQTxzjvxLUQchhAQ8b323/rpojIz5rto2mT8qrq' +
'qeiyX/3M8Hs/n8+l0Oju4D4LA9/3A4Quhjx/Cu6AbcBFehVwuVygU' +
'rFxRp13Jexw2BPa1Wq1arXLNC8yccm4Cg+/QWNb54dD8fxmeHHTaa' +
'oTKYuWqtRuYr9cr1j8OZO55XjqdfhBs8WNb8EVZ9CP88DSbzVarxe' +
'JkhJSAKKEQ2tCo0BYHXBxsaNmRccCfFFIO5o8zYg010Y7Q5TNsojY' +
'360CIpIN+/AXJfxdizSpn5blyQt4E5AYJ5I+OpIF9wTAzE6SkWs9x' +
'OBx2u10ofz0CpjRrYNo2RMrAZ5DDw2fg32w2ofojRLvdLhaLuGg4f' +
'jRKlMcIGmK1Wq3Xa/XzCMPhEP3NO3CdNYRNT0cLYJhtJnp90sJ+v9' +
'f+knq9/mLAQXAcfBEPR/OkhGXn802h0Whst1t8C9XQ/OnHLfthwBH' +
'0OBmDyslPw2KxwPROJhPIl8ul+vX6vBqYla0A5Nb87KgK0NrJwXzq' +
'20xvKB5Tf+Y+kGu1UR883Ov1ut1u6HIhhM4n/HgYIVDASqWSvY9ql' +
'd/CJcLtdmPlUYdvAqLMZjPun+KADf/Ciu5rd9C46XQa9SN/VgZ+fA' +
'WzgVtcENAgrN4dSqUSu4MxwIt9PB6PRiN9J6ic/qLA4rDyqA9Wzif' +
'P8mzgm5CPAcxMNHPrB5R3Oh3c4o6AxEqOvIG/dAAFn8/nobdNSE4/' +
'5eCvQX93WgLvTr/fHwwGfYHvz1h5yB/9BVw4bEQIE4nE11pr5v4fa' +
'NhLKw==');

Bleh:= CreateMaskFromBitmap(Meh);
FindMaskTolerance(Bleh, X, Y, MSX1, MSY1, MSX2, MSY2, 10, 10);

//FindBitmapMaskTolerance(dunno what to put here, X, Y, MSX1, MSY1, MSX2, MSY2, 10, 10);

FreeBitmap(Meh);
end;

tom99

2012-01-02 22:47:39

it give same error but atleast it compile. but why do you need to use Tmask ? can't you declare it as integer?
and what is it this does CreateMaskFromBitmap ? you dont need it in scar :confused:

Coh3n

2012-01-03 01:50:42

Post the code you're trying to run.

tom99

2012-01-03 13:20:47

here it is, i barely started :p oh and what function find randoms with srl?
when used reflection i did R_findrandom.
i know its bad to use kylling as a global var will change that later.
i give + rep to who ever can help me on this.

{$define SMART}
{$i srl/srl.scar}
var
x,y,kylling:integer;

procedure smart;
begin

{$IFDEF SMART}
SMART_Server := 10;
SMART_Members := False;
SMART_Signed := True;
SMART_SuperDetail := False;
{$ENDIF}

SetupSRL;
ActivateClient;
end;

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Pin := '';
LampSkill := 'Strength';
End;

procedure kyllingdreper;
begin
kylling := BitmapFromString(32, 23, 'meJx9ldtqIkEQhlETNbNZD3HXeN' +
'7V1YBHFhEvfC5fQQTxzjvxLUQchhAQ8b323/rpojIz5rto2mT8qrq' +
'qeiyX/3M8Hs/n8+l0Oju4D4LA9/3A4Quhjx/Cu6AbcBFehVwuVygU' +
'rFxRp13Jexw2BPa1Wq1arXLNC8yccm4Cg+/QWNb54dD8fxmeHHTaa' +
'oTKYuWqtRuYr9cr1j8OZO55XjqdfhBs8WNb8EVZ9CP88DSbzVarxe' +
'JkhJSAKKEQ2tCo0BYHXBxsaNmRccCfFFIO5o8zYg010Y7Q5TNsojY' +
'360CIpIN+/AXJfxdizSpn5blyQt4E5AYJ5I+OpIF9wTAzE6SkWs9x' +
'OBx2u10ofz0CpjRrYNo2RMrAZ5DDw2fg32w2ofojRLvdLhaLuGg4f' +
'jRKlMcIGmK1Wq3Xa/XzCMPhEP3NO3CdNYRNT0cLYJhtJnp90sJ+v9' +
'f+knq9/mLAQXAcfBEPR/OkhGXn802h0Whst1t8C9XQ/OnHLfthwBH' +
'0OBmDyslPw2KxwPROJhPIl8ul+vX6vBqYla0A5Nb87KgK0NrJwXzq' +
'20xvKB5Tf+Y+kGu1UR883Ov1ut1u6HIhhM4n/HgYIVDASqWSvY9ql' +
'd/CJcLtdmPlUYdvAqLMZjPun+KADf/Ciu5rd9C46XQa9SN/VgZ+fA' +
'WzgVtcENAgrN4dSqUSu4MxwIt9PB6PRiN9J6ic/qLA4rDyqA9Wzif' +
'P8mzgm5CPAcxMNHPrB5R3Oh3c4o6AxEqOvIG/dAAFn8/nobdNSE4/' +
'5eCvQX93WgLvTr/fHwwGfYHvz1h5yB/9BVw4bEQIE4nE11pr5v4fa' +
'NhLKw==');

repeat

if(FindBitmapMaskTolerance(kylling,x,y,2,2,666,336,30,15)) then
mouse(x,y,1,1,true);
wait(200+random(200));
until(false)
FreeBitmap(kylling);
end;

begin
smart;
kyllingdreper ;
end.

Brandon

2012-01-03 13:43:28

Hey tom can you try this and let me know if it works for you? Aka Programatically masking a bitmap.. Seems to work I guess :S As for your original question, The TMask creates a mask of a bitmap and it tells you stuff like BlackHi, WhiteHi, etc.. I guess thats how many black to white is in the bitmap.. Seems when your bitmap is masked programmatically like below, Simba does not complain for some reason because it's actually pure black vs white rather than a little grey :S Not sure but this definitely compiles.. It's untested as to whether it actually finds the masked bitmap but.. it's a start.. Unless someone knows the actual answer to the problem.

Anyway.. now to why does it make your bitmap black & white.. that's because yours is already greyscaled so when I mask it AGAIN.. it completely removes all colour.. you can always try it on the original and let me know if it complains.. then someone else would actually have to help answer this problem lol.


{$I SRL/SRL.Simba}

Function MaskBitmap: Boolean;
var
BMP, B, C, D, X, Y: Integer;

begin
BMP := BitmapFromString(32, 23, 'meJx9ldtqIkEQhlETNbNZD3HXeN' +
'7V1YBHFhEvfC5fQQTxzjvxLUQchhAQ8b323/rpojIz5rto2mT8qrq' +
'qeiyX/3M8Hs/n8+l0Oju4D4LA9/3A4Quhjx/Cu6AbcBFehVwuVygU' +
'rFxRp13Jexw2BPa1Wq1arXLNC8yccm4Cg+/QWNb54dD8fxmeHHTaa' +
'oTKYuWqtRuYr9cr1j8OZO55XjqdfhBs8WNb8EVZ9CP88DSbzVarxe' +
'JkhJSAKKEQ2tCo0BYHXBxsaNmRccCfFFIO5o8zYg010Y7Q5TNsojY' +
'360CIpIN+/AXJfxdizSpn5blyQt4E5AYJ5I+OpIF9wTAzE6SkWs9x' +
'OBx2u10ofz0CpjRrYNo2RMrAZ5DDw2fg32w2ofojRLvdLhaLuGg4f' +
'jRKlMcIGmK1Wq3Xa/XzCMPhEP3NO3CdNYRNT0cLYJhtJnp90sJ+v9' +
'f+knq9/mLAQXAcfBEPR/OkhGXn802h0Whst1t8C9XQ/OnHLfthwBH' +
'0OBmDyslPw2KxwPROJhPIl8ul+vX6vBqYla0A5Nb87KgK0NrJwXzq' +
'20xvKB5Tf+Y+kGu1UR883Ov1ut1u6HIhhM4n/HgYIVDASqWSvY9ql' +
'd/CJcLtdmPlUYdvAqLMZjPun+KADf/Ciu5rd9C46XQa9SN/VgZ+fA' +
'WzgVtcENAgrN4dSqUSu4MxwIt9PB6PRiN9J6ic/qLA4rDyqA9Wzif' +
'P8mzgm5CPAcxMNHPrB5R3Oh3c4o6AxEqOvIG/dAAFn8/nobdNSE4/' +
'5eCvQX93WgLvTr/fHwwGfYHvz1h5yB/9BVw4bEQIE4nE11pr5v4fa' +
'NhLKw==');

D:= DesaturateBitmap(BMP);
B:= BrightnessBitmap(D, 25); //In photoshop: 55%
C:= ContrastBitmap(B, 1.8); //In photoshop: 100%
//InvertBitmap(C); //In photoshop: Ctrl + I;

DisplayDebugImgWindow(32, 23); //Just some debugging stuff to show u what it looks like.
DrawBitmapDebugImg(C); //Just some debugging stuff to show u what it looks like.

FindBitmapMaskTolerance(C, X, Y, MSX1, MSY1, MSX2, MSY2, 10, 10);
FreeBitmap(C);
FreeBitmap(B);
FreeBitmap(D);
FreeBitmap(BMP);
end;

begin
MaskBitmap;
end.

tom99

2012-01-03 14:28:55

same error…


Error: Exception: Mask is invalid. Width/Height: (32,23). WhiteHi/BlackHi: (-1,735) at line 56
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, 3]

So changing grey to white didn't work.

Brandon

2012-01-03 14:32:00

From: tom99
same error…


Error: Exception: Mask is invalid. Width/Height: (32,23). WhiteHi/BlackHi: (-1,735) at line 56
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, 3]

So changing grey to white didn't work.



Is that for the original bitmap? Or is that for the script I posted itself? Because the script above, without modifications, it compiles :S

See:

tom99

2012-01-03 14:51:41

I tried to turn grey to white and compiles now hopefully it work to!