decide
2007-12-16 16:35:09
This is my first script ever. Let me know what you think. Is it too sloppy? Are the randoms going to work? (mainly the gas one?) Any and all feedback please.
Edit:Come on 19 views no replies? Any feedback please, I want to know what to improve on.
Edit:Come on 19 views no replies? Any feedback please, I want to know what to improve on.
//Credits: Wizzup?'s - w_GasCheck
// Wt-Fakawi - FindFastRandoms;
program MorePowerMiner;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Mining.scar}
const
LoadsPerPlayer =10; //Amount of loads per player before switching.
RockColor = 2569302; //Add the color of the rock here.
WaitPerRock = 5000; //The time to wait while we are mining a rock in ms.(5000ms = 5 seconds)
RunAway = 'N'; // If in a fight, this is the direction you will run. (Choose N, S, E or W)
WaitAfter = 10000; //Amount of time to wait before coming back after a fight. (10000ms = 10 seconds)
Version = '1.0'; //This is for me to control the version number, please don't change.
var
clicks, loads, ran, chat, GasesHandled : integer;
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
(*----- Player 1 -----*)
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := ''; //3-4 lower case letters from your name DON'T use the first letter
Players[0].Integers[0]:= 0; //Leave at 0
Players[0].Active := True;
(*----- Player 2 -----*)
{Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := ''; //3-4 lower case letters from your name DON'T use the first letter
Players[1].Integers[0]:= 0; //Leave at 0
Players[1].Active := True;
(*----- Player 3 -----*)
Players[2].Name := '';
Players[2].Pass := '';
Players[2].Nick := ''; //3-4 lower case letters from your name DON'T use the first letter
Players[2].Integers[0]:= 0; //Leave at 0
Players[2].Active := True;}
Writeln(IntToStr(HowManyPlayers)+' Player(s).');
CheckUserNicks;
end;
procedure Signature;
begin
ClearDebug;
writeln(' ');
writeln(' ');
writeln(' MorePower Miner ver ' + Version + ' by: ');
writeln(' ____ _____ _____ __ ____ _____ ');
writeln(' | \ | ___|| __|| || \ | ___| ');
writeln(' | | )| ___|| |__ | || | )| ___| ');
writeln(' |____/ |_____||_____||__||____/ |_____| ');
writeln(' ');
wait(3000 + random(750));
end;
procedure Setup;
begin
HighestAngle;
SetRun(True);
end;
function FindFastRandoms: Boolean; //By Wt-Fakawi
var
i: Integer;
begin
for i := 1 to 12 do
begin
case I of
1: if FindDead then
Result := True;
2: if FindMod then
Result := True;
3: if FindMime then
Result := True;
4: if FindMaze then
Result := True;
5: if FindQuiz then
Result := True;
6: if FindDemon then
Result := True;
7: begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].loc := 'No GameTab';
Logout;
Exit;
end;
end;
8: begin
if InBlack then
begin
Result := True;
Players[CurrentPlayer].loc := 'InBlack';
Logout;
Exit;
end;
end;
9: begin
if FindFight then
begin
RunTo(RunAway, False);
Wait(WaitAfter + random(3000));
Runback;
Ran:=Ran+1;
end;
end;
10: if FindTalk then
Result := True;
11: if ClickToContinue then
Result := True;
end;
end;
end;
function w_GasCheck(gx, gy: integer): boolean;
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
x1 := gx - 35;
If x1 < 0 Then
x1 := 0;
y1 := gy - 35;
If y1 < 0 Then
y1 := 0;
x2 := gx + 35;
If x2 > 515 Then
x2 := 515;
y2 := gy + 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);
//writeln('w_Colors Length: ' + inttostr(length(colors)));
// writeln('w_C2 Length: ' + inttostr(length(C2)));
If Length(C2) < 40 Then
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) > 30); // The only number you might want to tweak.
//debugtpa(Gas2, '');
If Result Then
Begin
GasesHandled := GasesHandled + 1;
WriteLn('*** GAS FOUND ***');
End;
Except WriteLn('w_gasCheck ERROR: No window selected'); End;
End;
procedure DoAntiRandoms;
var
x, y : integer;
begin
FindTalk;
FindNormalRandoms;
FindFastRandoms;
FindLamp('mining');
FindPick;
if w_GasCheck(x, y) then
Wait(5000+Random(500));
end;
procedure AutoChat1;
var
ChatTime : Integer;
ChatInitiated : Boolean;
begin
if not ChatInitiated then
begin
if (InChatMulti('ell', 'yo', 'hi')) then
begin
Wait(500 + Random(500));
TypeSend('whats up?');
ChatInitiated := True;
MarkTime(ChatTime);
Chat:=Chat+1;
end;
end else
begin
if (TimeFromMark(ChatTime) >= 60000) then
begin
if (InChatMulti('llo', 'yo', 'hi')) then
begin
Wait(500 + Random(500));
TypeSend('whats up?');
MarkTime(ChatTime);
Chat:=Chat+1;
end;
end;
end;
end;
procedure AutoChat2;
var
ChatTime : Integer;
ChatInitiated : Boolean;
begin
if not ChatInitiated then
begin
if (InChatMulti('lvl', 'inin', 'evel')) then
begin
Wait(500 + Random(500));
TypeSend('why?');
ChatInitiated := True;
MarkTime(ChatTime);
Chat:=Chat+1;
end;
end else
begin
if (TimeFromMark(ChatTime) >= 60000) then
begin
if (InChatMulti('lvl', 'inin', 'evel')) then
begin
Wait(500 + Random(500));
TypeSend('why?');
MarkTime(ChatTime);
Chat:=Chat+1;
end;
end;
end;
end;
procedure AntiBan;
begin
DoAntiRandoms;
AutoChat1;
AutoChat2;
case Random(30) of
2: MouseBox(MSX1, MSY1, MSX2, MSY2, True);
4: HoverSkill('Random', False);
8: MouseBox(MMX1, MMY1, MMX2, MMY2, False);
15: BoredHuman;
20: HoverSkill('Mining', False);
27: PerfectNorth;
29: RandomRClick;
30: SleepAndMoveMouse(600000+random(300000));
end;
end;
procedure MineRock;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindColorSpiralTolerance(x, y, RockColor, 5, 5, 512, 334, 4) then
MMouse(x, y, 2, 2);
if GetUpText = 'ock' then
wait(100+random(50));
Mouse(x,y,1,1,true);
Wait(WaitPerRock+random(100));
AntiBan;
Clicks:=Clicks+1;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin
Logout;
Exit;
end;
until(InvFull);
end;
procedure Drop;
begin
DropToPosition(2, 28);
Loads:=Loads+1;
if Loads mod LoadsPerPlayer = 0 then
begin
NextPlayer(True);
end;
end;
procedure ProgressReport;
begin
ClearDebug;
Writeln('------------->MorePower Miner ver ' + Version + '<------------');
Writeln('---------------->by: decide<---------------');
Writeln('-------------------------------------------');
Writeln(' Time Ran: ' + TimeRunning + ' ');
Writeln(' Mined ' + IntToStr(Clicks) + ' Rock(s)' + ' ');
Writeln(' Completed ' + IntToStr(Loads) + ' Load(s)' + ' ');
Writeln(' Avoided ' + IntToStr(Ran) + ' Fight(s)' + ' ');
Writeln(' Handled ' + IntToStr(GasesHandled) + ' Gas(es)' + ' ');
Writeln(' Responded ' + IntToStr(chat) + ' Time(s) to Players' + ' ');
Writeln('-------------------------------------------');
end;
begin
SetupSRL;
DeclarePlayers;
Signature;
if LoggedIn then Logout;
LoginPlayer;
Setup;
repeat
MineRock;
Drop;
ProgressReport;
if not Loggedin then NextPlayer(False);
until false
end.