SRL Archive - SRL Archives

Project:DTMS.scar


MylesMadness

2008-10-12 20:27:11

I'm working on a dtm database for srl. I more or less stole Nielsie95's bitmap data base a made it for DTMS:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป SRL DTM Routines --//
//-----------------------------------------------------------------//
// * function srl_GetDTM(ID: Integer): Integer; // * by the SRL community
// * procedure srl_LoadDTMS(IDs: TIntegerArray); // * by Mylesmadness
// * procedure srl_LoadDTMSRange(StartID, EndID: Integer); // * by Mylesmadness
// * procedure srl_FreeDTMS; // * by Mylesmadness


{var srl_DTMS: array[0..107] of Integer;
Description: Holds all the loaded SRL DTMS.}
var
srl_DTMS: array[0..32] of Integer;

{var srl_DTMSet: array[0..107] of Boolean;
Description: Array to specify if a certain DTM is loaded or not.}

var
srl_DTMSet: array[0..32] of Boolean;

const
Pick = 0;
Gem = 1;
Ore = 2;
SBook = 3;
BrokenPick = 4;
PickHandel = 5;
Clay = 6;
PickHead = 7;
Knife = 8;
Log = 9;
Axe = 10;
WillowLongbowU = 11;
WillowShortBowU = 12;
Cooked_Chicken = 13;
Cooked_Beef = 14;
Cooked_Shrimps = 15;
Bread = 16;
Cooked_Sardine = 17;
Cooked_Anchovies = 18;
Cooked_Herring = 19;
Cooked_RedberryPie = 20;
Cooked_Trout = 21;
Cooked_Pike = 22;
Cooked_MeatPie = 23;
Cooked_Salmon = 24;
Cooked_Tuna = 25;
Cooked_ApplePie = 26;
Cooked_Pizza = 27;
Fermented_Wine = 28;
Cooked_Lobster = 29;
Cooked_Cake = 30;
Cooked_Swordfish = 31;
Cooked_MeatPizza = 32;

{*******************************************************************************
function srl_GetDTM(ID: Integer): Integer;
By: the SRL community
Description: Returns the DTM identified by ID. Use like this:
FindDTM(srl_GetDTM(DTM_Ore_Iron), x, y, MSX1, MSY1, MSX2, MSY2)
*******************************************************************************}

function srl_GetDTM(ID: Integer): Integer;
begin
if (ID < 0) or (ID > High(srl_DTMS)) then
begin
srl_Warn('srl_GetDTM', 'Unknown DTM, id: '+IntToStr(ID), warn_AllVersions);
Exit;
end;
if srl_DTMSet[ID] then
begin
//WriteLn('Returning already loaded DTM: '+IntToStr(ID));
Result := srl_DTMS[ID];
Exit;
end;
case ID of
0 := DTMFromString('78DA63B4636260E067644006FA0A6C0CFF813' +
'448F43F10309A02D5B0A0AA81C8C248201D0054C34D408D25508D' +
'340135AE4035FF19F0ABB101AA6124608E07500D077E350034C20' +
'87F');
1 := DTMFromString('78DA63346766604860644006B3A64E65F80FA' +
'441A2FF8180D10AA8261C550D44164602697DA09A0C026A1C806A' +
'3209A8D103AA8920A04617A82691801A47C26A003CD10B0E');
2 := DTMFromString('78DA63AC6766602861644006D68A120CFF813' +
'448F43F10303602D564A0AA81C8C248205D0954D344404D27504D' +
'2511E6E41150930F54538A5F0D00BDED0B3D');
3 := DTMFromString('78DA63EC626660106462400677656E33B8016' +
'94620FE0F048C2035DCA86A20B23012484F07AA1120A0A61EA846' +
'92809A164CF760A8990454234D404D07508D1C7E3500CAE00AA5');
4 := DTMFromString('78DA63EC616060D8C78002F4155819F880342' +
'310FF0702C639986A20B23012484F05127B08A8990824B61350D3' +
'0C24761250D345A43917F1AB0100C9DA0D81');
5 := DTMFromString('78DA630C6066602861644006068A6C0CFF813' +
'448F43F10308602D564A2AA81C8C24820ED0D54D344408D17504D' +
'0D0135614035D904D40402D5E4E1570300200C0A11');
6:= DTMFromString('78DA63AC6566602867644006B39A2318FE036' +
'990E87F2060EC04AA2941550391859140BA9C08353540353504D4' +
'3402D5E4135053015453855F0D0087D40C50');
7:= DTMFromString('78DA638C66666028646440068141E50CFF813' +
'448F43F1030C602D564A1AA81C8C24820ED0554534E400DC89C32' +
'026AC28930271EA8260FBF1A00C5A40B01');
8:= DTMFromString('78DA637466626078C480024A737318FE03694' +
'620FE0F048C9E4035D718D000231209A42D806A3E1250E3015473' +
'8F801A907BEE12506343D82E00E6140D47');
9 := DTMFromString('78DA63EC626660A867644006A13EF20CFF813' +
'448F43F10304E04AAA940550391859140BA03A8A69F809A06A09A' +
'46026AA662BA0743CD14A09A6EFC6A0043360C42');
10 := DTMFromString('78DA633CCCC4C0E0CAC8800CCCBC431874804' +
'220D1FF40C0B80DA8261A550D44164602E97D40358E04D46C07AA' +
'0926A06637A67B30D49C04AA71C1AF0600AAD30B51');
11 := DTMFromString('78DA639CCAC4C070870105CC9962C5F01F483' +
'302F17F2060EC04AAB9C6800618914820BD10A8E6230135B3816A' +
'1E13503301A8E6067E3500C60C0DC6');
12 := DTMFromString('78DA632C66626078C880022A0A7518FE03694' +
'620FE0F048CD540353719D000231209A4E3816ADE1350930054F3' +
'8A809A1C22D480DC7C0BBF1A003E8C0E11');
13: Result := DTMFromString('78DA63D4606060106640038C4824907600126' +
'204D458000939026A3481843C7E35006901013C');
14: Result := DTMFromString('78DA6334606060B06040038C482490360112D' +
'E04D4D801095B026AEC8184010135EA40C21DBF1A00F217024F');
15: Result := DTMFromString('78DA6354636060886340038C482490D604128' +
'904D4A8038934026A4C81442A013566402205BF1A00227A02DF');
16: Result := DTMFromString('78DA63D466606058C98006189148206D03241' +
'61250630924361250A30924B613506348580D00C7CE0473');
17: Result := DTMFromString('78DA63D465606038CF8006189148206D06244' +
'E13A18690397A40E21A7E35005B310413');
18: Result := DTMFromString('78DA635463606078C98002589858C0342394C' +
'FA80924DE1050630624DE1350A305243E1150A382690E0F1F0F8A' +
'1A004B9805D1');
19: Result := DTMFromString('78DA63D466606010656440058C482490B6051' +
'28204D498010929026A348084027E350068320137');
20: Result := DTMFromString('78DA6354636060A8626440058C48249036011' +
'22504D43803893A22CCE920A0C6014834E25703006B31039B');
21: Result := DTMFromString('78DA634C636460980EC42880118904D255405' +
'6270135B540D604026A0A81ACF904D4240259F3F0AB01001ED805' +
'36');
22: Result := DTMFromString('78DA634C676460D806C42880118904D2D540D' +
'62A026A6A81ACF504D4140259FB08A84924AC06005FAC05D6');
23: Result := DTMFromString('78DA634C646460F8C48006189148205D0064B' +
'D26A0A61EC8FA4A404D3E90F59F809A6A20EB177E3500D7ED071A' +
'');
24: Result := DTMFromString('78DA63CC64646070066214C0884402E97C20C' +
'B9A809A2A20CB9C809A1A20CB9E809A4220CB87809A4420CB0FBF' +
'1A000CD8044D');
25: Result := DTMFromString('78DA63B462666038C4800618914820ED0054B' +
'38B801A6F22D4F803D51C27A0C608A8E63C7E350016600531');
26: Result := DTMFromString('78DA633466666078C6800618914820ED47841' +
'A37A09ACF04D4F802D5BC25A0C614A8E6037E35006C710604');
27: Result := DTMFromString('78DA633466666008606440058C4824907603A' +
'AF126A0C61FA82684801A77A09A38026ACC816AA2F1AB01003A23' +
'0312');
28: Result := DTMFromString('78DA63B4606660C8676440058C4824907600A' +
'AE920A0C60DA8A690801A0FA09A56FC6A0001740310');
29: Result := DTMFromString('78DA63F4666660F8C9C8800A189148206D035' +
'4C3C7845F8D33508D0801354640353CF8D50000FA1F0243');
30: Result := DTMFromString('78DA633461666050676240058C482490F607A' +
'AD120A0C60BA8461F558DB31903AA1A5BA01A2B02E6B802D558E2' +
'5703001C7F02E1');
31: Result := DTMFromString('78DA637462666038CCC4800A18914820ED085' +
'4B38F801A43A09A1B04D47801D55C22A02600A8E60C7E350029CD' +
'056E');
32: Result := DTMFromString('78DA633462666078C7800618914820ED0254F' +
'382801A3FA09A0F04D4B803D5FCC1AF06009BC604E6');
end;
srl_DTMS[ID] := Result;
srl_DTMSet[ID] := True;
end;



{*******************************************************************************
procedure srl_LoadDTMSs(IDs: TIntegerArray);
By: Mylesmadness
Description: Preloads DTMS identified by ID in the srl DTMarray.
*******************************************************************************}

procedure srl_LoadDTMS(IDs: TIntegerArray);
var
i: Integer;
begin
for i := 0 to High(IDs) do
srl_GetDTM(IDs[i]);
end;



{*******************************************************************************
procedure srl_LoadDTMRange(StartID, EndID: Integer);
By: mylesmadness
Description: Preloads DTMS identified by ID in range StartID to EndID
*******************************************************************************}

procedure srl_LoadDTMSRange(StartID, EndID: Integer);
var
i: Integer;
begin
for i := StartID to EndID do
srl_GetDTM(i);
end;



{*******************************************************************************
procedure srl_FreeDTMS;
By: mylesmadness
Description: Frees all SRL DTMS
*******************************************************************************}

procedure srl_FreeDTMS;
var
i: Integer;
begin
for i := 0 to High(srl_DTMS) do
try
FreeDTM(srl_DTMS[i]);
srl_DTMSet[i] := False;
except end;
end;

Now I need dtms to add to it. Please post some dtms to add to it.

noidea

2008-10-12 20:36:28

Here…
Pick := DTMFromString('78DA63B4636260E067644006FA0A6C0CFF813' +
'448F43F10309A02D5B0A0AA81C8C248201D0054C34D408D25508D' +
'340135AE4035FF19F0ABB101AA6124608E07500D077E350034C20' +
'87F');
Gem := DTMFromString('78DA63346766604860644006B3A64E65F80FA' +
'441A2FF8180D10AA8261C550D44164602697DA09A0C026A1C806A' +
'3209A8D103AA8920A04617A82691801A47C26A003CD10B0E');
TheOre := DTMFromString('78DA63AC6766602861644006D68A120CFF813' +
'448F43F10303602D564A0AA81C8C248205D0954D344404D27504D' +
'2511E6E41150930F54538A5F0D00BDED0B3D');
SBook := DTMFromString('78DA63EC626660106462400677656E33B8016' +
'94620FE0F048C2035DCA86A20B23012484F07AA1120A0A61EA846' +
'92809A164CF760A8990454234D404D07508D1C7E3500CAE00AA5');
BrokePick := DTMFromString('78DA63EC616060D8C78002F4155819F880342' +
'310FF0702C639986A20B23012484F05127B08A8990824B61350D3' +
'0C24761250D345A43917F1AB0100C9DA0D81');
Handel := DTMFromString('78DA630C6066602861644006068A6C0CFF813' +
'448F43F10308602D564A2AA81C8C24820ED0D54D344408D17504D' +
'0D0135614035D904D40402D5E4E1570300200C0A11');
ClayDTM:= DTMFromString('78DA63AC6566602867644006B39A2318FE036' +
'990E87F2060EC04AA2941550391859140BA9C08353540353504D4' +
'3402D5E4135053015453855F0D0087D40C50');
PickHead := DTMFromString('78DA638C66666028646440068141E50CFF813' +
'448F43F1030C602D564A1AA81C8C24820ED0554534E400DC89C32' +
'026AC28930271EA8260FBF1A00C5A40B01');
Knife := DTMFromString('78DA637466626078C480024A737318FE03694' +
'620FE0F048C9E4035D718D000231209A42D806A3E1250E3015473' +
'8F801A907BEE12506343D82E00E6140D47');
Log := DTMFromString('78DA63EC626660A867644006A13EF20CFF813' +
'448F43F10304E04AAA940550391859140BA03A8A69F809A06A09A' +
'46026AA662BA0743CD14A09A6EFC6A0043360C42');
Axe := DTMFromString('78DA633CCCC4C0E0CAC8800CCCBC431874804' +
'220D1FF40C0B80DA8261A550D44164602E97D40358E04D46C07AA' +
'0926A06637A67B30D49C04AA71C1AF0600AAD30B51');
WillowLongbow[u[ := DTMFromString('78DA639CCAC4C070870105CC9962C5F01F483' +
'302F17F2060EC04AAB9C6800618914820BD10A8E6230135B3816A' +
'1E13503301A8E6067E3500C60C0DC6');
WillowShortbow[u] := DTMFromString('78DA632C66626078C880022A0A7518FE03694' +
'620FE0F048CD540353719D000231209A4E3816ADE1350930054F3' +
'8A809A1C22D480DC7C0BBF1A003E8C0E11');




MylesMadness

2008-10-12 20:41:44

So is pick like all the picks, Gem all the gems, and such?

pwnaz0r

2008-10-12 20:49:32

This idea has been posed before (way back when). It was dismissed because of the idea that it will take forever for SCAR to load them all and may cause memory leaks..

MylesMadness

2008-10-12 20:50:34

why did bitmaps work then?

noidea

2008-10-12 20:53:11

From: pwnaz0r
This idea has been posed before (way back when). It was dismissed because of the idea that it will take forever for SCAR to load them all and may cause memory leaks..


We could load one at a time?

Yea myles (About the pick and gem thing.)

pwnaz0r

2008-10-12 20:54:30

I know, it would do that all at one time anyways. But it would take along time to load all of them one at a time and it might crash scar with all that memory its using up/ make your comp REALLY laggy

MylesMadness

2008-10-12 20:57:46

A script wont use EVERY dtm in its run time, maybe one for the pick/axe, the head and the ore/log. Thats about it, 3 dtms that you would have loaded anyway are now just easier to use because the premade

noidea

2008-10-12 21:03:37

From: pwnaz0r
I know, it would do that all at one time anyways. But it would take along time to load all of them one at a time and it might crash scar with all that memory its using up/ make your comp REALLY laggy


Could you load them the same way SRL can load BitMaps?

MylesMadness

2008-10-12 21:05:40

From: noidea
Could you load them the same way SRL can load BitMaps?
yes, you could. Like I said in the post I jacked the way the bitmaps are already done and made it for dtms

Edit:Whats SBook?

Bam Bam

2008-10-12 21:52:11

You guys could overcome the loading issue :P

DTMs are strings, right? so you could store the different dtms in a string array and then only load the ones needed.
ie:
Pwnaz0r:= dtmFromString(ExampleDTM[23]);

edit: I think your example already does this… night guys.

MylesMadness

2008-10-12 21:55:20

well, we only load the ones want, but not that way

Daniel

2008-10-13 05:28:42

From: pwnaz0r
This idea has been posed before (way back when). It was dismissed because of the idea that it will take forever for SCAR to load them all and may cause memory leaks..

Have you ever heard of cases, sir? :p

Bobarkinator

2008-10-13 19:05:34

Don't ID them by number… People don't want to have to look for numbers, idea by name.

Claymore

2008-10-14 01:57:33

Nah, i think its best if people make their own because we want to teach people to script! Theres a balance between helping and learning in SRL….

Santa_Clause

2008-10-14 06:50:12

From: Deathscytex
Nah, i think its best if people make their own because we want to teach people to script! Theres a balance between helping and learning in SRL….


Making a DTM is barely scripting. If they can script, they can make a DTM.

MylesMadness

2008-10-14 15:27:48

From: Bobarkinator
Don't ID them by number… People don't want to have to look for numbers, idea by name.
Thats why we have the consts

Boreas

2008-10-14 15:41:01

From: Santa_Clause
Making a DTM is barely scripting. If they can script, they can make a DTM.


So how about a database that makes itself?

Cazax

2008-10-14 16:34:04

I was making the same time ago, and this is what i made:
program Dtms;

const
// Cooking
Dtm_Cooked_Chicken = 1;
Dtm_Cooked_Beef = 2;
Dtm_Cooked_Shrimps = 3;
Dtm_Bread = 4;
Dtm_Cooked_Sardine = 5;
Dtm_Cooked_Anchovies = 6;
Dtm_Cooked_Herring = 7;
Dtm_Cooked_RedberryPie = 8;
Dtm_Cooked_Trout = 9;
Dtm_Cooked_Pike = 10;
Dtm_Cooked_MeatPie = 11;
Dtm_Cooked_Salmon = 12;
Dtm_Cooked_Tuna = 13;
Dtm_Cooked_ApplePie = 14;
Dtm_Cooked_Pizza = 15;
Dtm_Fermented_Wine = 16;
Dtm_Cooked_Lobster = 17;
Dtm_Cooked_Cake = 18;
Dtm_Cooked_Swordfish = 19;
Dtm_Cooked_MeatPizza = 20;





Function GetDtm(ID : Integer): Integer;
begin

case ID of
1: Result := DTMFromString('78DA63D4606060106640038C4824907600126' +
'204D458000939026A3481843C7E35006901013C');
2: Result := DTMFromString('78DA6334606060B06040038C482490360112D' +
'E04D4D801095B026AEC8184010135EA40C21DBF1A00F217024F');
3: Result := DTMFromString('78DA6354636060886340038C482490D604128' +
'904D4A8038934026A4C81442A013566402205BF1A00227A02DF');
4: Result := DTMFromString('78DA63D466606058C98006189148206D03241' +
'61250630924361250A30924B613506348580D00C7CE0473');
5: Result := DTMFromString('78DA63D465606038CF8006189148206D06244' +
'E13A18690397A40E21A7E35005B310413');
6: Result := DTMFromString('78DA635463606078C98002589858C0342394C' +
'FA80924DE1050630624DE1350A305243E1150A382690E0F1F0F8A' +
'1A004B9805D1');
7: Result := DTMFromString('78DA63D466606010656440058C482490B6051' +
'28204D498010929026A348084027E350068320137');
8: Result := DTMFromString('78DA6354636060A8626440058C48249036011' +
'22504D43803893A22CCE920A0C6014834E25703006B31039B');
9: Result := DTMFromString('78DA634C636460980EC42880118904D255405' +
'6270135B540D604026A0A81ACF904D4240259F3F0AB01001ED805' +
'36');
10: Result := DTMFromString('78DA634C676460D806C42880118904D2D540D' +
'62A026A6A81ACF504D4140259FB08A84924AC06005FAC05D6');
11: Result := DTMFromString('78DA634C646460F8C48006189148205D0064B' +
'D26A0A61EC8FA4A404D3E90F59F809A6A20EB177E3500D7ED071A' +
'');
12: Result := DTMFromString('78DA63CC64646070066214C0884402E97C20C' +
'B9A809A2A20CB9C809A1A20CB9E809A4220CB87809A4420CB0FBF' +
'1A000CD8044D');
13: Result := DTMFromString('78DA63B462666038C4800618914820ED0054B' +
'38B801A6F22D4F803D51C27A0C608A8E63C7E350016600531');
14: Result := DTMFromString('78DA633466666078C6800618914820ED47841' +
'A37A09ACF04D4F802D5BC25A0C614A8E6037E35006C710604');
15: Result := DTMFromString('78DA633466666008606440058C4824907603A' +
'AF126A0C61FA82684801A77A09A38026ACC816AA2F1AB01003A23' +
'0312');
16: Result := DTMFromString('78DA63B4606660C8676440058C4824907600A' +
'AE920A0C60DA8A690801A0FA09A56FC6A0001740310');
17: Result := DTMFromString('78DA63F4666660F8C9C8800A189148206D035' +
'4C3C7845F8D33508D0801354640353CF8D50000FA1F0243');
18: Result := DTMFromString('78DA633461666050676240058C482490F607A' +
'AD120A0C60BA8461F558DB31903AA1A5BA01A2B02E6B802D558E2' +
'5703001C7F02E1');
19: Result := DTMFromString('78DA637462666038CCC4800A18914820ED085' +
'4B38F801A43A09A1B04D47801D55C22A02600A8E60C7E350029CD' +
'056E');
20: Result := DTMFromString('78DA633462666078C7800618914820ED0254F' +
'382801A3FA09A0F04D4B803D5FCC1AF06009BC604E6');







end;
I don't know if they still work, but i think they might be working.

Claymore

2008-10-19 15:34:03

Still……Fine this idea is o.k, but i dont plan using it because i like making my own. Sort of like the SRL Bitmaps, barely anyone uses them, people likes to make their own ;p