SRL Archive - OSR Help

Question for advanced scripters.


wazzzup

2012-03-21 05:07:31

This is completely optional for my script but I was wondering if anyone could point me in the right direction as to designing a function that either:

1. Remembers the last time I was on a world and doesn't go back to it for X amount of minutes.
(that would be the easiest)

2. Remembers the last time I was on a world but doesnt go back for X amount of minutes BASED on how many players were on that world.

Example: 1800 people on that world would go back to it in 12 mins.
If there was 300 people it wouldn't go back for 25 mins.

Harry

2012-03-21 05:23:36

Make an array of all the worlds, and write the time it was last on it to the array.

eska

2012-03-21 05:32:19

make a type with a 3 integer in it, one to store the world number, one to store the number of player and another one to store the time it was last visited.

Then, make an array of that type to store all the world and there "last visited" timer.
Finaly sort the array using a function that calculate the respawn time of the ores (I'm guessing this is for runite ore) and place them in the order you should revisit them

Then once you have enough worlds you can loop through all of them undefinetely in order of priority.

Edit: Added some more information

wazzzup

2012-03-21 05:36:53

Thanks, It seems a little advanced at the moment but I will continue doing research :D
It's nice to know it's possible.

Er1k

2012-03-21 07:05:19

Do you need that information to persist across script restarts? If yes, you also need to look into file handling. Otherwise Harry's solution would suffice in general.

wazzzup

2012-03-21 14:23:11

From: Er1k
Do you need that information to persist across script restarts? If yes, you also need to look into file handling. Otherwise Harry's solution would suffice in general.


No it doesn't have to, Harry's solution looks fine, I just need to figure out how to do it lol.

Sex

2012-03-21 14:34:17

This doesn't seem advanced to me, one sec.

Edit: Harry explained it fine..?

x[Warrior]x3500

2012-03-21 15:06:22


program new;
{$I SRL/SRL.simba}

type world = record
totalPlayers, timeLoggedOut: integer; // you can even add world number if you want
end;

var
worldList: array[0..100] of world; // just randomly using 0-100. idk how many p2p worlds there are
startTime: integer; // use this to mark the time when u started (thus knowing which worlds you were last at, etc. lower the timLoggedOut number, the longer u have NOT been to that world)

procedure setupWorldList(); // just sets everything to 0
var
i: integer;
begin
for i:=0 to 100 do // or high(worldList)
begin
worldList[i].timeLoggedOut:=timeFromMakr(startTime);
worldList[i].totalPlayers:=0;
end;
end;

begin
Smart_Server := 10;
setupsrl;
marktime(startTime);
setupWorldList();
end.

that can save each variable and its elements easily.

wazzzup

2012-03-21 15:56:45

From: x[Warrior]x3500

program new;
{$I SRL/SRL.simba}

type world = record
totalPlayers, timeLoggedOut: integer; // you can even add world number if you want
end;

var
worldList: array[0..100] of world; // just randomly using 0-100. idk how many p2p worlds there are
startTime: integer; // use this to mark the time when u started (thus knowing which worlds you were last at, etc. lower the timLoggedOut number, the longer u have NOT been to that world)

procedure setupWorldList(); // just sets everything to 0
var
i: integer;
begin
for i:=0 to 100 do // or high(worldList)
begin
worldList[i].timeLoggedOut:=timeFromMakr(startTime);
worldList[i].totalPlayers:=0;
end;
end;

begin
Smart_Server := 10;
setupsrl;
marktime(startTime);
setupWorldList();
end.

that can save each variable and its elements easily.


Yeah this looks sick, I will look at the code carefully and get it implemented!