SRL Archive - Research & Development Lounge

FindItemEOC


kazhual

2012-11-22 12:17:48

The name says it al.

1. This Function will Move your mouse to an Inventory slot by choise.
2. Finds the EOC menu in your inventory.
3. Accoording to the EOC menu, the program will isolate the text.
4. Result is the found text, if none Result = ''

Results i got so far:
- N a t u r e t i a r a
- A m u l e t o f g l o r y ( 4 )
- P r a y e r p o t i o n ( 4 )
- S u p e r s t r e n g t h ( 1 )
- S u p e r a t t a c k ( 2 )

When interested in this i can modify it to a function, and add some features.

program NewFunction;
{$DEFINE SMART}
{$i srl/srl.simba}

var
x,y : integer ;

function FindItemEOC(InvSlot : integer ) : string ;
var
Color, Tol : integer;
DTM1, DTM2 : integer ;
ItemBox : array[0..1] of Tpoint ;
begin
if not ( GameTab( tab_Inv ) ) then begin
FTab( tab_Inv ) ;
wait( 200 + random( 250 ) ) ;
end;
if not ( InvSlot > 0 ) and ( InvSlot < 29 ) then begin
InvSlot := 1 ;
end;
MMouseItem( InvSlot );
wait( 500 + random( 200 ) );
DTM1 := DTMFromString('mQwAAAHicY2ZgYHBkYmBwYYLQZowQbAnEy5cvZ/j79y8YcwHVwTAjEgYCAFnTCXw=');
DTM2 := DTMFromString('mQwAAAHicY2YAAmYGhr9MENqMEYItgXj58uUMf//+BWMuoDQMMyJhIAAAZvQJtQ==');
result := '' ;
Color := 7067128 ;
Tol := 10 ;
if ( FindDTM(DTM1,x,y,MIX1,MIY1,MIX2+27,MIY2 ) ) then begin
ItemBox[0] := Point( x, y )
if ( FindDTM(DTM2,x,y,MIX1,MIY1,MIX2+27,MIY2 ) ) then begin
ItemBox[1] := Point( x, y )
ItemBox[0].x := ItemBox[0].x + 51 ;
ItemBox[0].y := ItemBox[0].y + 4 ;
ItemBox[1].x := ItemBox[1].x - 8 ;
ItemBox[1].y := ItemBox[1].y + 22 ;
result := GetTextAtExWrap( ItemBox[0].x, ItemBox[0].y, ItemBox[1].x, ItemBox[1].y, 0, 0, 1, Color, Tol, UpCharsEx) ;
end;
end;
FreeDTM( DTM1 ) ;
FreeDTM( DTM2 ) ;
end;


begin

SRL_SixHourFix := True ;
Smart_FixSpeed := True ;
ClearDebug ;
SetupSRL ;

WriteLn( FindItemEOC( 4 ) ) ;

end.