View Full Version : Script Help
omgbeans
01-09-2011, 08:21 PM
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.
http://img.photobucket.com/albums/v323/Keitoussai/World%20of%20Tanks/shot_001.jpg
**BANNED The Man
01-09-2011, 08:32 PM
include SRL
do MMouse(blah)
Mouse(blah)
You can find mouse functions in the Mouse.scar file
-Boom
omgbeans
01-09-2011, 08:48 PM
what do you mean include srl? And I cant find a mouse file.
**BANNED The Man
01-09-2011, 08:54 PM
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
01-09-2011, 08:55 PM
what is simba? I am using scar.
**BANNED The Man
01-09-2011, 08:59 PM
what is simba? I am using scar.
Download Simba, it is the new program here :)
-Boom
omgbeans
01-09-2011, 09:02 PM
Where can i find it? I thought this is the scar forums?
**BANNED The Man
01-09-2011, 09:04 PM
Come on man, just searching Download Simba comes up with it...
This is the SRL forums
-Boom
omgbeans
01-09-2011, 09:11 PM
ok well the script is still not working and all you did was get me to use simba.
**BANNED The Man
01-09-2011, 09:14 PM
Well what isn't working?
Is it not compiling...?
Is it not finding the colour or what?
omgbeans
01-09-2011, 09:16 PM
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
01-09-2011, 09:17 PM
Ok... So what does the debug say?
-Boom
3Garrett3
01-09-2011, 09:19 PM
We can read minds. Help us out. Post the script, the error, and then we can help fix it :)
omgbeans
01-09-2011, 09:21 PM
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
01-09-2011, 09:23 PM
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
01-09-2011, 09:26 PM
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
01-09-2011, 09:35 PM
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
01-09-2011, 09:36 PM
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
01-09-2011, 09:38 PM
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
01-09-2011, 09:40 PM
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"
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
01-09-2011, 09:44 PM
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
01-09-2011, 09:45 PM
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
01-09-2011, 09:46 PM
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
01-09-2011, 09:46 PM
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
01-09-2011, 09:47 PM
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
01-09-2011, 09:47 PM
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
01-09-2011, 09:49 PM
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
01-09-2011, 09:51 PM
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
01-09-2011, 09:51 PM
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
01-09-2011, 09:59 PM
ok well thanks for the help so far then
Zyt3x
01-09-2011, 10:02 PM
Why can't you just use some coords to click the button?
Frement
01-09-2011, 10:03 PM
Why can't you just use some coords to click the button?
Now thats not good practice is it? ;)
Hugolord
01-09-2011, 10:06 PM
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
01-09-2011, 10:22 PM
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
01-09-2011, 10:26 PM
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
01-09-2011, 10:35 PM
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
01-09-2011, 10:44 PM
Do begin repeat if findcolor begin
IN SIMBA!
omgbeans
01-09-2011, 10:51 PM
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
01-09-2011, 11:30 PM
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
01-09-2011, 11:40 PM
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.
Zyt3x
01-09-2011, 11:45 PM
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
01-10-2011, 12:04 AM
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.
Zyt3x
01-10-2011, 12:26 AM
You're using simba now? Then replace "True" in HoldMouse() and ReleaseMouse() with "mouse_Left"
Dgby714
01-10-2011, 12:28 AM
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
01-10-2011, 12:39 AM
now it wont find the color anymore after running the script over and over
Frement
01-10-2011, 01:00 AM
You could try FindColorTolerance?
Dgby714
01-10-2011, 01:09 AM
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
01-10-2011, 01:15 AM
Not everything needs spoon feeding Dgby :(
omgbeans
01-10-2011, 01:21 AM
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
01-10-2011, 01:29 AM
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
01-10-2011, 01:34 AM
I dont think it has anti cheat.
TomTuff
01-10-2011, 01:38 AM
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
01-10-2011, 10:00 AM
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?
Zyt3x
01-10-2011, 03:58 PM
And why are you guys looping through tolerance? Just do tolerance 10
tom99
01-10-2011, 06:36 PM
Is the button on the same position all the time ? do you want to hit it once it apear ?
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.