realrune
2006-06-29 17:37:24
Here's an alternate idea about how to deal with randoms in a script…
The idea is too have 2 diff. scars running at the same time, to have one script as the 'main' script, and another one taking care of char switching and randoms. Kinda like this…
The idea is too have 2 diff. scars running at the same time, to have one script as the 'main' script, and another one taking care of char switching and randoms. Kinda like this…
program MinerMain;
{.include srl/srl.scar}
const OreColor = 0; // The Color of the Rock You're Mining.
const SecsToWait = 5; // Time to Wait While Mining.
procedure Communicate(s : string);
begin
SendInterSCARMessage('Control', S);
end;
function Received : string;
begin
result := ReadInterSCARMessage('Randoms');
end;
procedure Mine;
begin
if(FindObjMultiText(x, y, 'Min', 'ine', 'Rock', OreColor, 5))then
begin
Communicate('Mining Randoms');
if(Random(20) = 1)then
begin
Mouse(x, y, 3, 3, false);
ChooseOption(x, y, 'Mine');
end
Else
Mouse(x, y, 3, 3, true);
if FlagPresent then FFlag(10);
MarkTime(Mark);
repeat
wait(1);
until(IsChatMessage('You s')) or (TimeFromMark(Mark) >= 500);
MarkTime(Mark);
repeat
wait(1);
until(IsChatMessage('You m')) or (TimeFromMark(Mark) >= SecsToWait * 1000) or (LoggedIn = false);
end;
Communicate('Normal Randoms');
end;
procedure SetupScript;
begin
SetupSRL;
DeclarePlayers;
repeat
wait(100);
until(Received = 'Started');
Communicate('Started');
LoginPlayer;
Communicate('All Clear');
end;
begin
SetupScript;
repeat
Mine;
until(False);
end.
program RandomsHandler;
{.include srl/srl.scar}
{.include srl/srl/skill/mining.scar}
Const RunDirec = 'N' ; // Direction To Run When A Fight Is Found.
Var
S : string;
procedure Communicate(s : string);
begin
SendInterSCARMessage('Randoms', S);
end;
function Received : string;
begin
result := ReadInterSCARMessage('Control');
end;
procedure AntiRandoms;
begin
FindNormalRandoms;
if(FindFight)then
RunTo(RunDirec, true);
end;
procedure AntiMiningRandoms;
begin
AntiRandoms;
FindPick;
end;
procedure SetupScript;
begin
SetupSRL;
SetupSRLMining;
LampSkill := 'Mining';
Communicate('Started');
repeat
wait(100);
until(Received = 'Started');
Communicate('All Clear');
end;
begin
SetupScript;
repeat
S := Received;
Case S Of
'Normal Randoms' : AntiRandoms;
'Mining Randoms' : AntiMiningRandoms;
end;
wait(100);
if(NoPick)then
begin
NoPick := False;
Communicate('No Pick');
repeat
wait(1);
until(Received = 'New Pick');
Communicate('All Clear');
FindPickHeadColor;
end;
until(False);
end.