SRL Archive - OSR Help

Write a quick script


Cynic

2012-06-28 13:32:54

If it takes more than 5 min then don't bother.
I was wondering if someone could make a script that clicks on a color every 10 seconds.

Color:10145331

NKN

2012-06-28 14:13:28

Not a Hex color, find the normal color and I can do it.

wantonman

2012-06-28 14:31:13

why use hex? are you just saying hex to sound smart… if i am not mistaken any color is considered a hex in computer science… do you want to enter the hexadecimal value and have simba convert it to color or do you just simply want to find colors on the screen?




program color;

var
x,y:integer;

begin
findcolor(x,y,111111);

repeat

movemouse(x,y,5,5);
wait(100+random(100));
clickmouse2(x,y,5,5);

wait(20000);
until(false);
end.

//something like this?, i do think clickmouse2 is not properly set up but you /can catch my riff

Cynic

2012-06-28 14:52:55

From: wantonman
why use hex? are you just saying hex to sound smart… if i am not mistaken any color is considered a hex in computer science… do you want to enter the hexadecimal value and have simba convert it to color or do you just simply want to find colors on the screen?




program color;

var
x,y:integer;

begin
findcolor(x,y,111111);

repeat

movemouse(x,y,5,5);
wait(100+random(100));
clickmouse2(x,y,5,5);

wait(20000);
until(false);
end.

//something like this?, i do think clickmouse2 is not properly set up but you /can catch my riff


No. I work in hex. I just stumbled onto Simba today. What I want it to do is click on a certain color on the screen every 10 seconds.

Cynic

2012-06-28 15:03:38

If it takes more than 5 min then don't bother.
I was wondering if someone could make a script that clicks on a color every 10 seconds.

Color:10145331

litoris

2012-06-28 15:14:56

program ColorClick;
var
x, y : Integer;
begin
repeat
if FindColor(x, y, 10145331, 0, 0, 2000, 2000) then
ClickMouse(x, y, mouse_left);
Wait(10000);
until(false)
end;
This should do the job, you can change the 2000s with x and y dimensions of the screen, respectively.
BTW, you can use a hexadecimal color by putting a @ sign in front of it.

wantonman

2012-06-28 15:16:23

well its it very simple… though im not sure simba uses hex by default, what you would have to to is use the built in color chooser with simba and there are very simple functions…

they are

findcolor()
Movemouse()
ClickMouse()



program color;

var
x,y:integer;

begin
findcolor(x,y,10145331,0,0,800,600); // if this color isnt working use the color chooser above

repeat

movemouse(x,y);
clickmouse(x,y,1);

wait(20000); // this is the wait 10 seconds part adjust to your needs
until(false);
end.


in the findcolor function i set the search area to 800 by 600 but u can change that accordingly to suit your preferences…

putonajonny

2012-06-28 20:30:14

I think this is what you want, will search for the number by hex (it uses some of wantonman's code)

program color;
Const
Color = ''; //Put the hex of the colour here between the ''
var
x, y, W, H :integer;

Function HexToColor(Hex : String) : integer;
Var
R, G, B : integer;
begin

Result := -1;

if(Length(Hex) <> 6)then
exit;

R := HexToInt(Copy(Hex, 1, 2));
G := HexToInt(Copy(Hex, 3, 2));
B := HexToInt(Copy(Hex, 5, 2));

Result := RGBtoColor(R, G, B);

end;

begin
GetClientDimensions(W, H);
findcolor(x, y, HexToColor(Color), 0, 0, W - 1, H - 1);

repeat
movemouse(x, y);
WriteLn('Clicking mouse at point: '+ToStr(Point(x, y)));
clickmouse(x, y, mouse_Left);
wait(20000); // this is the wait 20 seconds part adjust to your needs (time is in msec)
until(false);

end.

Daniel

2012-07-02 02:05:31

lol @ you guise.


program ColourClicker;

const
TheColour = $FFFFFF; // Preceed with dollar sign ($) if in hex format.

var
P, Dimensions: TPoint;

begin
GetClientDimensions(Dimensions.X, Dimensions.Y);
ActivateClient;

repeat
if(FindColor(P.X, P.Y, TheColour, 0, 0, Dimensions.X - 1, Dimensions.Y - 1)) then
begin
MoveMouse(P.X, P.Y);
ClickMouse(P.X, P.Y, mouse_Left);
Sleep(10000);
end;
Until(IsKeyDown(VK_F2));
end.

Wrote in web browser, but should work. :)