SRL Archive - Help and Support

AmountDtm failing -- AHH!


Ransom

2007-03-02 01:07:54

So after a long day at school and work editing my player merchant i converted it to use DTM's rather than colors for ease of use by the end user and to help keep things more constant. After much excitement of it actually compiling when i got home it decided that AmountDtm doesn't want to work….ever.

My question is how should i go about solving this problem? AmountColor worked like a super charm. Is it my DTM's fault? I made the DTM by taking a central point and connecting it in star form to the outer black edges just like i saw in the tutorial. The only modifications i made to it manually was to change the color tol of the central point to 300. If it ISN'T my DTM's fault i need some serious help because i have little knowledge in the whole amount of something area. And i am a bit lazy and just like to post my thoughts.

AnyIdeas(Just, Post, Here);

Thanks(Ransom);

wow i've been scripting for WAY(Too, Long, ' Today');

Wizzup?

2007-03-02 04:24:24

function CountItemBmpTol(bmp, tol: Integer):  Integer; 
By: Stupid3ooo
Description:
Performs a count of inventory items by bmp with tol tolerance.

function CountItemBmpMaskTol(bmp, tol, ctol: Integer): Integer;
By: Stupid3ooo
Description:
Performs a count of inventory items by bmpmasks with tol tolerance,
and Ctol ContourTolerance.

Don't make the bitmap too big, this should work just fine though.

Ransom

2007-03-02 08:09:42

Thanks! Just few quickies more then. One does it count stacks. The player to player merchant deals by buying (and selling….soon) large amounts of coal ess or bars (and anything else you can make a DTM of) so stacks are important.

What i have to identify and count items is this.

   //SETUP
TypeItem := 1; //Type Of Item -- 1 = ore, 2 = ess, or 3 = bar. CASE SENSITIVE.
Price := 140; //The cost per item you are buying or selling for
Buying := True; //True if you are buying False if you are selling
MouseSpeed := 3; //lower number = higher speed. you need it FAST
//END SETUP

So all they have to set is type and price.

Procedure TradeIdent;
var a,b : Integer;
begin

If (TypeItem = 1) then
Item := DTMFromString('78DA635CCAC4C050CCC8800C6C6DB51874804' +
'220D1FF40C008529385AA06220B2381F45AA09A3C026A5603D594' +
'1050B3900835338950331FA8A68A809AD94035F9F8D5000055E60' +
'DA3');

FindInvDtm(a, b, Item);
wait(50);
MMouse(a+3, b+3, 2, 2);
wait(500);
if (Option2('ron ore')) then
begin
Ident := 'ore';
ItemToTrade := 'iron ore';
end else
if (Option2('Coal') = True) or (Option2('al')=True) or (Option2('Co') = True) then
begin
Ident := 'Coal';
ItemToTrade := 'coal';
end else
if (Option2('eel bar')) then
begin
Ident := 'bar';
ItemToTrade := 'steel bars';
end else
if (Option2('ron bar')) then
begin
Ident := 'bar';
ItemToTrade := 'iron bars';
end else
if (Option2('ess')) then
begin
Ident := 'essence'
ItemToTrade := 'ess';
end;
end;

As you can see i've only coded in one type right now because of the amount not working…don't worry i'll get there. This basically just finds out what it is and fills in a few things…. After sleeping on it i was thinking i could use this area to add in a small 4x4 or so bitmap for each obj? and really i could put color arrays here too….kinda… but anyway….

Procedure InventoryItems;
begin

Gold := 0 //resets when called
ItemsLeft := 0 //resets when called
Gold := AmountColor('Inv', 1884654, 15);
ItemsLeft := AmountDtm('Inv', Item);
Writeln('>------------------------------<');
Writeln('You have ' + IntToStr(Gold) + ' Gold');
Writeln('You have ' + IntToStr(ItemsLeft) + ' ' + Ident);
Writeln('>------------------------------<');
end;

This is my almighty progress report / item counter. I know it's bad…but i'm not really worried about reports just yet. This is where it screws up.

But anyway i'll check into those procedures. thanks for the reply. I'll keep chugging along with it.

Just one more quickie.. What's a good tol for bitmaps so that the inner colors don't matter too much?

Anyway thanks!

Ransom:spongebob:

Wizzup?

2007-03-02 10:52:01

From: Ransom
Thanks! Just few quickies more then. One does it count stacks. The player to player merchant deals by buying (and selling….soon) large amounts of coal ess or bars (and anything else you can make a DTM of) so stacks are important.

What i have to identify and count items is this.

   //SETUP
TypeItem := 1; //Type Of Item -- 1 = ore, 2 = ess, or 3 = bar. CASE SENSITIVE.
Price := 140; //The cost per item you are buying or selling for
Buying := True; //True if you are buying False if you are selling
MouseSpeed := 3; //lower number = higher speed. you need it FAST
//END SETUP

So all they have to set is type and price.

Procedure TradeIdent;
var a,b : Integer;
begin

If (TypeItem = 1) then
Item := DTMFromString('78DA635CCAC4C050CCC8800C6C6DB51874804' +
'220D1FF40C008529385AA06220B2381F45AA09A3C026A5603D594' +
'1050B3900835338950331FA8A68A809AD94035F9F8D5000055E60' +
'DA3');

FindInvDtm(a, b, Item);
wait(50);
MMouse(a+3, b+3, 2, 2);
wait(500);
if (Option2('ron ore')) then
begin
Ident := 'ore';
ItemToTrade := 'iron ore';
end else
if (Option2('Coal') = True) or (Option2('al')=True) or (Option2('Co') = True) then
begin
Ident := 'Coal';
ItemToTrade := 'coal';
end else
if (Option2('eel bar')) then
begin
Ident := 'bar';
ItemToTrade := 'steel bars';
end else
if (Option2('ron bar')) then
begin
Ident := 'bar';
ItemToTrade := 'iron bars';
end else
if (Option2('ess')) then
begin
Ident := 'essence'
ItemToTrade := 'ess';
end;
end;

As you can see i've only coded in one type right now because of the amount not working…don't worry i'll get there. This basically just finds out what it is and fills in a few things…. After sleeping on it i was thinking i could use this area to add in a small 4x4 or so bitmap for each obj? and really i could put color arrays here too….kinda… but anyway….

Procedure InventoryItems;
begin

Gold := 0 //resets when called
ItemsLeft := 0 //resets when called
Gold := AmountColor('Inv', 1884654, 15);
ItemsLeft := AmountDtm('Inv', Item);
Writeln('>------------------------------<');
Writeln('You have ' + IntToStr(Gold) + ' Gold');
Writeln('You have ' + IntToStr(ItemsLeft) + ' ' + Ident);
Writeln('>------------------------------<');
end;

This is my almighty progress report / item counter. I know it's bad…but i'm not really worried about reports just yet. This is where it screws up.

But anyway i'll check into those procedures. thanks for the reply. I'll keep chugging along with it.

Just one more quickie.. What's a good tol for bitmaps so that the inner colors don't matter too much?

Anyway thanks!

Ransom:spongebob:


To count stacks use amount.scar, it is in misc.

Use photoshop for bitmap making / copying.

Ransom

2007-03-02 18:33:16

Yeah thats what i've been using. Took a suggestion to use DTM's rather than bitmaps or colors.

Long story short it's all fine and dandy again but instead of using colors for everything it now uses DTM's for item recognition and bitmaps for item counting… o well. why not reinvent the wheel.

Thanks for the help

TOB

2007-03-06 14:45:39

I believe 255 is the max for the tolerance as 255 = 1 byte(1111 1111 for you binary people :P)