PDA

View Full Version : A working GetXP



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. >.<

imafatmess
10-26-2007, 08:40 PM
Wow, very nice, I've been looking for one of these for a while, I'll defo use it in my script I'm making...

ShowerThoughts
10-26-2007, 08:51 PM
why!?, ;)j/k ehm why is the old one not working?

imafatmess
10-26-2007, 09:57 PM
Dunno why, it just isnt for some reason :S

rogeruk
10-26-2007, 10:34 PM
Fishing = 1160
XP = 1160

The problem is any skill in the first column it wont find.

function GetXp(skill: string): Integer;
var
textx, texty, x1, y1, x2, y2, LeftCorner, RightCorner, len, x, y: Integer;
xp: string;
t: TPoint;
begin
LeftCorner := DTMFromString('78DA63346164603006622C0026CA684A841 A9' +
'03926449883A6E6FFFF0598E60411614E100173406A828970 3301' +
'3500C6560919');
RightCorner := DTMFromString('78DA635CC2C8C0100CC458004C947131916 A8' +
'250D5FCFFBF0055CD124C3558CD3121600E488D3101739610 A9C6' +
'04BF1A00F7DF0C91');
Result := -1;
GameTab(2);
t := skilltocoords(skill);
MMouse(t.x, t.y, 5, 5);
repeat
wait(10);
until findcolor(x, y, 10551295, 550, 212, 736, 465);
wait(300 + Random(100))
if ((FindDtm(LeftCorner, x1, y1, 540, 204, 741, 464)) and (FindDtm(RightCorner, x2, y2, 554, 205, 743, 465))) then
if (istextinareaex(x1, y1, x2, y2, textx, texty, 'XP', 0, smallchars, False, True, 0, 2, 0)) then
begin
len := (x2 - textx - 22) div 7
xp := Trim(gettextatex(textx + 22, texty, 5, smallchars, False, False, 0, 3, 0, len, False, tr_digits))
try
Result := StrToInt(xp);
except
WriteLn('Failed to get XP');
end;
WriteLn(Skill + ' = ' + IntToStr(Result));
end;
freedtm(leftcorner);
freedtm(rightcorner);
end;

SRL GetXP fixed.

Narcle
10-26-2007, 11:36 PM
well when i tested it and had it just return the string not the integer, I had O's where there should of been 0's. This has been working ever since for me in my fighting script. :D

Metagen
11-02-2007, 02:41 PM
OMG THANKYOU SO MUCH!!

Im going to use this to check if im infight (failsafe) again

just get the xp every one and a while. and if it hasnt changed voila.

Metagen
11-02-2007, 08:04 PM
Nice, it works every time! i love it (woopsies double post)

mark9510
11-03-2007, 12:38 AM
cool this should be sick in some scripts

neG
11-03-2007, 02:23 AM
Thanks!
Now my Experience per Hour function will work!

Narcle
11-05-2007, 01:14 AM
Yep thats why I wanted a working one. I use it in my two fighter scripts, and whatever else I make thats for skill gaining in the future.