SRL Archive - SRL Archives

CountOres - Mining.scar


TViYH

2008-10-12 22:28:49

Well, it wasn't in there.


function CountOres: integer;
var OreDTM: Integer;
begin
OreDTM := DTMFromString('78DA63CC67666068606440061E3A8A0CFF813' +
'448F43F10302602D554A3AA81C8C248201D0F54D34A404D06504D' +
'37116ADA09A82906AA6923A0A68A08F7D400D5D41050530954534' +
'A404D21504D110135994035C5F8D50000A902100B');
Result := CountItems(OreDTM, 'dtm', [0]);
FreeDTM(OreDTM);
end;

Blumblebee

2008-10-12 22:31:26

that can be done so easily, whats the point? I dunno, just a though but really, its like what 5 lines?

TViYH

2008-10-12 22:54:50

Your point?

It wasn't in Mining.scar.

Naum

2008-10-13 02:31:22

No Point of this really, you might need to call the DTM include before in mining.scar because they may not be after each other.

Blumblebee

2008-10-13 02:31:39

my point is why add it to mining.scar? you could write it yourself faster than it would be to use the procedure in mining.scar.

Shuttleu

2008-10-13 02:39:09

if your going to add it to mining.scar then you migh as well include the other ores aswell
function CountOres(WhichOre : string) : integer;
var OreDTM: Integer;
begin
Case (WhichOre) of
'copper' : OreDTM := DTMFromString('78DA63CC67666068606440061E3A8A0CFF813' +
'448F43F10302602D554A3AA81C8C248201D0F54D34A404D06504D' +
'37116ADA09A82906AA6923A0A68A08F7D400D5D41050530954534' +
'A404D21504D110135994035C5F8D50000A902100B');
'tin' : OreDTM := DTMFromString('78DA63CC67666068606440061E3A8A0CFF813' +
'448F43F10302602D554A3AA81C8C248201D0F54D34A404D06504D' +
'37116ADA09A82906AA6923A0A68A08F7D400D5D41050530954534' +
'A404D21504D110135994035C5F8D50000A902100B');
'iron' : OreDTM := DTMFromString('78DA63CC67666068606440061E3A8A0CFF813' +
'448F43F10302602D554A3AA81C8C248201D0F54D34A404D06504D' +
'37116ADA09A82906AA6923A0A68A08F7D400D5D41050530954534' +
'A404D21504D110135994035C5F8D50000A902100B');
'coal' : OreDTM := DTMFromString('78DA63CC67666068606440061E3A8A0CFF813' +
'448F43F10302602D554A3AA81C8C248201D0F54D34A404D06504D' +
'37116ADA09A82906AA6923A0A68A08F7D400D5D41050530954534' +
'A404D21504D110135994035C5F8D50000A902100B');
'addy', 'adamant' : OreDTM := DTMFromString('78DA63CC67666068606440061E3A8A0CFF813' +
'448F43F10302602D554A3AA81C8C248201D0F54D34A404D06504D' +
'37116ADA09A82906AA6923A0A68A08F7D400D5D41050530954534' +
'A404D21504D110135994035C5F8D50000A902100B');
'mith', 'mithril' : OreDTM := DTMFromString('78DA63CC67666068606440061E3A8A0CFF813' +
'448F43F10302602D554A3AA81C8C248201D0F54D34A404D06504D' +
'37116ADA09A82906AA6923A0A68A08F7D400D5D41050530954534' +
'A404D21504D110135994035C5F8D50000A902100B');
'rune', 'runite' : OreDTM := DTMFromString('78DA63CC67666068606440061E3A8A0CFF813' +
'448F43F10302602D554A3AA81C8C248201D0F54D34A404D06504D' +
'37116ADA09A82906AA6923A0A68A08F7D400D5D41050530954534' +
'A404D21504D110135994035C5F8D50000A902100B');
end;
Result := CountItems(OreDTM, 'dtm', [0]);
FreeDTM(OreDTM);
end;
something like that

~shut

HyperSecret

2008-10-13 03:04:34

All ore dtms are the same. If you have the center point with a 255 tolerance and the reference points the black outline of the ore in the inventory. No reason to have a different dtm for each. Unless you are trying to count a specific ore then you would need a different center point color, not with 255 tolerance.

But counting ALL ores in the inventory, only 1 dtm neccessary.

Shuttleu

2008-10-13 11:19:30

my function counts a certain ore

i suppose you could use a DDTM and change the center point colour depending on which ore you want

~shut

Wizzup?

2008-10-13 14:41:32

Shuttleu, all your DTM's are the same…
Anyway, a simple CountItems(srl_LoadBitmap(ore_Iron), 10); should do. (I don't know the exact name of the Bitmap Const (ore_Iron)).

King of the Nites

2008-10-13 15:51:02

From: Wizzup?
Shuttleu, all your DTM's are the same…
Anyway, a simple CountItems(srl_LoadBitmap(ore_Iron), 10); should do. (I don't know the exact name of the Bitmap Const (ore_Iron)).


Some of SRL's Bitmaps don't work. I think the full and empty buckets both failed on me when I tried to use them. But, that would work if the bitmaps were working well.

HyperSecret

2008-10-14 02:17:05

From: Shuttleu
my function counts a certain ore

i suppose you could use a DDTM and change the center point colour depending on which ore you want

~shut


yes, but his doesn't ;) , and I don't think he wanted it to count specific ores.

TViYH

2008-10-14 15:02:22

No, I just wanted to add it to Mining.scar.

Yes, it may be easy for the scripter to do it, but which is easier:
writing the function or putting CountOres;?