SRL Archive - Test corner

BMP based DwarfItem;


Sumilion

2006-10-12 12:32:55

I recently made a thread in SRL Bugs about the dwarfitem also checking up on the emerald. It's no big deal, but i had a some time left so i decided to make one myself. The only problem is that The normal DwarfItem also searched for the Spinach role, but since i don't have one i can't make a BMP mask out of it. For that reason and the reason that i don't know if this procedure will also react on other items i posted it in the test corner.
( If you have a Spinach role, please make a screenie of it and send it to my e-mail, thnx )

{*******************************************************************************
procedure DwarfItem;
by: Sumilion
Description: Drops Items left by Dwarf
*******************************************************************************}

procedure DwarfItem;
Var
Ix, Iy, Kebab, ItemMark, Beer: Integer;
Begin
Kebab := BitmapFromString(8, 9, 'z78DA3330200DB88181011D752' +
'103DAD93BB02A89570F00CD145629');
Beer := BitmapFromString(8, 6, 'z78DA3330C00EDCC0C0800840BC' +
'4A4AD42303031201257A01BC683A21');
GameTab(4);
MarkTime(ItemMark);
While(FindBitmapMaskTolerance(Kebab, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0) or
FindBitmapMaskTolerance(Beer, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0)) Do
Begin
Mouse(Ix, Iy, 5, 5, false);
ChooseOption(x, y, 'rop');
Wait(500+Random(500));
If(TimeFromMark(ItemMark) > 20000) Then Break;
End;
End;

Wizzup?

2006-10-12 13:40:44

Added in dev version (means it will be in the next public SRL version).

Sumilion

2006-10-12 14:25:07

Jippie ! my first srl function XD, although you should have waited until i got the bmp of a spinach roll :(, i'll notify you when i have one…

Yakman

2006-10-12 15:10:50

sumilion and wizzup, how can you not notice its missing a FreeBitmap(kebab and beer)

also, if this function if we keep declaring and freeing the bitmaps, scar will crash, something about a memory leak, thats why we declare bitmaps and DTMs used in FindNormalRandoms globaly, they are in Globals.scar
things like BmpMod, BmpAdmin, BmpCloseWindow, DtmPlant and some others

Sumilion

2006-10-12 15:19:40

And once again your absolutely right, anyways, i bought a spinach roll (5k, what a rip off :p) and made the bmp. And as said by Yakman i placed it in globals with the rest of the bitmaps now. Here is the procedure itself
{*******************************************************************************
procedure DwarfItem;
by: Sumilion
Description: Drops Items left by Dwarf
*******************************************************************************}

procedure DwarfItem;
Var
Ix, Iy, ItemMark: Integer;
Begin
GameTab(4);
MarkTime(ItemMark);
While(FindBitmapMaskTolerance(DKebab, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0) or
FindBitmapMaskTolerance(Beer, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0) or
FindBitmapMaskTolerance(Spinach, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0)) Do
Begin
Mouse(Ix, Iy, 5, 5, false);
ChooseOption(x, y, 'rop');
Wait(500+Random(500));
If(TimeFromMark(ItemMark) > 20000) Then Break;
End;
End;
And the edited Globals.scar. It's just the normal globals only with these bitmaps in them. The reason i named the Kebab Dkebab is because Fakawi already made a var named Kebab.

Mr. Freeweed

2006-10-13 03:02:09

I just want to say that dwarf does not give spinach rolls anymore but it cant hurt any

Sumilion

2006-10-13 09:40:34

Not anymore ? Did it ever =S, however it wouldn't hurt since i don't think there is a procedure needed for that item anyway and it doesnt hurt being in the same procedure ;)

Cheesehunk

2006-10-13 15:55:11

I'm not sure why you capital bold letters in SCAR.. Try this:

{*******************************************************************************
procedure DwarfItem;
by: Sumilion
Description: Drops Items left by Dwarf
*******************************************************************************}

procedure DwarfItem;
var
Ix, Iy, ItemMark: Integer;
begin
GameTab(4);
MarkTime(ItemMark);
while(FindBitmapMaskTolerance(DKebab, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0) or
FindBitmapMaskTolerance(Beer, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0) or
FindBitmapMaskTolerance(Spinach, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0)) do
begin
Mouse(Ix, Iy, 5, 5, false);
Wait( 100 + Random ( 50 ));
ChooseOption(x, y, 'rop');
FTWait(3 + Random ( 2 ));
if ( TimeFromMark (ItemMark) > 20000) then Break;
end;
end;

Sumilion

2006-10-13 18:18:10

I always do that, it's a bad habit of mine, personally i think it looks better, but so far I don't think i've seen anyone liking it aswell :(

Cheesehunk

2006-10-13 18:40:41

Whoops, forgot one thing.. :p

procedure DwarfItem;
var
Ix, Iy, ItemMark: Integer;
begin
GameTab(4);
MarkTime(ItemMark);
while(FindBitmapMaskTolerance(DKebab, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0) or
FindBitmapMaskTolerance(Beer, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0) or
FindBitmapMaskTolerance(Spinach, Ix, Iy, MIX1, MIY1, MIX2, MIY2, 0, 0)) do
begin
Mouse(Ix, Iy, 5, 5, false);
Wait( 100 + Random ( 50 ));
if ChooseOption(x, y, 'rop') then
FTWait(3 + Random ( 2 ));
if ( TimeFromMark (ItemMark) > 20000) then Break;
end;
end;

weibs

2006-10-14 15:43:37

From: Sumilion
I always do that, it's a bad habit of mine, personally i think it looks better, but so far I don't think i've seen anyone liking it aswell :(


I do the same thing :). But yes, not very many people like that style. I think its because kaitnieks never capitalized bold letters…copy-cats :tongue:

Sumilion

2006-10-14 18:48:24

Yeah, at least we are original ^^