dotaczik
Member
Hi
I have a problem in my little cleo script and I cant find soloution.
The thing is I have a code where my script fire in cycle. There is command wait, where it waits 80 sec.
And I want to stop this cycling by pressing some key. But when it waits 80 sec I cant use condition for pressing a certain key to cancel this cycle. I guess it has to be solved by threads, but I know almost nothing about threads.
Thanks for help.
I have a problem in my little cleo script and I cant find soloution.
The thing is I have a code where my script fire in cycle. There is command wait, where it waits 80 sec.
And I want to stop this cycling by pressing some key. But when it waits 80 sec I cant use condition for pressing a certain key to cancel this cycle. I guess it has to be solved by threads, but I know almost nothing about threads.
Thanks for help.
PHP:
{$CLEO .cs}
0000: "myscript"
:loop
wait 0
if
0AB0: is_key_pressed 192
then
0ACD: show_text_highpriority "activated" time 2500
wait 10000
while true
0AB1: @FAKE_KEYPRESS 1 _OFFSET_KEY_ 0x22
wait 80000
end
0002: jump @loop
else
0002: jump @loop
end
:FAKE_KEYPRESS
1@ = 0xB73458
005A: 1@ += 0@ // (int)
0A8C: write_memory 1@ size 1 value 255 virtual_protect 0
0AB2: ret 0
{
Offset Slot
+ 0x0 Right
+ 0x1 Left
+ 0x2 Backwards
+ 0x3 Forward
+ 0x4 Look right
+ 0x5 Look left
+ 0x6 Look down
+ 0x7 Look up
+ 0x8 Action
+ 0xA Previous weapon/target
+ 0xC Aim weapon
+ 0xE Next weapon/target
+ 0x10 Group CTRL forward
+ 0x12 Group CTRL back
+ 0x14 Conversation - NO
+ 0x16 Conversation - YES
+ 0x1A Change camera
+ 0x1C Jump
+ 0x1E Enter+exit
+ 0x20 Sprint
+ 0x22 Fire
+ 0x24 Crouch
+ 0x26 Look behind
+ 0x28 Unused
+ 0x2A Walk
}