CLEO Help [Help] Auto Press Key

CLEO related
Status
Not open for further replies.

ejexter

Well-known member
Joined
Feb 21, 2014
Messages
211
Reaction score
0
There is some way in cleo to make script of auto press key?
Like: Key Press 87 (W) (Auto Walk)
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
4
Pa0NeiX link said:
You can show me how to make simple script of FAKE_KEYPRESS ??  :yesyes:
It's damn easy. Just use the call function and put the keys which you want to use. The snippets should be put somewhere else.

Code:
:label
wait 0
if
..
jf [member=23507]Label[/member]
0AB1: @FAKE_KEYPRESS 1 OFFSET_KEY 0x3 // W
0AB1: call @keyPress 2 key 53 time 500
goto [member=23507]Label[/member]

:FAKE_KEYPRESS
1@ = 0xB73458 
005A: 1@ += 0@  // (int)
0A8C: write_memory 1@ size 1 value 255 virtual_protect 0
0AB2: ret 0	

:keyPress
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
     end
end
0AB2: ret 0
 

ejexter

Well-known member
Joined
Feb 21, 2014
Messages
211
Reaction score
0
TH3RM4L link said:
It's damn easy. Just use the call function and put the keys which you want to use. The snippets should be put somewhere else.
Code:
:label
wait 0
if
..
jf [member=23507]Label[/member]
0AB1: @FAKE_KEYPRESS 1 OFFSET_KEY 0x3 // W
0AB1: call @keyPress 2 key 53 time 500
goto [member=23507]Label[/member]

:FAKE_KEYPRESS
1@ = 0xB73458 
005A: 1@ += 0@  // (int)
0A8C: write_memory 1@ size 1 value 255 virtual_protect 0
0AB2: ret 0	

:keyPress
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
     end
end
0AB2: ret 0

[glow=red,2,300]Thanks! that easy[/glow]  :somuchwin:
Code:
:MAIN
wait 0
0AB1: call @keyPress 2 key 84 time 500
0AB1: call @keyPress 2 key 76 time 500
0AB1: call @keyPress 2 key 79 time 500
0AB1: call @keyPress 2 key 76 time 500
0AB1: call @keyPress 2 key 13 time 500
SAMP.CmdRet()
goto @MAIN

:keyPress
// 0@ - key, 1@ - time
// Example: 0AB1: call @keyPress 2 key 0@ time 1@

if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
     end
end
0AB2: ret 0

But, how i make like this ??
Code:
0@ = 0001
1@ += 0@

Result:
0000
0001
 

ejexter

Well-known member
Joined
Feb 21, 2014
Messages
211
Reaction score
0
TH3RM4L link said:
Umm, I don't understand what you want. Explain more.
I want to do this:
/HousePass
{dialog from server popup}
0001
0002
0003
0004 AndMore
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
4
Pa0NeiX link said:
I want to do this:
/HousePass
{dialog from server popup}
0001
0002
0003
0004 AndMore
0AF9: "/housepass"
wait 200
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 49 {1} time 100
 

ejexter

Well-known member
Joined
Feb 21, 2014
Messages
211
Reaction score
0
TH3RM4L link said:
0AF9: "/housepass"
wait 200
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 49 {1} time 100

:urtheman: Thanks! But i can do this?  :surprised:
Code:
0000
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 +
And more question, this is hard?  :computer_guy:
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
4
Place this many times
Code:
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 49 {1} time 100
But replace 49 (which means 1) with the next number, like 50 (which means 2)
Example:
// first key presses
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 49 {1} time 100
// the 2nd key presses
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 50 {2} time 100 // see? i changed 49 to 50 so it presses 2 this time, not 1
// etc
 

ejexter

Well-known member
Joined
Feb 21, 2014
Messages
211
Reaction score
0
TH3RM4L link said:
Place this many times
Code:
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 49 {1} time 100
But replace 49 (which means 1) with the next number, like 50 (which means 2)
Example:
// first key presses
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 49 {1} time 100
// the 2nd key presses
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 48 {0} time 100
wait 100
0AB1: call @keyPress 2 key 50 {2} time 100 // see? i changed 49 to 50 so it presses 2 this time, not 1
// etc
I already understand this
But my question was, if i can do it 0001 to 9999 in short source code
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
4
Code:
{$CLEO}
0000: NOP
10@ = 48
11@ = 48
12@ = 48
13@ = 49

:START
wait 0
if
0ADC: "K"
jf @START

:LABEL1
wait 0
0AB1: call @10 2 key 10@ time 1@
wait 100
0AB1: call @11 2 key 11@ time 1@
wait 100
0AB1: call @12 2 key 12@ time 1@
wait 100
0AB1: call @13 2 key 13@ time 1@
// the following lines were just for testing
{ 
0AF8: "10: %d" 0xFFFFFF 10@
wait 100
0AF8: "10: %d 11: %d" 0xFFFFFF 10@ 11@
wait 100
0AF8: "10: %d 11: %d 12: %d" 0xFFFFFF 10@ 11@ 12@
wait 100
0AF8: "10: %d 11: %d 12: %d 13: %d" 0xFFFFFF 10@ 11@ 12@ 13@
}
13@ += 1

:LABEL2
if or
13@ == 58
13@ >= 58
jf @LABEL3
13@ = 49
12@ += 1

:LABEL3
if or
12@ == 58
12@ >= 58
jf @LABEL4
12@ = 48
11@ += 1

:LABEL4
if or
11@ == 58
11@ >= 58
jf @LABEL5
11@ = 48
10@ += 1

:LABEL5
if or
10@ == 58
10@ >= 58
jf @LABEL1
10@ = 48
11@ = 48
12@ = 48
13@ = 48
goto @LABEL1

:10
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 10@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 10@
     end
end
0AB2: ret 0

:11
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 11@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 11@
     end
end
0AB2: ret 0

:12
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 12@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 12@
     end
end
0AB2: ret 0

:13
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 13@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 13@
     end
end
0AB2: ret 0
It worked good with 0AF8, but I'm not sure if it works with key press.
 
Status
Not open for further replies.
Top