Narcle
2007-11-05 00:09:59
Heres the low-down on why I call it "complex." For those that have never mined Runite at the Heros Guild its basically goes like this. You keep switching worlds looking for Runite to mine, then once you find a world with it you mine it then get the world number and time and mark it down. (at least i do) Then I find out the population of the world it was on and do a brief calculation in my head for the next respawn. example: 1500 people = ~18 mins, so then I put the time the next spawn should pop up. Then when that time rolls around I go back to the world and bam 2 more Runite.
Well I wanted to do this in a script so this is what I've come up with.
So far what I've done works well but I wanted to get some opinions and suggestions to help on some key areas.
Overall its the randoms that is getting me, and I have all of these antirandoms in, but not working well as far as I've seen.
Need help on:
1. Gas Finding
2. Pick finding
3. Infight runaway
4. better randoms check in general if possible
-Perhaps a better mining procedure.
Also I get a error on this line once in awhile:
" SpawnTime[CurrentWorldIs] := GetSystemTime+GetRuniteRespawnTime(CurrentWorldIs)*1000;"
in LogoutSeq and I'm not sure why yet. /sigh
Anything that would help would be really appreciated!
I left all the notes I had in it: -please keep this script in members only, as that is where I will have it later-
Well I wanted to do this in a script so this is what I've come up with.
So far what I've done works well but I wanted to get some opinions and suggestions to help on some key areas.
Overall its the randoms that is getting me, and I have all of these antirandoms in, but not working well as far as I've seen.
Need help on:
1. Gas Finding
2. Pick finding
3. Infight runaway
4. better randoms check in general if possible
-Perhaps a better mining procedure.
Also I get a error on this line once in awhile:
" SpawnTime[CurrentWorldIs] := GetSystemTime+GetRuniteRespawnTime(CurrentWorldIs)*1000;"
in LogoutSeq and I'm not sure why yet. /sigh
Anything that would help would be really appreciated!
I left all the notes I had in it: -please keep this script in members only, as that is where I will have it later-
//|
//| Script Name: Hero Guild Runite Miner [complex]
//| Category: Mining
//| Author: Narcle
//| Version: Starting Phase
//| SRL Version: 4.0 rev 6
//| Info: Mines Runite in Hero Guild, with smart world switching
//| Extras: The smart world switcher first starts out going to random member worlds
//| then as it gradually confirms runite on worlds, it marks the time, gets a
//| population count then calculates the next spawn time. When the count down
//| for the world pops up next in line, it will go to that world and wait for
//| runite respawn for 45 seconds.
//|_______________________________________________________________________________________________________________||
//|-------------------------------Instructions, Credits & Help info-----------------------------------------------||
//| Instructions:
//|
//| Credits:
//|
//| Help / Tests Needed:
//|
//|_______________________________________________________________________________________________________________||
{.include srl/srl.scar}
{.include SRL/SRL/misc/WorldSwitcher.scar}
{.include srl/srl/skill/mining.scar}
//
//CurrentWorld -Returns current world (while logged in)
//
//100% Done: Need a Population grabber
//80% Done: [complex] After time has be establish, be able to recognize this and log into
// the next world due for ore(else randomworld if timedue < 1min to next),
// WHILE ignoring and flagging those that pop up during that time to be inactive.
//75% Done: Random worlds perhaps? OR system, random would be better, if so after enough are
// established to stop picking random worlds and just mine current ones
//0% Done: Advance findgas, Has to work really well *sigh*
//
Var
SpawnTime: array[1..144] of integer;
RuniteMined,TRuniteMined,Minedit,CharStartTime:integer;
Const
//SRL - Stats
MySRLID = '';
MySRLPassword = '';
//Script Options:
//version info:
Version = '0.10';
ScriptName = 'HG Complex Runite Miner';
procedure DueOrRandom; forward;
function GetRuniteRespawnTime(World:integer):integer; forward;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
//----------------------------------------Player setup-------------------------------------------------------//
Players[0].Name :=''; //Character Name
Players[0].Pass :=''; //Character Pass
Players[0].Nick :=''; //Nickname 3 - 4 Letter's of char name
Players[0].Active:=True; //True if you want this player to be ran in the script, false if not
//----------------------------------------Player setup end---------------------------------------------------//
ScriptID := '438';//Don't change this!
SRLid:= MySRLId;
SRLpassword:= MySRLPassword;
Writeln(' _ _ _ ');
Writeln('| \ | | made by | | ');
Writeln('| \| | __ _ _ __ ___| | ___ ');
Writeln('| . ` |/ _` | __/ __| |/ _ \ v'+Version);
Writeln('| |\ | (_| | | | (__| | __/');
Writeln('|_| \_|\__,_|_| \___|_|\___|');
writeln('Start Time: '+TheTime)
if (MySRLID = '') then writeln('Please register at SRL-stats in the future. -Regards Narcle');
end;
Function RandomsCheck(Time: Integer): Boolean;
var
t: Integer;
begin
if time = 0 then
begin
if FindFight then
begin
Result := True;
RunTo('N', True);
Wait(15000 + random(5000));
Runback;
end;
FindPick;
FindNormalRandoms
exit;
end;
begin
for T := 1 to Time do
begin
Wait(200 + Random(50));
FindPick;
if FindTalk then
begin
Result := True;
FindNormalRandoms;
end;
end;
end;
end;
Procedure LookGas;
var x,y:integer;
begin
If FindGas(x, y) Then
begin;
RunTo('N', True);
Wait(10000 + Random(2000));
RunBack;
end;
end;
procedure PReport;
var
H,M,S:integer;
begin
TRuniteMined := TRuniteMined+RuniteMined
ConvertTime(gettimerunning, H, M, S);
Writeln('< Ran: ' + inttostr(H) + 'h:' + inttostr(M) + 'm:' + inttostr(S)+'s >--'+ScriptName+' v'+Version+'--< '+TheTime+' >');
writeln('Runite Mined: '+inttostr(TRuniteMined));
if (not(MySRLID = '')) then
begin//stat updates
ReportVars[0] := RuniteMined;
SendSRLReport;
end;
RuniteMined := 0;
CharStartTime := Getsystemtime;
end;
function MineRunite: Boolean;
var i,x,y, t:integer;
var RuniteColor: array [0..2] of integer;
begin
RuniteColor[0] := 10393450
RuniteColor[1] := 9012061
RuniteColor[2] := 10525292
for i := 0 to 1 do
for t := 0 to 2 do
begin
RandomsCheck(0);
If not(LoggedIn) then exit;
If (FindColorTolerance(x, y, RuniteColor[t], 5, 5, 500, 320, 15)) Then
begin
MMouse(x, y, 1, 1);
LookGas;
If IsUpText('Mine') then
begin
GetMousePos(x,y);
Mouse(x,y,1,1,True);
RandomsCheck(20);
FindColorTolerance(x, y, RuniteColor[t], 200, 118, 303, 218, 15);//So FindGas works.
MMouse(x,y,3,3);
result := true;
Repeat
LookGas;
RandomsCheck(1);
until (not(FindColorTolerance(x, y, RuniteColor[t], 150, 96, 350, 224, 15)))
Minedit := Minedit+1;
RuniteMined := RuniteMined+1;
end;
end;
end;
end;
function MineRuniteSeq: Boolean;
var StartRuniteTime:integer;
begin
StartRuniteTime := Getsystemtime;
HighestAngle;
MakeCompass('n');//change when i get best angle
repeat
MineRunite;
if Minedit >= 2 then
begin
result := true;
exit;
end;
RandomsCheck(2);
until (getsystemtime >= StartRuniteTime+45000)
if Minedit >=1 then result:= true else result:=false;
end;
//GetRuniteRespawnTime -Grabs population then calculates respawn time for next runite (in seconds)
//This will probably have to be updated alot depending how often Jagex changes their webpage.
function GetRuniteRespawnTime(World:integer):integer; //Works!
var
urlsource,text:string;
population:integer;
begin
urlsource := between('(m==0?"f>Free":"m>Members")+"</td>");','<div class="tandc">This',GetPage('http://www.runescape.com/slj.ws?order=WMLPA'));
if urlsource = '' then
begin
result := 1100;
writeln('Failed to get spawn time, result = 1100');
exit;
end;
population := strtoint(Between('",',',',Between('",',')', Between('e('+inttostr(world)+',', ';', urlsource))));
result := Ceil((population-4800)/-3.333);
end;
Procedure LogoutSeq(t:integer);//for t = 1 then world had runite else no.
var
CurrentWorldIs:integer;
begin
Minedit := 0;
if ((Getsystemtime-CharStartTime)/1000)>300 then PReport;
if t = 1 then
begin
CurrentWorldIs := CurrentWorld;
SpawnTime[CurrentWorldIs] := GetSystemTime+GetRuniteRespawnTime(CurrentWorldIs)*1000;
end;
Logout;
DueOrRandom;
loginplayer;
end;
function NextWorldIs: integer;//working far as i know
var
i:integer;
begin
for i := 1 to 144 do
begin
if (getsystemtime-55000 < SpawnTime[i]) and (SpawnTime[i] < getsystemtime+55000) then result := i else result := 0;
end;
end;
procedure DueOrRandom;//working
var
RN, WorldIs, TryTimes:integer;
begin
wait(500+random(300));
repeat
WorldIs := NextWorldIs;
if WorldIs > 0 then if SelectWorld(WorldIs) then exit;
begin
case random(64) of //2 and 120 re-added
1: RN:= 2; 2: RN:=6; 3: RN:=9; 4: RN:=12; 5: RN:=18; 6: RN:=22; 7: RN:=23; 8: RN:=24;
9: RN:=26; 10: RN:=27; 11: RN:=28; 12: RN:=31; 13: RN:=36; 14: RN:=39; 15: RN:=42; 16: RN:=44;
17: RN:=45; 18: RN:=46; 19: RN:=48; 20: RN:=53; 21: RN:=54; 22: RN:=56; 23: RN:=58; 24: RN:=59;
25: RN:=64; 26: RN:=65; 27: RN:=66; 28: RN:=69; 29: RN:=70; 30: RN:=71; 31: RN:=76; 32: RN:=77;
33: RN:=78; 34: RN:=79; 35: RN:=82; 36: RN:=83; 37: RN:=84; 38: RN:=88; 39: RN:=89; 40: RN:=91;
41: RN:=92; 42: RN:=97; 43: RN:=98; 44: RN:=99; 45: RN:=100; 46: RN:=103; 47: RN:=104; 48: RN:=110;
49: RN:=111; 50: RN:=112; 51: RN:=114; 52: RN:=115; 53: RN:=116; 54: RN:= 120; 55: RN:=121; 56: RN:=124;
57: RN:=129; 58: RN:=130; 59: RN:=131; 60: RN:=132; 61: RN:=137; 62: RN:=138; 63: RN:=143; 64: RN:=144;
end;
if SelectWorld(RN) then exit;
end;
TryTimes:= TryTimes+1;
wait(50);
until(TryTimes >= 10)
Writeln('Failed to get a world 10 times, script terminated.');
terminatescript;
end;
begin
setupsrl;
DeclarePlayers;
Repeat
if (not(loggedin)) then loginplayer;
if MineRuniteSeq then LogoutSeq(1) else LogoutSeq(0);
Until(false)
end.
