vwxz
2014-01-22 02:21:12
So this thread is a mix between a script demo, a progress log, and a help request. If there's a better forum for it, mods please help me move it.
I was looking at some recent work and comments in this thread and I got interested in writing a script for Runespan. Fortunately, I recently got a 90+ RC account to test stuff with, so I'm good to go.
Here is my progress so far. It includes just the exp tracking main loop, since I will need that both for siphoning detection and progress tracking. This script is completely passive, but I've been running it while manually Runespanning to verify that it works.
My next step is to add object finding. Some replies at this thread were really helpful.
Any advice, comments, encouragement, etc. would be great. Thanks guys!
I was looking at some recent work and comments in this thread and I got interested in writing a script for Runespan. Fortunately, I recently got a 90+ RC account to test stuff with, so I'm good to go.
Here is my progress so far. It includes just the exp tracking main loop, since I will need that both for siphoning detection and progress tracking. This script is completely passive, but I've been running it while manually Runespanning to verify that it works.
program RunespanSiphoner;
{$define SMART}
{$I SRL-6/SRL.Simba}
{
vwxz's Runespan Siphoner
in development - not a release
}
var
LastExpSeen, TotalExpGained: Integer;
StartTime, LastExpChangeTime: TTimeMarker;
SiphonTimeout: Integer;
{
TRSChatBox.GetXP
by Ashaman88, Janilabo, and others
from http://villavu.com/forum/showthread.php?t=107292
Gets the current exp value from the exp counter.
The counter must be placed in the top right of the chat box header bar.
}
function TRSChatBox.getXP: Integer;
var
b: TBox;
s: String;
tpa : TPointArray;
atpa : T2DPointArray;
i,cts,p: Integer;
begin
b := self.getBounds();
b.edit(+(b.x2-b.x1)-140, +10, -5, -94);
findColorsTolerance(tpa, 14013909, b, 4,colorSetting(2, 0.00, 0.00));
if length(tpa) < 2 then
begin
print('chatBox.getXP(): No XP found', TDebug.SUB);
Exit;
end;
atpa := tpa.cluster(5);
b:= atpa.getbounds;
b.edit(-2,-2,+2,+3);
s:=Replace(tesseractgettext(b.x1,b.y1,b.x2,b.y2, FILTER_SMALL_CHARS), ' ', '', [rfReplaceAll]);
P := Pos('x', S);
if P > 0 then
Result := StrToIntDef(ExtractFromStr(Copy(s, P, Length(S)), Numbers), 0)
else
Result := StrToIntDef(ExtractFromStr(S, Numbers), 0);
print('chatBox.getXP(): XP found: ' + tostr(result), TDebug.SUB);
end;
{
UpdateExpSeen
Checks current exp displayed in exp counter and
update the internal totals and timers regarding experience gain.
}
procedure UpdateExpSeen;
var
CurrentExpSeen, CurrentExpGained: Integer;
begin
CurrentExpSeen := ChatBox.GetXP;
CurrentExpGained := CurrentExpSeen - LastExpSeen;
if (CurrentExpGained > 0) then begin
LastExpChangeTime.Start;
end
LastExpSeen := CurrentExpSeen;
TotalExpGained := TotalExpGained + CurrentExpGained;
end;
{
IsCurrentlySiphoning
Whether or not we believe we are currently siphoning something,
inferred from recent experience gain.
}
function IsCurrentlySiphoning: Boolean;
begin
UpdateExpSeen;
Result := LastExpChangeTime.GetTime <= SiphonTimeout;
end;
procedure SetUpAll;
begin
ClearDebug;
SmartEnableDrawing := True;
SetUpSRL;
SiphonTimeout := 5000;
StartTime.Start;
LastExpChangeTime.Start;
LastExpSeen := ChatBox.GetXP;
TotalExpGained := 0;
end;
procedure MainLoopIteration;
begin
UpdateExpSeen;
Print(IntToStr(TotalExpGained));
Print(BoolToStr(IsCurrentlySiphoning));
Sleep(5000 + Random(1000));
end;
begin
SetUpAll;
repeat
MainLoopIteration
until False;
end.My next step is to add object finding. Some replies at this thread were really helpful.
Any advice, comments, encouragement, etc. would be great. Thanks guys!