Log in

View Full Version : Marking time



Cstrike
07-10-2010, 06:59 PM
I'm making a new revolutionary script, a rune miner that will get a full load, bank (only a few spots for this though) and then return.

My problem is I don't know how to make a script read time and reset every 20 minutes. I have the code I need to mine, and the code to bank... but I don't know how to make it for example:

COMMENTS ARE STUFF I DONT KNOW HOW TO DO

Log into new world
record world as 'no ore' or 'ore found'
// store world if ore found after mining it -- use array?
// mark time X for world Y
//go to next world
Log in, repeat
// At ~20 minutes, restart cycle knowing ore is still there because of accuracy usually of time


Of course it's not flawless (ex: someone could mine your rock slightly before you come back...etc
But it's a start.

What commands should I get used to? is this possible? Thakns

Frement
07-10-2010, 07:02 PM
TimeFromMark() MarkTime()

Sabzi
07-10-2010, 08:15 PM
http://runescape.wikia.com/wiki/Runite_ore
Check out the respawn rate, it might help making the script better.

Shuttleu
07-10-2010, 08:35 PM
use a TIntegerArray for the worlds.
use something like this

procedure AddWorld(WorldNum: Integer; var WorldList: TIntegerArray);
begin
SetArrayLength(WorldList, Length(WorldList)+1);
WorldList[High(WorldList)]:= WorldNum;
end;

or use that to add the world to the list.

like it has been said above
use MarkTime and TimeFromMark for the timing
use something similar to above for keeping track of which world has which time

so WorldList[4] could equal 76
and when you mine ore on world 76 you can set WorldTime[4] to MarkTime

for detecting whether a world has been past 20 mins you can do something like this

function DetectWorldReady(WorldList, WorldTime: TIntegerArray): Integer;
var
i: Integer;
begin
Result:= 0;
for i:=0 to High(WorldTime) do
if (TimeFromMark(WorldTime[i])=>1200000) then
begin
Result:= WirldList[i];
Exit;
end;
end;

once again you could use that functions

~shut

EDIT: just made another function, run the function when you finish mining a world, and if the world is already on the list then it will reset the timer, if it is not then it will add the world number and set the time

procedure SetWorldTime(TheWorld: Integer; var WorldList, WorldTime: TIntegerArray);
var
i: Integer;
begin
for i:=0 to High(WorldList) do
if (TheWorld = WorldList[i]) then
begin
MarkTime(WorldTime[i]);
Exit;
end;
SetArrayLength(WorldList, Length(WorldList)+1);
SetArrayLength(WorldTime, Length(WorldTime)+1);
WorldList[High(WorldList)]:= WorldNum;
MarkTime(WorldTime[High(WorldTime)]);
end;