herypderps Posted February 2, 2012 Share Posted February 2, 2012 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 Quote Link to comment Share on other sites More sharing options...
Kyle Undefined Posted February 2, 2012 Share Posted February 2, 2012 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. Quote Link to comment Share on other sites More sharing options...
opiumhautopium1 Posted February 2, 2012 Share Posted February 2, 2012 (edited) 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 February 2, 2012 by opiumhautopium1 Quote Link to comment Share on other sites More sharing options...
FHannes Posted February 2, 2012 Share Posted February 2, 2012 You should never do this: SetDesktopAsClient; GetClientDimensions(W, H); Quote Link to comment Share on other sites More sharing options...