Narcle
10-24-2007, 03:41 AM
I spend awhile trying to get this to work so I could use in my autofighter.
I started with the original and troubleshot the heck out of it. Finally I got the fix and it works!
I found out it was reading the 0 as O's and of course not removing the spaces.
function GetXp2(skill: string): Integer;//Original by Masquerader, edited by Narcle
var
textx, texty, XPboxedge, len, x, y, x1, y1, I, II, l, WaitT: Integer;
xp, Nums, text2, xpis : string;
t: TPoint;
begin
XPboxedge := DTMFromString('78DA635CC2C8C0100CC458004C947131916 A8' +
'250D5FCFFBF0055CD124C3558CD3121600E488D3101739610 A9C6' +
'04BF1A00F7DF0C91');
Result := -1;
GameTab(2);
t := skilltocoords(skill);
MMouse(t.x, t.y + 12, 5, 5);
repeat
WaitT := WaitT+1;
wait(10);
if WaitT >= 3000 then exit;
until findcolor(x, y, 10551295, 554, 205, 743, 465);
wait(300 + Random(100))
if FindDtm(XPboxedge, x1, y1, 554, 205, 743, 465) then
if (istextinareaex(554, 205, 743, 465, textx, texty, 'XP', 0, smallchars, False, True, 0, 2, 0))then;
begin
len := (x1 - textx - 22) div 7;
xp := Trim(gettextatex(textx+22, texty, 5, smallchars, False, False, 0, 3, 0, len, False, tr_AllChars))
try
begin
for l := 1 to Length(xp) do
begin
if (xp[l] = 'O') then text2 := text2 + '0' else text2 := text2+ xp[l];
end;
Nums := '01234567890';
for I := 1 to Length(Text2) do
begin
for II := 1 to 10 do
begin
if (Copy(text2, I, 1) = Copy(Nums, II, 1)) then
xpis := xpis + Copy(Text2, I, 1);
end;
end;
end;
result := strtoint(xpis);
except
WriteLn('Failed to get XP');
end;
WriteLn(Skill + ' = ' + IntToStr(Result));
end;
freeDTM(XPboxedge);
end;
Please tell me it works for you! It works for me. >.<
I started with the original and troubleshot the heck out of it. Finally I got the fix and it works!
I found out it was reading the 0 as O's and of course not removing the spaces.
function GetXp2(skill: string): Integer;//Original by Masquerader, edited by Narcle
var
textx, texty, XPboxedge, len, x, y, x1, y1, I, II, l, WaitT: Integer;
xp, Nums, text2, xpis : string;
t: TPoint;
begin
XPboxedge := DTMFromString('78DA635CC2C8C0100CC458004C947131916 A8' +
'250D5FCFFBF0055CD124C3558CD3121600E488D3101739610 A9C6' +
'04BF1A00F7DF0C91');
Result := -1;
GameTab(2);
t := skilltocoords(skill);
MMouse(t.x, t.y + 12, 5, 5);
repeat
WaitT := WaitT+1;
wait(10);
if WaitT >= 3000 then exit;
until findcolor(x, y, 10551295, 554, 205, 743, 465);
wait(300 + Random(100))
if FindDtm(XPboxedge, x1, y1, 554, 205, 743, 465) then
if (istextinareaex(554, 205, 743, 465, textx, texty, 'XP', 0, smallchars, False, True, 0, 2, 0))then;
begin
len := (x1 - textx - 22) div 7;
xp := Trim(gettextatex(textx+22, texty, 5, smallchars, False, False, 0, 3, 0, len, False, tr_AllChars))
try
begin
for l := 1 to Length(xp) do
begin
if (xp[l] = 'O') then text2 := text2 + '0' else text2 := text2+ xp[l];
end;
Nums := '01234567890';
for I := 1 to Length(Text2) do
begin
for II := 1 to 10 do
begin
if (Copy(text2, I, 1) = Copy(Nums, II, 1)) then
xpis := xpis + Copy(Text2, I, 1);
end;
end;
end;
result := strtoint(xpis);
except
WriteLn('Failed to get XP');
end;
WriteLn(Skill + ' = ' + IntToStr(Result));
end;
freeDTM(XPboxedge);
end;
Please tell me it works for you! It works for me. >.<