Jump to content
herypderps

Help with procedures.

Recommended Posts

Hello, I am having a problem with procedures. I'm trying to make a script for a game where it actively clicks/writes in chat while waiting for this box that randomly appears to see if you are away from keyboard.

 

Here's what I've written so far (bare in mind, this is my first day with pascal)

 

 

What i want is like this:

 

[b]program[/b] auto2k12;

[b]const[/b]
BoxColor = 26367;

[b]var[/b]
W, H: Integer;
x, y: Integer;

[b]procedure[/b] BoxCheck;
[b]begin[/b]
[b]repeat[/b]
GetClientDimensions(W, H);
[b]if[/b]
FindColor(x,y, BoxColor,x,y,W,H) [b]then[/b]
ClickMouse(x,y, False);
[b]end;[/b]

[b]procedure[/b] ActAlive;
[b]begin[/b]
[b]repeat[/b]
Wait(10000+random(3000)); [b]then[/b]
ClickMouse(x+random(200),y+random(200; False);
[b]end;
[/b]
[b]end.
[/b]

 

I hope you can relate to what I'm trying to achieve. :)

 

 

Thanks alot, I played runescape back in 2001. Glad to see you guys are still running :)

Link to comment
Share on other sites

I don't know what you're trying to do, but I kind of understand. Does this work?

 

program auto2k12;

const
 BoxColor = 26367;

var
 W, H, x, y : Integer;

procedure BoxCheck;
begin
 if(FindColor(x, y, BoxColor, x, y, W, H))then
   ClickMouse(x, y, False);
end;

procedure ActAlive;
begin
 BoxCheck;
 Wait(10000 + Random(3000));
 ClickMouse(x + Random(200), y + Random(200), False);
end;

begin
 GetClientDimensions(W, H);
 repeat
   ActAlive;
 until(False);
end.

 

Also, I don't have Scar at the office, this is just an idea off the top of my head.

Link to comment
Share on other sites

may be like this?

program auto2k12
var
BoxColor,W,H,x,y,count  : Integer;



procedure Loadvariable;
begin
 BoxColor:= 26367;
 BoxColor_tolerance:=15;
end;

procedure ActAlive;
 begin
 writeln('checkpointActAlive');
    //Wait(10000+random(3000));
    x:=x+random(200);
    y:=y+random(200);
    ClickMouse(x,y, False);
 end;

function BoxCheck: Boolean;
 begin
 writeln('checkpointBoxCheck');
 result:=false;
 count:=0 ;
   repeat
     inc(count);
     if (Findcolortolerance(x,y,BoxColor, 1, 1, W, H, BoxColor_tolerance)=true) then
       begin;
         ClickMouse(x,y, False);
         writeln('BoxColor at: '+inttostr(x)+' /'+inttostr(y));
         result:=true;
       end;
     wait(1000);
     if counter=10 then
       begin
         writeln('NoBoxColor---->ActAlive') 
         ActAlive;
         counter:=0;
       end
   until (result=true);
 end;

begin
SetDesktopAsClient;
GetClientDimensions(W, H);
Loadvariable;
repeat
 //Mainloop//
 BoxCheck;
until (IsKeyDown('q')=true);
end.

Edited by opiumhautopium1
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...