 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Fri Aug 10, 2007 10:08 am Post subject: Delphi help |
|
|
im making a auto looter/clicker and i need some help
how would the code look like eg. when a button is pressed it starts to press "z"?
thanks for ur time
~Skylla~
_________________
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Fri Aug 10, 2007 10:18 am Post subject: |
|
|
| Code: |
procedure PostKeyEx32(key: Word; const shift: TShiftState; specialkey: Boolean);
type
TShiftKeyInfo = record
shift: Byte;
vkey: Byte;
end;
byteset = set of 0..7;
const
shiftkeys: array [1..3] of TShiftKeyInfo =
((shift: Ord(ssCtrl); vkey: VK_CONTROL),
(shift: Ord(ssShift); vkey: VK_SHIFT),
(shift: Ord(ssAlt); vkey: VK_MENU));
var
flag: DWORD;
bShift: ByteSet absolute shift;
i: Integer;
begin
for i := 1 to 3 do
begin
if shiftkeys[i].shift in bShift then
keybd_event(shiftkeys[i].vkey, MapVirtualKey(shiftkeys[i].vkey, 0), 0, 0);
end; { For }
if specialkey then
flag := KEYEVENTF_EXTENDEDKEY
else
flag := 0;
keybd_event(key, MapvirtualKey(key, 0), flag, 0);
flag := flag or KEYEVENTF_KEYUP;
keybd_event(key, MapvirtualKey(key, 0), flag, 0);
for i := 3 downto 1 do
begin
if shiftkeys[i].shift in bShift then
keybd_event(shiftkeys[i].vkey, MapVirtualKey(shiftkeys[i].vkey, 0),
KEYEVENTF_KEYUP, 0);
end;
end;
|
From torrys i belive...
| Code: |
Procedure ...
Begin
PostKeyEx32(Ord('K'), [], False);
end;
|
You can use SetCursPos and Sleep();
| Code: |
Sleep(1500);
SetCursorPos(x, y);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
sleep(1800);
PostKeyEx32(Ord('K'), [], False);
Sleep(1500);
SetCursorPos(x, y);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
|
Then it clicks somewhere, sleeps for 1.8 seconds and posts K, then it clicks somewhere again.
|
|
| Back to top |
|
 |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Fri Aug 10, 2007 10:25 am Post subject: |
|
|
for the setcursorpos do i need to add something to the uses, coz it says [Error] Unit1.pas(29): Undeclared identifier: 'x'
_________________
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Fri Aug 10, 2007 10:33 am Post subject: |
|
|
| no, but you gotta replace x and y with screen coordinates.
|
|
| Back to top |
|
 |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Fri Aug 10, 2007 10:34 am Post subject: |
|
|
k, but now this came up
[Error] Unit1.pas(34): Undeclared identifier: 'PostKeyEx32'
_________________
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Fri Aug 10, 2007 10:36 am Post subject: |
|
|
| Lets talk over here, not pm. The Procedure PostKeyEx32 must be right under {$R *.dfm} ...
|
|
| Back to top |
|
 |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Fri Aug 10, 2007 10:46 am Post subject: |
|
|
now im getting some other error, mab its easier if u make me an example source code and post it here, then il examine it... k?
_________________
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|