n3ss3s
2007-10-21 03:16:30
Okay, so Im confused about the "file blabla save… more bla" so I decided that I just post here my functions if its okay?
I think I'll first concentrate to Smithing/ Smelting, sooo no.1 - FastFindAnvil (~60 ms ;) )
More coming…
EDIT:
Finished the furnace finder, finds in average 40ms, 110% accurate ;)
Okay, now a function that smelts…
I think I'll first concentrate to Smithing/ Smelting, sooo no.1 - FastFindAnvil (~60 ms ;) )
Function FastFindAnvil(Var Ax, Ay: Integer): Boolean;
Var
TPA, TPA2: TPointArray;
Var
I, CTS, M, C: Integer;
Var
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
M := GetSystemTime;
FindColorsTolerance(TPA2, 5987683, MSX1, MSY1, MSX2, MSY2, 10);
C := GetArrayLength(TPA2) - 1;
For I := 0 To C Do
Begin
TP := TPA2[i];
FindColorsTolerance(TPA, 5987683, TP.x - 15, TP.y - 15, TP.x + 15, TP.y + 15, 10);
If(GetArrayLength(TPA) >= 20)Then
Begin
TP := MiddleTPA(TPA);
Result := True;
Ax := TP.x;
Ay := TP.y;
Break;
End;
End;
ColorToleranceSpeed(CTS);
Writeln('Found anvil in '+IntToStr(GetSystemTime - M));
End;
End;
More coming…
EDIT:
Newbieno shit..
Finished the furnace finder, finds in average 40ms, 110% accurate ;)
Function OpenFurnace: Boolean;
Var
X, Y, CTS, M, D: Integer;
Var
fPoints: TPointArray;
Begin
If(Not(LoggedIn))Then Exit;
M := GetSystemTime;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
X := MSCX;
Y := MSCY;
If(FindColorSpiralTolerance(X, Y, 3158070, MSX1, MSY1, MSX2, MSY2, 25))Then
Begin
FindColorsTolerance(fPoints, 3158070, X - 150, Y - 150, X + 150, Y + 150, 25);
If(GetArrayLength(fPoints) >= 6400)Then
Begin
MiddleTPAEx(fPoints, X, Y);
D := GetSystemTime - M;
MMouse(X, Y, 30, 30);
If(IsUpTextMulti('Furnace', 'Furn', 'rnac'))Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 1, 1, True);
Flag;
Wait(500 + Random(25));
If(SimilarColors(GetColor(36, 372), 7238703, 15))Then
Begin
Result := True;
Writeln('*** Opened furnace ***');
Writeln('Furnace was found in: '+IntToStr(D)+' ms.');
End;
End;
End;
End;
ColorToleranceSpeed(CTS);
End;
Okay, now a function that smelts…
Function SmeltBars(Bar, HMany: String): Boolean;
Var
X, Y, Slot, Q: Integer;
Begin
If(Not(LoggedIn))Then Exit;
If(Not(FindNpcChatText('would you')))Then Exit;
Case LowerCase(Bar) Of
'bronze': Slot := 1;
'blurite': Slot := 2;
'iron': Slot := 3;
'silver': Slot := 4;
'steel': Slot := 5;
'gold': Slot := 6;
'mithril': Slot := 7;
'adamant': Slot := 8;
'rune': Slot := 9;
End;
Slot := Slot - 1;
X := 53 + Slot * 50;
Y := 409;
Mouse(X, Y, 8, 8, False);
If(Not(LowerCase(HMany) = 'all'))Then
Begin
ChooseOption(HMany);
End Else
Begin
ChooseOption('X');
Wait(800 + Random(550));
TypeSend(IntToStr(28 + Random(72)));
Wait(550 + Random(150));
If(FindNpcChatText('to make'))Then Exit;
Repeat
If(Random(5) = 4)Then
Begin
MMouse(MSX1, MSY1, MSX2, MSY2);
End;
Wait(1000 + Random(350));
Q := Q + 1;
If(Not(LoggedIn))Then
Begin
Exit;
End;
If(Not(Result))Then
Begin
If(FindChatText('retrieve a bar'))Then
Begin
Result := True;
End;
End;
Until(FindChatText('run out')) Or (Q >= 35);
End;
End;