Xtragicx
2009-02-16 02:18:34
ok so now i got the test script to see it SMART is working and it is.W/e i try to add SMART to a random script i get and error here is the script let me know if im doing i right.
program PowerMiner;
{.include srl/srl/misc/Users.scar}
{.include SRL/SRL.scar}
{.Include SRL/SRL/Skill/Mining.Scar}
function CountOre: integer; forward;
type
RRecord = Record
rocks: Integer;
end;
const
YourSRLID = '';
YourSRLPass = '';
var
Pick: Array [0..5] of String;
PickDTM: Integer;
procedure LoadPickArray;
begin
PickDTM := DTMFromString('78DA63F466666078CBC8800C34A459191E026' +
'99828A32F50CD4B543520594964351140355F09A8B105AA7947408D2' +
'3500D2B135E35003DB606DD');
Pick[0] := 'Rune';
Pick[1] := 'Adamant';
Pick[2] := 'Mithril';
Pick[3] := 'Steel';
Pick[4] := 'Iron';
Pick[5] := 'Bronze';
end;
function PickCheck: String;
var
X, Y, I: Integer;
begin
try
LoadPickArray;
if (Players[CurrentPlayer].booleans[0]) then
GameTab(5);
Wait(150+random(50));
if FindDTM(PickDTM, X, Y, MIx1,MIy1,MIx2,MIY2) then
begin
MMouse(X, Y, 5, 5);
Wait(250+random(250));
end;
for I := 0 to 5 do
begin
If IsUpText(Pick[I]) then
begin
Result := Pick[I];
end;
end;
if (Players[CurrentPlayer].booleans[0]) then
GameTab(4);
Wait(150+random(50));
if FindDTM(PickDTM, X, Y, MIx1,MIy1,MIx2,MIY2) then
begin
MMouse(X, Y, 5, 5);
Wait(250+random(250));
end;
for I := 0 to 5 do
begin
If IsUpText(Pick[I]) then
begin
Result := Pick[I];
end;
end;
begin
if (Result = '') then
begin
WriteLn('No Pick Found, NextPlayer');
LogOut;
NextPlayer(False);
end else
WriteLn('Currently Using A ' + Result + ' Pick');
end;
except end;
end;
var
ChatMsg, JustTalked: Byte;
ChatTimed: Integer;
procedure AntiBan;
begin
if (not (LoggedIn)) then
Exit;
case Random(60) of
2:
begin
JustTalked := 0;
RandomRClick;
wait(200 + random(500));
end;
3:
begin
JustTalked := 0;
GameTab(1 + Random(12));
Wait(300 + Random(500));
GameTab(4);
end;
4:
begin
JustTalked := 0;
PickUpMouse;
Wait(200 + Random(200));
end;
5:
begin
JustTalked := 0;
RandomMovement;
SetAngle(true);
end;
end;
end;
function InChatArr(Text: array of string): Boolean;
//Credits to Nava2 and EvilChicken for this.
var
I, H: integer;
s: string;
begin
H := High(Text);
if (not (GetLastChatText(s))) then
LastChatter(s);
for I := 0 to H do
begin
if (Pos(Lowercase(Text[i]), (Lowercase(s))) > 0) then
begin
Result := true;
Exit;
end;
end;
end;
function AutoResponder: integer;
//Credits and love to DansTheMan for fixing this up.
var
level, laugh, noob, auto, greet: TStringArray;
begin
if (JustTalked = 1) then
Exit;
level := ['lvl', 'level', 'Woodcut', 'Wcing', 'Wc', 'Woodcutting'];
laugh := ['Lol', 'Rofl', 'Lawl', 'Haha', 'funny', 'Lmao', 'Lmfao'];
noob := ['noob', 'Nub', 'N00b', 'Nooblet'];
Auto := ['macro', 'autoer', 'cheater', 'bot', 'autoing'];
greet := ['Hi', 'Hello', 'Hey', 'Sup', 'Howdy', 'Hiya'];
if (InChatArr(level)) then
begin
if (ChatMsg = 1) then
Exit;
case (Random(4)) of
0: TypeSend('My WC lvl is ' +
IntToStr(Players[CurrentPlayer].Integers[2]));
1: TypeSend('Wcing is ' + IntToStr(Players[CurrentPlayer].Integers[2]) +
' you?');
2: TypeSend('I have ' + IntToStr(Players[CurrentPlayer].Integers[2]) +
' wcing');
3: IntToStr(Players[CurrentPlayer].Integers[2])
end;
ChatMsg := 1;
JustTalked := 1;
Exit;
end;
if (InChatArr(laugh)) then
begin
if (ChatMsg = 2) then
Exit;
case (Random(6)) of
0: TypeSend('lol');
1: TypeSend('lawl');
2: TypeSend('rofl');
3: TypeSend('haha');
4: TypeSend('lmao');
5: TypeSend('lmfao');
end;
ChatMsg := 2;
JustTalked := 1;
Exit;
end;
if (InChatArr(Noob)) then
begin
if (ChatMsg = 3) then
Exit;
case (Random(4)) of
0: TypeSend('Your A Noob');
1: TypeSend('NubCake');
2: TypeSend('Nooob');
3: TypeSend('Nubz');
end;
ChatMsg := 3;
JustTalked := 1;
Exit;
end;
if (InChatArr(Auto)) then
begin
if (ChatMsg = 4) then
Exit;
case (Random(5)) of
0: TypeSend('im not bot');
1: TypeSend('haha bots are lame');
2: TypeSend('whos bot?');
3: TypeSend('macros are lame');
4: TypeSend('autoer?');
end;
ChatMsg := 4;
JustTalked := 1;
Exit;
end;
if (InChatArr(Greet)) then
begin
if (ChatMsg = 5) then
Exit;
case (Random(7)) of
0: TypeSend('hello');
1: TypeSend('hey');
2: TypeSend('wut up');
3: TypeSend('sup');
4: TypeSend('hiya');
5: TypeSend('how goes it');
6: TypeSend('whats up?');
end;
ChatMsg := 5;
JustTalked := 1;
Exit;
end;
Result := 1;
end;
procedure Responder;
//Credits & Love To Dans The Man for writing this.
var
LastChat: Integer;
begin
if not (Players[CurrentPlayer].booleans[1]) then
Exit;
LastChat := ChatMsg;
if (TimeFromMark(ChatTimed) > 39999 + RandomRange(-12999, 4999)) then
ChatMsg := 0;
ChatMsg := AutoResponder;
if (ChatMsg > LastChat) then
MarkTime(ChatTimed);
if (ChatMsg > 0) then
ReportVars[1] := ReportVars[1]
+ 1;
ChatMsg := 0;
end;
function Report(RR: String): boolean;
begin
WriteLn('Error:( ' + RR + ' )');
result := True;
end;
var
R: array [0..2] of RRecord;
LD, MN, Gas: Integer;
MaxWait, FalsePlayers: Integer;
Q: String;
const Version = '1.4.pub';
procedure PlayerReport;
var
I: Integer;
Active: String;
begin
For I := 0 to (HowManyPlayers - 1) do
begin
if (Players[i].Active) then Active := 'T' else Active := 'F';
WriteLn( (IntToStr(I))+' : '+Players[I].nick+ ' = '+
Active + '| Mined: '+IntToStr(Players[I].Integers[5]) + ' Ores| M lvl:' + IntToStr(Players[I].Integers[2]));
end;
case lowercase(Q) of
'iron':
begin
ReportVars[1] := ReportVars[1]
+28;
end;
'copper':
begin
ReportVars[0] := ReportVars[0]
+28;
end;
'tin':
begin
ReportVars[2] := ReportVars[2]
+28;
end;
end;
end;
procedure FullReport;
begin
WriteLn('Blumblebee''s PowerMiner Version ' + version);
WriteLn('_____________________________________________________');
WriteLn('Mined A Total Of ' + IntToStr(MN) + ' Ores');
WriteLn('Avoided ' + IntToStr(Gas) + ' Gas');
WriteLn('Completed ' + IntToStr(LD) +' Loads');
WriteLn('Ran For ' + TimeRunning);
WriteLn('_____________________________________________________');
PlayerReport;
SRLRandomsReport;
end;
function FindRandoms: Boolean;
begin
if FindFight then
RunAway('n', false, 1, 2500);
Result := FindNormalRandoms;
end;
procedure DeclarePlayers;
begin
SRLPlayerForm(True, ['Weild Pick', 'Use Responder'], ['Loads'], ['Rock Type'], []);
end;
procedure FBP;
var
pick: integer;
begin
if not (LoggedIn) then
Exit;
if TimeFromMark(pick) < 1500 then
Exit;
FindNormalRandoms;
MarkTime(pick);
if (FindBlackChatMessage('ou do not')) then
begin
Report('Your Pick Has been broken');
LogOut;
Players[CurrentPlayer].Active := False;
inc(FalsePlayers);
NextPlayer(Players[CurrentPlayer].Active);
end;
end;
var
TP: Tpoint;
function w_GasCheck(GP: TPoint): boolean; //Credits to Wizzup?
Var
x1, y1, x2, y2, I, time, c: Integer;
R, G, B: Integer;
H, S, L: ExtEnded;
X, Y, Z: ExtEnded;
Gas, Gas2: TPointArray;
Colors, C2: TIntegerArray;
begin
Try
GP.y := GP.y - 20; // gas is always ABOVE a rock.
x1 := GP.x - 35;
If x1 < 0 Then
x1 := 0;
y1 := GP.y - 35;
If y1 < 0 Then
y1 := 0;
x2 := GP.x + 35;
If x2 > 515 Then
x2 := 515;
y2 := GP.y + 35;
If y2 > 336 Then
y2 := 336;
Time := GetSystemTime;
Result := False;
c := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2ModIfiers(0.2, 0.2);
FindColorsTolerance(Gas, 8886170, x1, y1, x2, y2, 20);
ColorToleranceSpeed(c);
If length(Gas) < 10 Then
Exit;
Colors := GetColors(Gas);
C2 := Colors;
ClearSameIntegers(C2);
If Length(C2) < 40 Then // amount of diff colors.
Exit;
For I := 0 To High(Gas) Do
Begin
ColorToRGB(Colors[I], R, G, B);
If Abs(R - G) <= 10.0 Then
Begin
ColorToHSL(Colors[I], H, S, L);
If (H > 11.5) And (H < 16.0) And (S < 12.0) Then
Begin
ColorToXYZ(Colors[I], X, Y, Z);
If (Abs(X - Y) < 5.0) And (Abs(X - Z) < 5.0) And (Abs(Y - Z) < 5.0) Then
Begin
SetLength(Gas2, Length(Gas2) + 1);
Gas2[High(Gas2)] := Gas[I];
End;
End;
End;
End;
WriteLn('w_time: ' + IntToStr(GetSystemTime - Time));
WriteLn('w_gas2 length: ' + IntToStr(Length(Gas2)));
Result := (Length(Gas2) > 20); // The only number you might want to tweak.
If Result Then
Begin
WriteLn('w_GasCheck gave true');
WriteFileString(TheFile, '******** FOUND w_GAS RANDOM ********' +
Chr(13));
End;
Except WriteLn('w_gasCheck ERROR: No window selected'); End;
End;
procedure LoadRockRec;
var
A: String;
begin
try
LoadRockRecords;
begin
A := (Players[CurrentPlayer].strings[0]);
case LowerCase(A) of
'iron':
begin
R[0].Rocks := rimmington_Iron;
R[1].Rocks := rimmington_Iron;
R[2].Rocks := rimmington_Iron;
MaxWait := 6000;
Q := 'iron';
end;
'copper':
begin
R[0].Rocks := lumbridge_copper;
R[1].Rocks := rimmington_Copper;
R[2].Rocks := varrock_Copper;
MaxWait := 12000;
Q := 'copper';
end;
'tin':
begin
R[0].Rocks := lumbridge_tin;
R[1].Rocks := rimmington_Tin;
R[2].Rocks := rimmington_Tin;
MaxWait := 12000;
Q := 'tin';
end;
end;
end;
except end;
end;
procedure WhileMining;
var
C: Integer;
begin
if not (LoggedIn) then
Exit;
MarkTime(C);
begin
While (TimeFromMark(c) < MaxWait) do
begin
FindRandoms;
Wait(100+random(50));
AntiBan;
FBP;
FindPick;
Responder;
Wait(500+random(500));
if FindBlackChatMessage('anage') then
Exit;
end;
end;
end;
procedure MineRock;
var
B: Boolean;
H, X, Y: Integer;
begin
if not (LoggedIn) then
Exit;
FBP;
FindPick;
Responder;
FindRandoms;
try
For H:= 0 To 2 Do
begin
B := FindObjRock(X, Y, R[H].Rocks);
if B then Break;
end;
except end;
FBP;
FindRandoms;
Responder;
if B then
begin
if w_GasCheck(TP) or FindGas(X, Y) then
begin
MFF(MMCX + 2,MMCY , 5, 4);
Inc(Gas);
ReportVars[3] := ReportVars[3] + 1;
SendSRLReport;
SRLRandomsReport;
MMouse(random(MSX2),random(MSY2),5,5);
Status('Found Gas! Using wizzups gas checker');
FTWait(8+random(2));
exit;
end else
Case Random(2) of
0:
begin
Mouse(X, Y, 0, 0, False);
Wait(150+Random(100));
if (ChooseOption('ine')) then
end;
1: Mouse(X, Y, 0, 0, True);
end;
Wait(10+random(50));
Flag;
WhileMining;
end;
end;
procedure DropAllExcept(W : Array of Integer);
// Credits to SandStorm
var
i: Integer;
begin
if not (LoggedIn) then
Exit;
For I:=1 To 28 Do
if not(InIntArray(w, i)) then
DropItem(i);
end;
procedure DropOre;
begin
if not LoggedIn then Exit;
Status('Dropping Ore');
FindRandoms;
CountOre;
try
begin
if (Players[CurrentPlayer].booleans[0]) then
DropAll;
end;
if not (Players[CurrentPlayer].booleans[0]) then
begin
DropAllExcept([1]);
end;
Finally
Inc(LD);
Players[CurrentPlayer].Integers[6] := Players[CurrentPlayer].Integers[6]
+ 1;
FullReport;
SetRun(True);
except
end;
end;
function CountDTMs(DTM :integer) :integer;
var
n, r, m, g: integer;
slot: tbox;
begin
for n := 1 to 28 do
begin
if existsitem(n) then
begin
slot:= invbox(n);
if FindDTM(DTM,m,g,slot.x1,slot.y1,slot.x2,slot.y2) then inc(r);
end;
end;
Result := r;
end;
function CountOre: integer;
var
tempcount, tempcount2, OreDTM: integer;
X, Y: Integer;
begin
OreDTM := DTMFromString('78DA63CC636260D065644006F7EACC19FE036' +
'990E87F20602C01AA5142550391859140BA02A8C698809A78A01A' +
'53026AE2806AB408A8C904AAB1C2AF06009ACB0A4D');
Result := Result xor Result;
GameTab(4);
wait(100 + random(200));
if finddtm(OreDTM,x,y,MIx1,MIy1,MIx2,MIY2) then
begin
TempCount := CountDTMs(OreDTM);
Result := TempCount;
MN := MN + TempCount;
TempCount2 := CountDTMs(OreDTM);
Result := TempCount2;
Players[CurrentPlayer].Integers[5] := Players[CurrentPlayer].Integers[5]
+ TempCount2;
end;
freedtm(OreDTM);
end;
procedure SetScript;
begin
Smartsetup(SmartPrefix, true, true, false);
Settargetdc(smartgetdc);
AubTPA := CreateTPAFromText('isthin', UpChars);
SetupSRL;
Disguise('Powerminer rev' + Version);
DeclarePlayers;
end;
procedure PlayerStart;
begin
ActivateClient;
if not (LoggedIn) then
LogInPlayer;
if LoggedIn then
begin
SetAngle(True);
SetRun(True);
SetChat('On', 1);
SetChat('Friends', 2);
Wait(500 + Random(500));
PickCheck;
Wait(400 + Random(655));
Players[CurrentPlayer].integers[2] := GetSkillInfo('Mining', False);
WriteLn('Players Mining level is ' +
IntToStr(Players[CurrentPlayer].integers[2]));
gametab(4);
LoadRockRec;
end;
end;
procedure MainLoop;
begin
SetScript;
wait(500 + random (200));
PlayerStart;
repeat
repeat
repeat
Status('Mining ' + Players[CurrentPlayer].strings[0] + ' ore''s');
MineRock;
until InvFull;
If InvFull then
begin
DropOre;
end;
If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
Players[CurrentPlayer].Active := False;
If Not LoggedIn Then
Begin
Players[CurrentPlayer].Active := False;
inc(FalsePlayers);
PlayerStart;
end;
until(Players[CurrentPlayer].Integers[6] >= Players[CurrentPlayer].Integers[0]) or
(Players[HowManyPlayers - 1].Active = False);
begin
NextPlayer(True);
Players[CurrentPlayer].Integers[6] := 0;
PlayerStart;
end;
If AllPlayersInactive then Break;
until(False);
Report('All Players Inactive');
end;
procedure scriptterminate;
begin
disguise('Terminated.');
FullReport;
end;
begin
MainLoop;
end.
Blumblebees (CTI) PowerMiner
Type: PowerMiner
Date Released: December, 5, 2008
SCAR REV: 3.15b
SRL Rev: #28
Author: Blumblebee
{Version History}
1.0.[beta]:
'Initial Release, A Bit sketch, none the less works well. Iron is'
'only rock tested so far. Further testing Required.'
1.1.[beta]:
'Minor Tweaks Before Release. Bug Fixed, Progress Report Format Changed'
'Slightly. Overall, just made it more appealing.
1.2.[beta]:
'Released! Let the Leeching Begin!'
{Bug Report}
1.0.[beta]:
'Pick Axe head reattachment hasnt been added, thus this kills the'
'script. The FindGas procedure is not working as well as hoped.'
'(50-75% accurate)'
1.1.[beta]:
'Minor Tweaking/Bug Fixes before Release. Found a Bug with Tin Mining.'
'Script Will Mine Silver Ore, when powermining tin. Minor setback, but'
'problem none the less.'
{Other Notes}
1.0.[beta]:
'So Far, Script works well. Script will be released soon.'
1.1.[beta]:
'Found A Counting Error for the proggie reports that have been fixed.'
'Hopefully will be released now.'