Jump to content
i dani

Running in background

Recommended Posts

Is it possible to run SCAR in the background without use of the mouse? If not, it would be nice if it was implemented

 

Also, what happened to DTM and Bitmap. Is there any new function for finding a small area in a screen, and then clicking it? Right now I'm working with colors.

Edited by i dani
Link to comment
Share on other sites

You could launch SCAR using the command line with arguments to start a script running. Might do what you want?

 

http://forums.scar-divi.com/showthread.php?2-Commandline-Parameters

 

As for the other part sounds like you want FindBitmap as LordJashin suggested.

 

Care to elaborate on that? Also, if I do that do I not need to select the window where its ran?

 

Does this mean it runs in the background without using my mouse?

Edited by i dani
Link to comment
Share on other sites

Side note: How do methods work on here (I think they are refered to as procedures?)

 

I know Java, and this is a little different although I think it has objects?

 

How do I create a method that takes parameters and returns a value, say a boolean? Making everything in one big main method is very tedious.

Link to comment
Share on other sites

function Test(YESorNO: string): Boolean;
begin
 Result := (Lowercase(YESorNO) = 'yes');
end;

begin
 if Test('YES') then
   WriteLn('Yes!')
 else
   WriteLn('NO... ');
end.

 

Depends what kind of parameters you want to use.

For now I am using an if statement.

If (FindColor(params here) && FindColor(params here) {

//do this

}

How is this in Scar language?

 

Also, if I want to use a Timer for a repeated task i.e

 

If(GetTimeRunning % 5000 = 0)

//do something

 

How can I do this in Scar/Pascal?

 

Edit: Found out that remainder(%) is MOD in Pascal. So 10 MOD 2 = 0 was what I needed, thanks

Edited by i dani
Link to comment
Share on other sites

For now I am using an if statement.

If (FindColor(params here) && FindColor(params here) {

//do this

}

How is this in Scar language?

 

Also, if I want to use a Timer for a repeated task i.e

 

If(GetTimeRunning % 5000 = 0)

//do something

 

How can I do this in Scar/Pascal?

 

Edit: Found out that remainder(%) is MOD in Pascal. So 10 MOD 2 = 0 was what I needed, thanks

Is that first one asking OR or AND?

 

Would have to be something like this:

var
 X, Y: Integer;

begin
 if not (FindColor(X, Y, 255, 0, 0, 999, 999) and FindColor(X, Y, 16711680, 0, 0, 999, 999)) then
 begin
   if (FindColor(X, Y, 255, 0, 0, 999, 999) or FindColor(X, Y, 16711680, 0, 0, 999, 999)) then
     WriteLn('RED [255] or BLUE [16711680] found in area 0, 0, 999, 999 (0, 0 = X-Start, Y-Start and 999, 999 = X-End, Y-End)')
   else
     WriteLn(' RED or BLUE was not found in area 0, 0, 999, 999! ');
 end else
   WriteLn('RED [255] or BLUE [16711680] found in area 0, 0, 999, 999 (0, 0 = X-Start, Y-Start and 999, 999 = X-End, Y-End)');
end.

 

So basically...

 

With OR:

(FindColor(X, Y, 255, 0, 0, 999, 999) or FindColor(X, Y, 16711680, 0, 0, 999, 999))

 

..and with AND:

 

(FindColor(X, Y, 255, 0, 0, 999, 999) and FindColor(X, Y, 16711680, 0, 0, 999, 999))

 

Not sure about that timer one, that wont work at least, it would rarely return true with exactly 0. :\

 

I think better way would be with GetSystemTime + time marking.

 

Like:

 

var
 tm: Integer;

begin
 repeat                             
   if ((GetSystemTime - tm) > 5000) then
   begin                 
     WriteLn('5000 sec WriteLn! ');            
     tm := GetSystemTime;
   end;
 until False;
end.

 

There may be better ways to do these, but yeah...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...