SRL Archive - Help

Script Help


omgbeans

2011-01-09 15:21:34

I'm trying to make a script where it searches for a color and clicks it. Any ideas how to do this? Its for this game called world of tanks.

This is what I have but its not working

program Colour;

var
x, y : integer;
begin
If FindColor(x, y, 59751, 0, 0, 1276, 776) Then
begin
movemouse(x, y);
clickmouse(x, y, true);
end;
end.


any thoughts? I want it to click on this red "battle" button.


**BANNED The Man

2011-01-09 15:32:44

include SRL
do MMouse(blah)
Mouse(blah)
You can find mouse functions in the Mouse.scar file

-Boom

omgbeans

2011-01-09 15:48:15

what do you mean include srl? And I cant find a mouse file.

**BANNED The Man

2011-01-09 15:54:15

You have Simba right?
Go to view > Extensions.
Enable SRL.sex.
Now here is what your script should look like:
program Colour;
{$i srl/srl.scar}

var
x, y : integer;
begin
If FindColor(x, y, 59751, 0, 0, 1276, 776) Then
begin
MMouse(x, y, 1, 1);
GetMousePos(x, y);
Mouse(x, y, 1, 1, True;
end;
end.

Something like that :)

omgbeans

2011-01-09 15:55:27

what is simba? I am using scar.

**BANNED The Man

2011-01-09 15:59:34

From: omgbeans
what is simba? I am using scar.

Download Simba, it is the new program here :)

-Boom

omgbeans

2011-01-09 16:02:16

Where can i find it? I thought this is the scar forums?

**BANNED The Man

2011-01-09 16:04:42

Come on man, just searching Download Simba comes up with it…
This is the SRL forums

-Boom

omgbeans

2011-01-09 16:11:19

ok well the script is still not working and all you did was get me to use simba.

**BANNED The Man

2011-01-09 16:14:00

Well what isn't working?
Is it not compiling…?
Is it not finding the colour or what?

omgbeans

2011-01-09 16:16:13

It's not compiling now in simba. Before in SCAR it would compile but not find the color or move the mouse.

**BANNED The Man

2011-01-09 16:17:45

Ok… So what does the debug say?

-Boom

3Garrett3

2011-01-09 16:19:55

We can read minds. Help us out. Post the script, the error, and then we can help fix it :)

omgbeans

2011-01-09 16:21:42

On the original script at the top there is no error. It said it completed but the script does nothing.

On his script that he posted this is the error

Error] (10:7): Unknown identifier 'MMouse' at line 9

**BANNED The Man

2011-01-09 16:23:40

run this:
program Colour;

var
x, y : integer;
begin
If FindColor(x, y, 59751, 0, 0, 1276, 776) Then
begin
writeln('Found colour');
movemouse(x, y);
clickmouse(x, y, true);
end;
end.

omgbeans

2011-01-09 16:26:22

From: Dynamite
run this:
program Colour;

var
x, y : integer;
begin
If FindColor(x, y, 59751, 0, 0, 1276, 776) Then
begin
writeln('Found colour');
movemouse(x, y);
clickmouse(x, y, true);
end;
end.


that doesnt work it gives this error.

[Error] (11:23): Type mismatch at line 10


All i want it to do is this

1. Search for color
2. move mouse to color
3. left click

Edit: ok that compiles in scar but it doesnt do anything.

Frement

2011-01-09 16:35:01

program Color;
{$I SRL/SRL.scar}

var x, y: Integer;

begin
SetupSRL;
if FindColor(x, y, 59751, 0, 0, 1276, 776) then begin
Writeln('Found color!');
Mouse(x, y, 1, 1);
end;
FreeSRL;
end.

That should work in Simba.

**BANNED The Man

2011-01-09 16:36:47

From: omgbeans
that doesnt work it gives this error.



All i want it to do is this

1. Search for color
2. move mouse to color
3. left click

Edit: ok that compiles in scar but it doesnt do anything.


Then it isn't finding your colour.

TomTuff

2011-01-09 16:38:13

From: Frement
program Color;
{$I SRL/SRL.scar}

var x, y: Integer;

begin
SetupSRL;
if FindColor(x, y, 59751, 0, 0, 1276, 776) then begin
Writeln('Found color!');
Mouse(x, y, 1, 1);
end;
FreeSRL;
end.

That should work in Simba.


If it isn't finding your color, it won't say "Found color!" in the debug box when you use this.

omgbeans

2011-01-09 16:40:53

then i get this error
Exception in Script: Unable to find file 'SRL/SRL.scar' used from ''


and im not even sure this line is right
FindColor(x, y, 59751, 0, 0, 1276, 776)


This is the color I want to find "597, 51"

From: TomTuff
If it isn't finding your color, it won't say "Found color!" in the debug box when you use this.


in scar it doesnt do anything except say "script run succesfull"

also i want this to keep going until i hit a button like "F8" or something

**BANNED The Man

2011-01-09 16:44:17

From: omgbeans
then i get this error

and im not even sure this line is right

This is the color I want to find "597, 51"


Note Frement said Simba.
With the one I posted, what you reported means that your colour wasn't found, meaning you need to find a new colour.

Frement

2011-01-09 16:45:07

You must enable the SRL extension, View -> Extensions, then click SRL.sex and tick the "Enable" box.

After that it should update your SRL to the latest version, and then you compile the script.

Now you need to get the color. For that I suggest using 2041538.

EDIT: Test this:
program Color;
{$I SRL/SRL.scar}

var x, y: Integer;

begin
SetupSRL;
if FindColor(x, y, 2041538, 0, 0, 1200, 300) then begin
Writeln('Found color!');
Mouse(x, y, 1, 1);
end else begin
Writeln('Warning, color not found!');
end;
FreeSRL;
end.

omgbeans

2011-01-09 16:46:03

From: Dynamite
Note Frement said Simba.
With the one I posted, what you reported means that your colour wasn't found, meaning you need to find a new colour.


ignore this line

findColor(x, y, 59751, 0, 0, 1276, 776)


this is the color i want to find "597, 51" how would i write that in?

**BANNED The Man

2011-01-09 16:46:03

From: Frement
You must enable the SRL extension, View -> Extensions, then click SRL.sex and tick the "Enable" box.

After that it should update your SRL to the latest version, and then you compile the script.

Now you need to get the color. For that I suggest using 2041538.


He is using Scar Frement.

3Garrett3

2011-01-09 16:47:10

From: omgbeans
ignore this line



this is the color i want to find "597, 51" how would i write that in?


Those are coordinates, in the brackets. You want the colour before that. It will say colour picked 10230942354 at (134, 342) with real numbers and not that exact quote.

Frement

2011-01-09 16:47:30

From: Dynamite
He is using Scar Frement.


But I'm saying no to that, he must download Simba, I dislike SCAR, and I refuse to teach someone how to use SCAR, instead, I instruct to use Simba ;)

omgbeans

2011-01-09 16:49:59

I have simba but Where do I put it? In the scar folder? and how woul this look typed out if i used that as a color ignore my previous line with those coordinates.

ok i got it to move the mouse there but it wont click. Also How would i make this loop unless i hit "F8"

Frement

2011-01-09 16:51:04

From: omgbeans
I have simba but Where do I put it? In the scar folder? and how woul this look typed out if i used that as a color ignore my previous line with those coordinates.


I already gave you exact example:
program Color;
{$I SRL/SRL.scar}

var x, y: Integer;

begin
SetupSRL;
if FindColor(x, y, 2041538, 0, 0, 1200, 300) then begin
Writeln('Found color!');
Mouse(x, y, 1, 1);
end else begin
Writeln('Warning, color not found!');
end;
FreeSRL;
end.

**BANNED The Man

2011-01-09 16:51:44

From: Frement
But I'm saying no to that, he must download Simba, I dislike SCAR, and I refuse to teach someone how to use SCAR, instead, I instruct to use Simba ;)


Thats what I said.

omgbeans, look at the how to install simba then come back :)

omgbeans

2011-01-09 16:59:46

ok well thanks for the help so far then

Gu3st...

2011-01-09 17:02:29

Why can't you just use some coords to click the button?

Frement

2011-01-09 17:03:43

From: Zyt3x
Why can't you just use some coords to click the button?


Now thats not good practice is it? ;)

Hugolord

2011-01-09 17:06:05

You simply have to download simba, install it, and enable/update the extensions Frement instructed you to. After that, run his script. If this does not work tell us clearly why it doesn't or where it got stuck.

omgbeans

2011-01-09 17:22:25

I have simba but theres no instructions where to install it. I looked at view and opened extensions and its blank.

This works in scar and keeps running until i hit F8 but it wont keep clicking the color.

program Colour;

var
x, y : integer;
begin
If FindColor(x, y, 1781462, 604, 63, 1276, 776) Then
begin
writeln('Found colour');
movemouse(x, y);
wait (1000);
clickmouse(x, y, true);
repeat;
until isFKeyDown (8);
end;
end.

**BANNED The Man

2011-01-09 17:26:05

program Colour;


var

x, y : integer;

begin

If FindColor(x, y, 1781462, 604, 63, 1276, 776) Then
Repeat
begin

writeln('Found colour');

movemouse(x, y);

wait (1000);

clickmouse(x, y, true);

until isFKeyDown (8);

end;

end.

omgbeans

2011-01-09 17:35:53

From: Dynamite
program Colour;


var

x, y : integer;

begin

If FindColor(x, y, 1781462, 604, 63, 1276, 776) Then
Repeat
begin

writeln('Found colour');

movemouse(x, y);

wait (1000);

clickmouse(x, y, true);

until isFKeyDown (8);

end;

end.


that doesnt work in SCAR.

I downloaded and installed Simba and I get this error now

[Error] (11:22): Invalid number of parameters at line 10


when using this code


program Color;
{$I SRL/SRL.scar}

var x, y: Integer;

begin
SetupSRL;
if FindColor(x, y, 1781462, 604, 63, 1276, 776) then begin
Writeln('Found color!');
Mouse(x, y, 1, 1);
end else begin
Writeln('Warning, color not found!');
end;
FreeSRL;
end.

**BANNED The Man

2011-01-09 17:44:48

Do begin repeat if findcolor begin
IN SIMBA!

omgbeans

2011-01-09 17:51:53

program Colour;


var

x, y : integer;

begin

If FindColor(x, y, 1781462, 604, 63, 1276, 776) Then
Repeat
begin

writeln('Found colour');

movemouse(x, y);

wait (1000);

clickmouse(x, y, true);

until isFKeyDown (8);

end;

end.


this doesnt work in simba either

[Error] (21:23): Type mismatch at line 20


it says this line is wrong

clickmouse(x, y, true);

MylesMadness

2011-01-09 18:30:09

For simba
program Colour;
var
x, y : integer;

begin
If FindColor(x, y, 1781462, 604, 63, 1276, 776) Then
Repeat
begin
writeln('Found colour');
movemouse(x, y);
wait (1000);
clickmouse(x, y, 0);
end;
until IsKeyDown(119);//isFkeyDown(8) in simba
end.

omgbeans

2011-01-09 18:40:12

From: MylesMadness
For simba
program Colour;
var
x, y : integer;

begin
If FindColor(x, y, 1781462, 604, 63, 1276, 776) Then
Repeat
begin
writeln('Found colour');
movemouse(x, y);
wait (1000);
clickmouse(x, y, 0);
end;
until IsKeyDown(119);//isFkeyDown(8) in simba
end.


thanks that works. The only problem I have now is it wont click the button hard enough to get it to do the action that happens after the button is clicked.

Gu3st...

2011-01-09 18:45:17

IsKeyDown(119);
while not IsKeyDown(199) do
begin
if FindColor(x, y, 1781462, 604, 63, 1276, 776) then
begin
WriteLn('Found color!');
MoveMouse(X, Y);
Wait(100);
HoldMouse(X, Y, True);
Wait(100);
ReleaseMouse(X, Y, True);
end;
end;

omgbeans

2011-01-09 19:04:51

From: Zyt3x
IsKeyDown(119);
while not IsKeyDown(199) do
begin
if FindColor(x, y, 1781462, 604, 63, 1276, 776) then
begin
WriteLn('Found color!');
MoveMouse(X, Y);
Wait(100);
HoldMouse(X, Y, True);
Wait(100);
ReleaseMouse(X, Y, True);
end;
end;


thanks

it gives me an error on this line

[Error] (14:26): Type mismatch at line 13


and is this how its suppose to look?


program Colour;
var
x, y : integer;
begin
IsKeyDown(119);
while not IsKeyDown(199) do
begin
if FindColor(x, y, 1781462, 604, 63, 1276, 776) then
begin
WriteLn('Found color!');
MoveMouse(X, Y);
Wait(100);
HoldMouse(X, Y, True);
Wait(100);
ReleaseMouse(X, Y, True);
end;
end;
end.

Gu3st...

2011-01-09 19:26:45

You're using simba now? Then replace "True" in HoldMouse() and ReleaseMouse() with "mouse_Left"

Dgby714

2011-01-09 19:28:52

program Colour;

var
x, y: integer;

begin
repeat
if (FindColor(x, y, 1781462, 604, 63, 1276, 776)) Then
begin
WriteLn('Found Colour!');
MoveMouse(x, y);
Wait(1000);
HoldMouse(x, y, mouse_Left);
Wait(100);
ReleaseMouse(x, y, mouse_Left);
end;
until (IsKeyDown(VK_F8));
end.

omgbeans

2011-01-09 19:39:36

now it wont find the color anymore after running the script over and over

Frement

2011-01-09 20:00:06

You could try FindColorTolerance?

Dgby714

2011-01-09 20:09:02

program Colour;

var
I, x, y: integer;

begin
repeat
for I := 0 to 10 do
if (FindColorTolerance(x, y, 1781462, 604, 63, 1276, 776, I)) Then
begin
WriteLn('Found Colour!');
MoveMouse(x, y);
Wait(1000);
ClickMouse(x, y, mouse_Left);
end;
until (IsKeyDown(VK_F8));
end.

Frement

2011-01-09 20:15:43

Not everything needs spoon feeding Dgby :(

omgbeans

2011-01-09 20:21:37

Ok that seems to fix the issue of pressing the button as well as finding the color. What does the 1 through 10 mean just the tolerance level? Like 10 is more intensive?

TomTuff

2011-01-09 20:29:17

From: omgbeans
Thanks for all the help. It still wont press down on the button though.


Then the game has an anti-cheat engine. Have fun.

omgbeans

2011-01-09 20:34:26

I dont think it has anti cheat.

TomTuff

2011-01-09 20:38:33

Then try this

program Colour;
{$i SRL\SRL.scar}

var
I, x, y: integer;

begin
repeat
for I := 0 to 10 do
if (FindColorTolerance(x, y, 1781462, 604, 63, 1276, 776, I)) Then
begin
Mouse(x, y, 0, 0, True);
Break;
end;
until (IsKeyDown(VK_F8));
end.

Daniel

2011-01-10 05:00:48

Why are you telling him to download and use SRL when there is absolutely no need, as it will just make it take longer to compile?

Gu3st...

2011-01-10 10:58:08

And why are you guys looping through tolerance? Just do tolerance 10

tom99

2011-01-10 13:36:01

Is the button on the same position all the time ? do you want to hit it once it apear ?