CLEO Help Send key

CLEO related
Status
Not open for further replies.

renko

Active member
Joined
Jul 8, 2014
Messages
58
Reaction score
0
I was asking how can i send a key to the game by a cleo mode. For example, every 10 sec space bar will be pressed automatically. Thanks
 

PopandaulX

Active member
Joined
Jul 15, 2013
Messages
189
Reaction score
1
http://ugbase.eu/snippets/send-keypress-5701/ or http://ugbase.eu/snippets/send-keypress/

Code:
{$CLEO .cs}
0000: NOP
0662: "PopandauL"

wait 0
1@ = 0

while true
wait 0
   if and
   1@ == 0
   0AB0: 75
   then
   1@ = 1
   0ACD: show_text_highpriority "SpaceBarPress ~g~enabled~w~!" time 500
   wait 500
   else
      if and
      1@ == 1
      0AB0: 75
      then
      1@ = 0
      0ACD: show_text_highpriority "SpaceBarPress ~r~disabled~w~!" time 500
      wait 500
      end
   end
   if 1@ == 1 then
   0AB1: call @keyPress 2 key 32 time 250
   wait 10000
   end
end


: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

Activate on K.
 

renko

Active member
Joined
Jul 8, 2014
Messages
58
Reaction score
0
PopandaulX link said:
http://ugbase.eu/snippets/send-keypress-5701/ or http://ugbase.eu/snippets/send-keypress/

Code:
{$CLEO .cs}
0000: NOP
0662: "PopandauL"

wait 0
1@ = 0

while true
wait 0
   if and
   1@ == 0
   0AB0: 75
   then
   1@ = 1
   0ACD: show_text_highpriority "SpaceBarPress ~g~enabled~w~!" time 500
   wait 500
   else
      if and
      1@ == 1
      0AB0: 75
      then
      1@ = 0
      0ACD: show_text_highpriority "SpaceBarPress ~r~disabled~w~!" time 500
      wait 500
      end
   end
   if 1@ == 1 then
   0AB1: call @keyPress 2 key 32 time 250
   wait 10000
   end
end


: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

Activate on K.
Ok, but it isn't working :) can you test it out for me ? I press "K", i get the msg but it isn't pressing the Space Bar
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
This should work

Code:
{$CLEO .cs}
0000: NOP
0662: "PopandauL"

wait 0
1@ = 0

while true
wait 0
   if and
   1@ == 0
   0AB0: 75
   then
   1@ = 1
   0ACD: show_text_highpriority "SpaceBarPress ~g~enabled~w~!" time 500
   wait 500
   else
      if and
      1@ == 1
      0AB0: 75
      then
      1@ = 0
      0ACD: show_text_highpriority "SpaceBarPress ~r~disabled~w~!" time 500
      wait 500
      end
   end
   if 1@ == 1 then
   0AB1: @FAKE_KEYPRESS 1 _OFFSET_KEY_ 0x20
   wait 10000
   end
end

:FAKE_KEYPRESS
1@ = 0xB73458 
005A: 1@ += 0@
0A8C: write_memory 1@ size 1 value 255 virtual_protect 0
0AB2: ret 0
 
Status
Not open for further replies.
Top