Paradoxium
05-23-2012, 01:51 PM
So I am making a script for an mmorpg called crossfire. Before I could not get the client to recognize clicks but ActivateClient solved that. Now I can click but keystrokes are not recognized...Any advice?
I've tried Keydown and Sendkeys...
Thanks
program Main;
var
X,Y: Integer;
function FindReadys:Boolean;
begin
Result := FindColorTolerance(X, Y,15137340, 1215, 411, 1235, 435, 20) {and FindColorTolerance( X, Y,16120397, 763, 176, 787, 202,20)};
end;
function WaitUntilGameLoads: Boolean;
begin
Result:= FindColorTolerance(X, Y,5411129, 0, 844, 250, 1049, 20)
end;
function EndedGame:Boolean;
begin
Result:= FindColorTolerance(X, Y,14922593,735,241,838,271, 20)
end;
function Tired:Boolean;
begin
result:=FindColorTolerance(X, Y,16120397, 1215, 411, 1235, 435, 20)
end;
procedure GetintoWindow;
begin
ClickMouse(671,1018,true); //clicks back into client
Wait(500);
end;
procedure Logintogame;
begin
ActivateClient;
GetClientWindowHandle;
repeat
Wait(500);
Writeln('Waiting for others to be ready'); //(waits until other cows are ready)
until(FindReadys);
MoveMouseSmooth(1203,675);
Sendkeys('www');
//ClickMouse(1203,675,true); //clicks start once
Writeln('Started Game');
{ repeat
Wait(500);
Writeln('Loading Game...'); //(waits until game loads)
until(WaitUntilGameLoads); }
end;
procedure WalkOver;
begin
Wait(10000);
//ActivateClient;
Writeln('Walking over');
//insert keydowns instead of sendarrow waits
//ClickMouse(400,400,true);
Sendkeys('www');
//walks over to arena side
Writeln('Getting into Position');
MoveMouseSmooth(846,502); //sets up postion
end;
procedure Swinging;
begin
repeat
HoldMouse(846,502,false);
Wait(5000 + Random(1000));
until(EndedGame) ;
end;
begin
GetintoWindow;
repeat
Logintogame;
WalkOver;
Swinging;
until (Tired);
end.
I've tried Keydown and Sendkeys...
Thanks
program Main;
var
X,Y: Integer;
function FindReadys:Boolean;
begin
Result := FindColorTolerance(X, Y,15137340, 1215, 411, 1235, 435, 20) {and FindColorTolerance( X, Y,16120397, 763, 176, 787, 202,20)};
end;
function WaitUntilGameLoads: Boolean;
begin
Result:= FindColorTolerance(X, Y,5411129, 0, 844, 250, 1049, 20)
end;
function EndedGame:Boolean;
begin
Result:= FindColorTolerance(X, Y,14922593,735,241,838,271, 20)
end;
function Tired:Boolean;
begin
result:=FindColorTolerance(X, Y,16120397, 1215, 411, 1235, 435, 20)
end;
procedure GetintoWindow;
begin
ClickMouse(671,1018,true); //clicks back into client
Wait(500);
end;
procedure Logintogame;
begin
ActivateClient;
GetClientWindowHandle;
repeat
Wait(500);
Writeln('Waiting for others to be ready'); //(waits until other cows are ready)
until(FindReadys);
MoveMouseSmooth(1203,675);
Sendkeys('www');
//ClickMouse(1203,675,true); //clicks start once
Writeln('Started Game');
{ repeat
Wait(500);
Writeln('Loading Game...'); //(waits until game loads)
until(WaitUntilGameLoads); }
end;
procedure WalkOver;
begin
Wait(10000);
//ActivateClient;
Writeln('Walking over');
//insert keydowns instead of sendarrow waits
//ClickMouse(400,400,true);
Sendkeys('www');
//walks over to arena side
Writeln('Getting into Position');
MoveMouseSmooth(846,502); //sets up postion
end;
procedure Swinging;
begin
repeat
HoldMouse(846,502,false);
Wait(5000 + Random(1000));
until(EndedGame) ;
end;
begin
GetintoWindow;
repeat
Logintogame;
WalkOver;
Swinging;
until (Tired);
end.