Hi, how do I make Simba pick random coordinates from a set of coordinates.
Lets say if I have points (1,1) (2,2) (3,3) (4,4) (5,5).
How do I make the script pick randomly two coordinates out of the 5 and click on the coordinates?
Hi, how do I make Simba pick random coordinates from a set of coordinates.
Lets say if I have points (1,1) (2,2) (3,3) (4,4) (5,5).
How do I make the script pick randomly two coordinates out of the 5 and click on the coordinates?
You can use a case.
Basically what you'd do (roughly :s):
Simba Code:program Coords;
{$i SRL/srl.simba}
procedure RandomCoords; //Your procedure for clicking the random coords.
begin
case Random(50) of
1..10: ClickStuff; //Change "ClickStuff, ClickOtherStuff" etc.
11..20: ClickOtherStuff; //To your coordinate clicking code.
21..30: ClickMoreStuff; //Read this guide on cases: http://villavu.com/forum/showthread.php?t=53840
31..40: ClickEvenMoreStuff;
41..50: LetUsClickMoar;
end;
end;
begin
SetupSRL;
RandomCoords; //Using it in mainloop.
end.
You can implement that sort of thing into your script. If you need any more help, please post.![]()
Ultimate Guide to Making a Superb Guide | Guide to the New Forum Layout | Guide to Simba's Features!
| Ranks and Cups | Info & Requirements!| Guide to Reputation! | Guide to Posting GOOD Bug ReportsCheck out the Ultimate Guide Directory! It contains every guide ever posted on the forums.
r:= RandomRange(1, 6);
Mouse(r, r, 0, 0, mouse_Left);
OR
TPA:= [Point(1,1), ....];
rTP:= TPA[Random(Length(TPA))];
Mouse(rTP.x, rTP.y, 0, 0, mouse_Left);
For the sake of it since I have 2 minutes to kill:
Mouse(TPA[Random(Length(TPA))].x, TPA[Random(Length(TPA))].y, 0, 0, mouse_Left);
(Just riwu's suggestion put on one line in case you dislike clarity in your scripts).
Hi, thanks for the reply guys. I tested out the first random function. Not sure if it worked or not, most likely I messed up somewhere. At least it's running...
Here is my code, please feel free to modify it for me...
Simba Code:Procedure FightKnight;
var
x, y:Integer;
begin
if FindColorSpiral(x, y, 3274237, 257, 341, 345, 409) and
FindColorSpiral(x, y, 8215631, 445, 332, 517, 384) then
begin
MoveMouse(x, y);
case Random(50) of
1..10: ClickMouse(316, 584, 1); //Change "ClickStuff, ClickOtherStuff" etc.
11..20: ClickMouse(448, 598, 1); //To your coordinate clicking code.
21..30: ClickMouse(316, 584, 1); //Read this guide on cases: http://villavu.com/forum/showthread.php?t=53840
31..40: ClickMouse(448, 598, 1);
41..50: ClickMouse(316, 584, 1);
end;
wait(15000)
MoveMouse(385, 603);
wait(500)
ClickMouse(385, 603, 1);
end;
end;
Not even sure how to even use
Simba Code:Mouse(TPA[Random(Length(TPA))].x, TPA[Random(Length(TPA))].y, 0, 0, mouse_Left);
edit: just noticed riwu posted pretty much the same thing. oppsSimba Code:Mouse(TPA[Random(Length(TPA))].x, TPA[Random(Length(TPA))].y, 0, 0, mouse_Left);
//wouldn't work as it would click on a mix of two tpa(s)
//this would click a random set of cords
TPA := [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)];
r := Random(Length(TPA));
Mouse(TPA[r].x, TPA[r].y, 0, 0 ,Mouse_Left);
I'm curious as to what you're using it for, maybe we could help you make something more efficient![]()
<TViYH> i had a dream about you again awkwardsaw
Malachi 2:3
There are currently 1 users browsing this thread. (0 members and 1 guests)