SRL Archive - Bugs

Tile Walking Using Improper Randomness


smurg

2010-11-19 01:59:55

I re-brought up the whole Mouse(); debacle after I found out that the random only adds and doesn't subtract. Well, some of the core functions were built with the randomness not going both ways, such as in WalkToTile. It does a Mouse() and only adds the randomness.

I'm guessing that isn't meant to only go in the positive, but be random in positive and negative while picking a spot on the MM.

If it was meant to be or I'm just wrong, then just delete the thread, thanks :).


{*******************************************************************************
Function WalkToTile(Tile: TPoint; Randomness, FlagD: Integer): Boolean;
By: Wizzup, TheGuyWhoGotOn, and Drags111
Description: Walks to the tile using minimap.
*******************************************************************************}
function WalkToTile(TheTile: TTile; Randomness, FlagD: Integer): Boolean;
var
wTile: TPoint;
t: Integer;
begin
Result := False;
TheTile := RandomizeTile(TheTile, Randomness, Randomness);
wTile := TileToMM(TheTile);
if not rs_OnMiniMap(wTile.X, wTile.Y) then
Exit;
Mouse(wTile.x, wTile.y, 1, 1, true);
Wait(RandomRange(80, 100));
t := getsystemtime;
if (FlagD = 0)then
begin
R_Flag;
end else
R_FFlag(FlagD);
Result := (GetSystemTime - t) < 60000;
end;

i luffs yeww

2010-11-19 02:14:22

"Not going to happen. You can use MouseBox if you have the entire box of the object? Or just subtract a default from the x and y. But do this only for your own mouse clicks and not for the SRL mouse function." - Wizzup?

Same rules apply here, really. If you want to have negative randomness just move the starting point back or change the "Mouse(X + RandomRange(-
10,10), Y + RandomRange(-10,10), 0, 0, False);" thing, it's the same thing.

Sorry.

smurg

2010-11-19 02:32:52

It's different though because the randomness you put in to WalkToTile() isn't the same as what comes out?

If you put in WalkToTile(Tile, 5, 0);

Then it will click with a:

+rx of 6
-rx of 5

+ry of 6
-ry of 5

Because of the Mouse() inside the function.

TomTuff

2010-11-19 02:39:58

From: smurg
It's different though because the randomness you put in to WalkToTile() isn't the same as what comes out?

If you put in WalkToTile(Tile, 5, 0);

Then it will click with a:

+rx of 6
-rx of 5

+ry of 6
-ry of 5

Because of the Mouse() inside the function.


which tile it clicks on is in the first few lines (RandomizeTile()). Then pixel randomness is added via Mouse.

smurg

2010-11-19 02:43:43

From: TomTuff
which tile it clicks on is in the first few lines (RandomizeTile()). Then pixel randomness is added via Mouse.


Ya, that's what I'm talking about.

Once it gets the tile, it has been randomized by your "randomness".

But when that tile goes into Mouse(), Mouse() only adds it's 1 random in the positive direction, not the negative.

TomTuff

2010-11-19 02:52:48

From: smurg
Ya, that's what I'm talking about.

Once it gets the tile, it has been randomized by your "randomness".

But when that tile goes into Mouse(), Mouse() only adds it's 1 random in the positive direction, not the negative.


so?

smurg

2010-11-19 03:19:20

From: TomTuff
so?


It's not doing explicitly what you call for in the function.

It's slightly off, but I'm just saying…

If you send a function to do a specific job, and it does something else (even though that something else is predictable), then that's a nuisance (because you have to remember the certain nitpick everytime).

TomTuff

2010-11-19 03:27:17

From: smurg
It's not doing explicitly what you call for in the function.

It's slightly off, but I'm just saying…

If you send a function to do a specific job, and it does something else (even though that something else is predictable), then that's a nuisance (because you have to remember the certain nitpick everytime).


maybe you just want it to do the wrong thing ;)

smurg

2010-11-19 03:53:37

From: TomTuff
maybe you just want it to do the wrong thing ;)


Well I just wrote a script tonight from scratch.

And I want it to walk into a small building, so I was putting in tight tolerances (rand: 1), but due to the error, it ends up doing random(2) in the pos x and y and only random(1) in the neg x and y.

Then I have to find a tile like 2/3 the way in the bottom left to click instead. :/

Bad Boy JH

2010-11-19 06:53:14

Smurg, are you sure you are using the correct tile?

Cstrike

2010-11-19 10:34:14

I always use WalkPath([Tiles]);
Even if you have one tile, I still use WalkPath([Tile(111,222)]);

smurg

2010-11-19 22:48:10

From: Bad Boy JH
Smurg, are you sure you are using the correct tile?


Yes I am. Just look at the function though…

From: cstrike
I always use WalkPath([Tiles]);
Even if you have one tile, I still use WalkPath([Tile(111,222)]);


This is fine; I haven't tried WalkPath yet but I like how I do my WalkToTile's.

Anyhow it doesn't matter because WalkPath uses the randoms improperly as well.

It does the Mouse(P.x, P.y, 1, 1, true); without regard for the negative randomness since Mouse only adds the randomness in the positive.

TomTuff

2010-11-21 05:33:17

From: smurg
Yes I am. Just look at the function though…



This is fine; I haven't tried WalkPath yet but I like how I do my WalkToTile's.

Anyhow it doesn't matter because WalkPath uses the randoms improperly as well.

It does the Mouse(P.x, P.y, 1, 1, true); without regard for the negative randomness since Mouse only adds the randomness in the positive.


There is nothing wrong, this is the way it was meant to work. Compensate for it with a different tile.

Bad Boy JH

2010-11-21 08:05:34

if you actually have a look at TileToMM…

A tile is 4 pixels the pixel you grab is the one with an X in this diagram
[ ][ ][ ][ ]
[ ][X][ ][ ]
[ ][ ][ ][ ]
[ ][ ][ ][ ]

The Mouse (X, Y, 1, 1, True) means it clicks any of the four centre pixels

I am going to test tomorrow, just out of curiosity…