SRL Archive - SRL Archives

FindBone - prayer.scar


Awkwardsaw

2009-07-01 06:57:21


{*******************************************************************************
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
By: akwardsaw, and richard
Description: It Finds the DTM of a bone. valid names are: dragon, babydragon, big, bone, ourg, burnt
*******************************************************************************}
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
var
BoneDTM: integer;
begin
Case name of
'dragon' : BoneDTM := DTMFromString('78DA6394666060906140038C4824901605121C04D4B0010921026A9481842001353C44D805B2870755C5E5B36750D400009AAB0350');
'babydragon': BoneDTM := DTMFromString('78DA63B4626060D06640038C482490B601127A04D4B803097D22D4181350E302248C08A87100129604D49800090BFC6A00BA5F0330');
'big' : BoneDTM := DTMFromString('78DA63B4626060606740038C482490B626428D3D90E027A0C609480811506306244409A8710712DC44A82160170028DA0231');
'bone' : BoneDTM := DTMFromString('78DA634C656060E06540038C482490CE0412DC04D414030921026A528084040135B1404280809A7820C143404D3290E0C2AF0600D7750342');
'ourg' : BoneDTM := DTMFromString('78DA63E4616060D06140038C482490E603129A04D44801095D026A1481842101359240C28E801A5E206142400D2B116A04808411AA8AC63E5514350069420367');
'burnt' : BoneDTM := DTMFromString('78DA634C636060D06640038C4824908E05120604D4C4000923026A928084290135B940C28C809A1420614D404D26A67B22838350D4000056770533');
end;
Result := finddtm(BoneDTM, x, y, cx, cy, cx2, cy2);
If not(Result) then
writeln('Bones not found');
freedtm(BoneDTM);
end;

:D if you guys want, i'll make it so you have the option to bury, or just right click

Da 0wner

2009-07-01 07:01:02

Do if finddtm(bone, x, y, cx, cy, cx2, cy2) then and get rid of x := a; and y := b; so it sets then with finddtm.

Awkwardsaw

2009-07-01 07:10:04

oo ok. :P thanks. i forgot about that

osmm

2009-07-01 08:14:43

add monkey bones :)

Infantry001

2009-07-01 08:24:01

Is it just me, or does that name parameter not do anything?

osmm

2009-07-01 08:31:06

EDIT: If you need monkey bones DTM, I can get them to you tomorrow. I'll check back, if you don't have an update with them by tomorrow, I will post mine.

Awkwardsaw

2009-07-01 08:47:45

From: Infintry001
Is it just me, or does that name parameter not do anything?


im pretty sure it does, when i tested it with multiple bones(not in the same inventory) it worked

unless you find something different

edit: oh, i see what you mean. i forgot to change bone in the finddtm to name

and osmm, if you want any bones added give me the dtm, i'll be glad to add them in there. although it would be better if you test the function :p

Floor66

2009-07-01 09:36:28


{*******************************************************************************
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
By: akwardsaw
Description: It Finds the DTM of a bone. valid names are: dragon, babydragon, big, bone, ourg, burnt
*******************************************************************************}
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
var
dragon, babydragon, big, bone, ourg: integer;
begin
dragon := DTMFromString('78DA6394666060906140038C4824901605121' +
'C04D4B0010921026A9481842001353C44D805B2870755C5E5B367' +
'50D400009AAB0350');
babydragon := DTMFromString('78DA63B4626060D06640038C482490B601127' +
'A04D4B803097D22D4181350E302248C08A87100129604D4980009' +
'0BFC6A00BA5F0330');
big := DTMFromString('78DA63B4626060606740038C482490B626428' +
'D3D90E027A0C609480811506306244409A8710712DC44A8216017' +
'0028DA0231');
bone := DTMFromString('78DA634C656060E06540038C482490CE0412D' +
'C04D414030921026A528084040135B1404280809A7820C143404D' +
'3290E0C2AF0600D7750342');
ourg := DTMFromString('78DA63E4616060D06140038C482490E603129' +
'A04D44801095D026A1481842101359240C28E801A5E206142400D' +
'2B116A04808411AA8AC63E5514350069420367');
burnt := DTMFromString('78DA634C636060D06640038C4824908E05120' +
'604D4C4000923026A928084290135B940C28C809A1420614D404D' +
'26A67B22838350D4000056770533');

if finddtm(name, x, y, cx, cy, cx2, cy2) then
Result := true
else
writeln('Bones not found');
end;

Shortened your if-block.

Rich

2009-07-01 10:40:41

{*******************************************************************************
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
By: akwardsaw
Description: It Finds the DTM of a bone. valid names are: dragon, babydragon, big, bone, ourg, burnt
*******************************************************************************}
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
var
dragon, babydragon, big, bone, ourg: integer;

begin
case LowerCase(Name) of
'dragon' : Bone := DTMFromString('78DA6394666060906140038C4824901605121' +
'C04D4B0010921026A9481842001353C44D805B2870755C5E5B367' +
'50D400009AAB0350');
'babydragon' : Bone := DTMFromString('78DA63B4626060D06640038C482490B601127' +
'A04D4B803097D22D4181350E302248C08A87100129604D4980009' +
'0BFC6A00BA5F0330');
'big' : Bone:= DTMFromString('78DA63B4626060606740038C482490B626428' +
'D3D90E027A0C609480811506306244409A8710712DC44A8216017' +
'0028DA0231');
'normal' : Bone := DTMFromString('78DA634C656060E06540038C482490CE0412D' +
'C04D414030921026A528084040135B1404280809A7820C143404D' +
'3290E0C2AF0600D7750342');
'ourg' : Bone := DTMFromString('78DA63E4616060D06140038C482490E603129' +
'A04D44801095D026A1481842101359240C28E801A5E206142400D' +
'2B116A04808411AA8AC63E5514350069420367');
'burnt' : Bone := DTMFromString('78DA634C636060D06640038C4824908E05120' +
'604D4C4000923026A928084290135B940C28C809A1420614D404D' +
'26A67B22838350D4000056770533');
end;

if finddtm(bone, x, y, cx, cy, cx2, cy2) then
Result := true
else
writeln('Bones not found');
FreeDTM(bone);
end;

Naum

2009-07-01 10:54:23

No, don't do it that way.
Use the advantage of SRL Bitmaps, then you can load them and free them easily!
http://www.villavu.com/repositories/srl-opendev/SRL/core/Bitmaps.scar
However, you may need to add 3 more DTM's as that doesn't cover all of it..

Da 0wner

2009-07-01 11:57:51

You don't free the dtms either.

Awkwardsaw

2009-07-01 17:24:20

blargh. i need to stop scripting late at night >.> so far its all been stupid mistakes :P

and nauman, would srl bitmaps get rid of the backround in the inventory? since its not always the same, depending on where the bones is

osmm

2009-07-01 18:22:52


DTM := DTMFromString('78DA63F4626060B0654001F3E64D62F80FA41' +
'981F83F1030BA0219160C6880118904D29E40C28D801A7F20614E' +
'404D2890704055A1A2A288A2060022AD09EE');

Wolf Bone dtm^^ (with 255 tol)

Sabzi

2009-07-01 19:58:06

From: akwardsaw
and nauman, would srl bitmaps get rid of the backround in the inventory? since its not always the same, depending on where the bones is


I can answer this too. Well made bitmaps can be everywhere. Because scar when searching for a bitmap doesn't look for black color. So you can paint everything to black around the bitmap you are searching for. I hope I am right.

Da 0wner

2009-07-01 20:10:07

With tolerance it is fine.

Naum

2009-07-01 20:24:31

The bitmaps in SRL do not contain the background of the inventory, mainly because it would mess up majorly + it would be too long. You can use a DTM Mask, but that can also muck up when looking for one type ;)

Awkwardsaw

2009-07-01 21:20:33

mkay, i'll fix it later when im at the right comp

Richard

2009-07-01 22:11:00

Is it just me, or was his original function not backwards compatible? No StrToInt, you also might want to free the DTMs. Edited version:

{*******************************************************************************
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
By: akwardsaw
Description: It Finds the DTM of a bone. valid names are: dragon, babydragon, big, bone, ourg, burnt
*******************************************************************************}
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
var
dragon, babydragon, big, bone, ourg: integer;
begin
dragon := DTMFromString('78DA6394666060906140038C4824901605121' +
'C04D4B0010921026A9481842001353C44D805B2870755C5E5B367' +
'50D400009AAB0350');
babydragon := DTMFromString('78DA63B4626060D06640038C482490B601127' +
'A04D4B803097D22D4181350E302248C08A87100129604D4980009' +
'0BFC6A00BA5F0330');
big := DTMFromString('78DA63B4626060606740038C482490B626428' +
'D3D90E027A0C609480811506306244409A8710712DC44A8216017' +
'0028DA0231');
bone := DTMFromString('78DA634C656060E06540038C482490CE0412D' +
'C04D414030921026A528084040135B1404280809A7820C143404D' +
'3290E0C2AF0600D7750342');
ourg := DTMFromString('78DA63E4616060D06140038C482490E603129' +
'A04D44801095D026A1481842101359240C28E801A5E206142400D' +
'2B116A04808411AA8AC63E5514350069420367');
burnt := DTMFromString('78DA634C636060D06640038C4824908E05120' +
'604D4C4000923026A928084290135B940C28C809A1420614D404D' +
'26A67B22838350D4000056770533');

Result := finddtm(StrToInt(name), x, y, cx, cy, cx2, cy2);
If not(Result) then
writeln('Bones not found');
end;

Or if you wanted to do it as a case:

{*******************************************************************************
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
By: akwardsaw
Description: It Finds the DTM of a bone. valid names are: dragon, babydragon, big, bone, ourg, burnt
*******************************************************************************}
Function GetBone(var x, y: integer; name: string; cx, cy, cx2, cy2: integer):Boolean;
var
BoneDTM: integer;
begin
Case name of
'dragon' : BoneDTM := DTMFromString('78DA6394666060906140038C4824901605121C04D4B0010921026A9481842001353C44D805B2870755C5E5B36750D400009AAB0350');
'babydragon': BoneDTM := DTMFromString('78DA63B4626060D06640038C482490B601127A04D4B803097D22D4181350E302248C08A87100129604D49800090BFC6A00BA5F0330');
'big' : BoneDTM := DTMFromString('78DA63B4626060606740038C482490B626428D3D90E027A0C609480811506306244409A8710712DC44A82160170028DA0231');
'bone' : BoneDTM := DTMFromString('78DA634C656060E06540038C482490CE0412DC04D414030921026A528084040135B1404280809A7820C143404D3290E0C2AF0600D7750342');
'ourg' : BoneDTM := DTMFromString('78DA63E4616060D06140038C482490E603129A04D44801095D026A1481842101359240C28E801A5E206142400D2B116A04808411AA8AC63E5514350069420367');
'burnt' : BoneDTM := DTMFromString('78DA634C636060D06640038C4824908E05120604D4C4000923026A928084290135B940C28C809A1420614D404D26A67B22838350D4000056770533');
end;
Result := finddtm(BoneDTM, x, y, cx, cy, cx2, cy2);
If not(Result) then
writeln('Bones not found');
end;

Awkwardsaw

2009-07-01 22:36:10

the case looks awesomer :P

i didnt notice the strtoint part, yet it still worked when i tested last night

also, should i give it the option to click, right click, or do nothing to the bone?

ZephyrsFury

2009-07-05 16:23:33

Nice job with the function. I'd advise people to use the Bitmaps.scar functions when adding bitmaps/dtms of items instead of creating new ones. That way when things change we only need to update a few bitmaps in one place. If they don't work let me know and I'll try fix them.

Awkwardsaw

2009-07-05 19:17:15

i'll take a look at 'em.

updating this is first on my to-do list today ;)