SRL Archive - OSR Help

Anyone see the problem?


GREEN GIANT

2013-08-23 10:28:35

Hi guys,

Due to the fact that the built-in world switching isn't working I decided to make my own (very crude) world switcher.

Now i'm pretty sure you aren't monitored whilst logged out so i made it with no randomness to clicking, it basically generates random co-ordinates that correspond to the different servers and selects a world at random.

It works very well, but some worlds such as 308 and 316 are free worlds so i wanted to exempt them from the selection using the following;

begin
repeat
y := (81 + (RandomRange(0, 15) * 24)) // 81 is the midpoint Y of world 301, 0-15 are the rows, 24 is the distance between servers
x := (236 + (Random(3) * 93)) // 236 is the midpoint X of world 301, 0-3 columns, 93 is the distance between servers
Z := (X + Y)
until not
(z = 317) or // these are the added together coordinates x,y and correspond to worlds i do not wish to use
(z = 461) or
(z = 629)
end;
begin
Mouse(x, y, 0, 0, true);
end;
LogInPlayer;
end;

So it should (in theory) repeat generating random servers and if it generates one of the blacklisted ones it should get a new one, but this isn't the case, as its tried to log into world 308 a few times now :(

Can anyone see why?

Ian

2013-08-23 11:32:07

From: GREEN GIANT
Hi guys,

Due to the fact that the built-in world switching isn't working I decided to make my own (very crude) world switcher.

Now i'm pretty sure you aren't monitored whilst logged out so i made it with no randomness to clicking, it basically generates random co-ordinates that correspond to the different servers and selects a world at random.

It works very well, but some worlds such as 308 and 316 are free worlds so i wanted to exempt them from the selection using the following;

begin
repeat
y := (81 + (RandomRange(0, 15) * 24)) // 81 is the midpoint Y of world 301, 0-15 are the rows, 24 is the distance between servers
x := (236 + (Random(3) * 93)) // 236 is the midpoint X of world 301, 0-3 columns, 93 is the distance between servers
Z := (X + Y)
until not
(z = 317) or // these are the added together coordinates x,y and correspond to worlds i do not wish to use
(z = 461) or
(z = 629)
end;
begin
Mouse(x, y, 0, 0, true);
end;
LogInPlayer;
end;

So it should (in theory) repeat generating random servers and if it generates one of the blacklisted ones it should get a new one, but this isn't the case, as its tried to log into world 308 a few times now :(

Can anyone see why?

I think the issue is in your until statement. I've rewritten it like this and that makes it more clear which things it waits until.

begin
begin
repeat
y := (81 + (RandomRange(0, 15) * 24)); // 81 is the midpoint Y of world 301, 0-15 are the rows, 24 is the distance between servers
x := (236 + (Random(3) * 93)); // 236 is the midpoint X of world 301, 0-3 columns, 93 is the distance between servers
Z := (X + Y);
until not (z = 317) or (z = 461) or (z = 629); // these are the added together coordinates x,y and correspond to worlds i do not wish to use
end;
Mouse(x, y, 0, 0, true);
LogInPlayer;
end;

See the

until not (z = 317) or (z = 461) or (z = 629);

It's hard to tell what the not applies to like this, and I think it may only apply to the first z. Try replacing it with

until not ((z = 317) or (z = 461) or (z = 629));
That should make it apply to all your chosen z values.

GREEN GIANT

2013-08-23 12:12:46

Ahhh i see, that does make sense know that you have pointed it out. I'll try it out and see how it goes, but its a 3 in 60 chance of choosing an exempt world so i may have to wait to find out >.<

Ian

2013-08-23 12:27:58

From: GREEN GIANT
Ahhh i see, that does make sense know that you have pointed it out. I'll try it out and see how it goes, but its a 3 in 60 chance of choosing an exempt world so i may have to wait to find out >.<


just set this on repeat then copy and paste the debug to an new file and CTRL+F "317", "461", and "629" (without quotes)

begin
begin
repeat
y := (81 + (RandomRange(0, 15) * 24)); // 81 is the midpoint Y of world 301, 0-15 are the rows, 24 is the distance between servers
x := (236 + (Random(3) * 93)); // 236 is the midpoint X of world 301, 0-3 columns, 93 is the distance between servers
Z := (X + Y);
until not (z = 317) or (z = 461) or (z = 629); // these are the added together coordinates x,y and correspond to worlds i do not wish to use
end;
WriteLn(IntToStr(Z));
end;

GREEN GIANT

2013-08-23 13:28:26

From: BMWxi
just set this on repeat then copy and paste the debug to an new file and CTRL+F "317", "461", and "629" (without quotes)

begin
begin
repeat
y := (81 + (RandomRange(0, 15) * 24)); // 81 is the midpoint Y of world 301, 0-15 are the rows, 24 is the distance between servers
x := (236 + (Random(3) * 93)); // 236 is the midpoint X of world 301, 0-3 columns, 93 is the distance between servers
Z := (X + Y);
until not (z = 317) or (z = 461) or (z = 629); // these are the added together coordinates x,y and correspond to worlds i do not wish to use
end;
WriteLn(IntToStr(Z));
end;


Seems to check out :) Haven't had any problems since your appointed change so thankyou :D