SRL Archive - Help and Support

Load an array of DTM's


sirlaughsalot

2008-10-08 01:09:19

Lets say i have a lot of DTM's i want to use, but i dont want to load all of them, how would i load only some of them, designated by an array? i have been thinking about this for a while, if anyone has any ideas, it would be greatly appreciated :D

Bonfield

2008-10-08 03:19:27

couldnt you just do something like this

program New;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}

var
d: integer;

procedure LoadDTM(DTM: string);
begin
case DTM of

'tree': d := DTMFromString('78DA63E4656460F8C48002FEFFFF0FA619A17' +
'C464720EB2E0135F381ACE704D41800592B08A89104B26E1250E3' +
'0464C930E257930A64891350F30D487CC16F17004EFB2033');

'rock': d := DTMFromString('78DA63E4656460F8C48002FEFFFF0FA619A17' +
'C464720EB2E0135F381ACE704D41800592B08A89104B26E1250E3' +
'0464C930E257930A64891350F30D487CC16F17004EFB2033');
end;
end;

begin
loadDTM('tree')
end.


Wizzup?

2008-10-08 04:25:09

You could have an Array of String.
Store all the actual encrypted DTM Data in there, and use it when you need it.


MyTempDTM := DTMFromString(DTMArray[somenumber]);

DoSomethingWithTheDTM;

FreeDTM(MyTempDTM);

sirlaughsalot

2008-10-08 17:13:21

From: Bonfield
couldnt you just do something like this

program New;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}

var
d: integer;

procedure LoadDTM(DTM: string);
begin
case DTM of

'tree': d := DTMFromString('78DA63E4656460F8C48002FEFFFF0FA619A17' +
'C464720EB2E0135F381ACE704D41800592B08A89104B26E1250E3' +
'0464C930E257930A64891350F30D487CC16F17004EFB2033');

'rock': d := DTMFromString('78DA63E4656460F8C48002FEFFFF0FA619A17' +
'C464720EB2E0135F381ACE704D41800592B08A89104B26E1250E3' +
'0464C930E257930A64891350F30D487CC16F17004EFB2033');
end;
end;

begin
loadDTM('tree')
end.



Well what i mean is if you wanted to load both of those, then you would have to do 2 lines, and if you have to load a lot of dtm's writing all those lines gets tiresome :p

From: Wizzup?
You could have an Array of String.
Store all the actual encrypted DTM Data in there, and use it when you need it.


MyTempDTM := DTMFromString(DTMArray[somenumber]);

DoSomethingWithTheDTM;

FreeDTM(MyTempDTM);


im not sure what you mean =/

Bobarkinator

2008-10-08 21:17:58

From: sirlaughsalot
Well what i mean is if you wanted to load both of those, then you would have to do 2 lines, and if you have to load a lot of dtm's writing all those lines gets tiresome :p



im not sure what you mean =/


Wizzup is saying store all the DTM's you need in an TStringArray.

DTMs[0] := 'FirstDTM';
DTMs[1] := 'SecondDTM';
etc.

Then after you do that you can loop the array to load all the DTM's at once using a TIntegerArray to store them.

For I:= 0 To High(DTMs) Do
IntegerArray[I] := DTMFromString(DTMs[I]);

Negaal

2008-10-09 01:30:08

Or something like that Load(['tree', 'rock', 'water'])

And if you're such memory ass then later Unload;

Make it unload all of them(so you don't have to point out whichone to unload), but make sure you use
try
..unload all the dtms ..
execpt
end;