SRL Archive - Help and Support

Remembering Worlds & Sorting Them


PatDuffy

2012-01-29 21:59:50

I decided to make a rune-miner with world switching, but with a procedure to remember the respawn times for each world where rune was mined.

I'm really just in the planning stage for this part of the script, the rest of the spine is done, I just need world-switching. My current thoughts were to store store the world number in an Integer Array…but then how would I check the time remaining for the set world? I would need a system to compare the number of the world itself so I can call it later to hop to compared with the remaining time before the runite respawns..

So basically, how would it be best/easiest for one go about comparing such things.

Usa

2012-01-29 22:54:35

while timerIsNotUp() {
mineRune();
}

timerIsNotUp method loops through an array of miningTime objects (which hold the time and the world) comparing the time in seconds (started after the rock was mined) to the current time. If less than 30 seconds left, start world hopping procedures, update the array by removing/updating the miningTime object, etc.

kitchenrange

2012-01-30 00:40:10

You can record a type called say Worlds. In this type you can store attributes such as Worlds.Number and Worlds.TimeLeft and Worlds.Ready

PatDuffy

2012-01-30 15:14:48

From: kitchenrange
You can record a type called say Worlds. In this type you can store attributes such as Worlds.Number and Worlds.TimeLeft and Worlds.Ready


Ill look into that, it sounds what I need. I've never used anything like that before so this is a helpful learning experience.

putonajonny

2012-01-30 17:07:53

Var
Worlds, Times : TIntegerArray;
WorldUsed : TBooleanArray;

Function WorldToArrayNo(World : integer) : integer; //I'll explain what this procedure does in a sec
Var
i : integer;
begin
for i := 0 to high(Worlds) do
begin
Result := i;
if(World = Worlds[i]) then
exit;
end;
end;

Procedure WorldSwitch;
Var
i : integer;
begin
MarkTime(Worlds[WorldToArrayNo(CurrentWorld)]) //Marks the time that it is exiting the current world (for future logging in)
for i := 0 to high(Worlds) do //Goes through each of the worlds
begin
if(WorldUsed[i]) then //Checks if it has been there before
begin //if it has
if(TimeFromMark(Worlds[i]) > RespawnTime) then //then it checks how long it was since it last went there
break; //if it is over the "RespawnTime" then it stops checking
end;
end; //if none of the worlds meet this criteria it will just log into the last world, which isn't really a problem

LoginToWorld(Worlds[i]); //Or whatever the function is called, it logs into that one
WorldUsed[i] := True; //Then marks it that it has used that world

end; // it gets on with mining :)

(*The procedure above is just a way of converting between the actual world numbers and their position in the array*)

Help? if so then rep me :)