Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


run by entering

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Firered
Cheater
Reputation: 0

Joined: 22 May 2012
Posts: 26

PostPosted: Wed May 23, 2012 11:15 am    Post subject: run by entering Reply with quote

I know that has relation with this function:

Code:
funcion CEbuttonClick(sender)
control_setCaption...
hkey=createHotkey("CEbuttonClick",VK_1)


Last edited by Firered on Wed May 23, 2012 7:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Wed May 23, 2012 11:25 am    Post subject: Reply with quote

do you wish to let ce press the "1" key constantly? (doKeyPress(VK_1) in a timer )
Or do you wish to execute the same function over and over ? (t=createTimer(nil) /timer_onTimer(t,function) )

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Firered
Cheater
Reputation: 0

Joined: 22 May 2012
Posts: 26

PostPosted: Wed May 23, 2012 10:16 pm    Post subject: Reply with quote

I managed to do, but I need to do something else:

Code:
stringtotype={}
stringtotype[0]=VK_1

currentChar=0;

function typer()

  keyDown(stringtotype[currentChar])
  sleep(2000)
  keyUp(stringtotype[currentChar])

  currentChar=(currentChar + 1);

  if (stringtotype[currentChar] == nil) then
    currentChar=0
  end

end

t=createTimer(nil, false)
timer_setInterval(t, 100)
timer_onTimer(t, typer)
timer_setEnabled(t, true)


wanted to stop the repetition with a hotkey 2.
When pressing the hotkey 1 again starts to a Continuously repeat the number 1111 ...
When click the hotkey 2, it stops, this rhythm.

help me dark byte
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Thu May 24, 2012 3:43 am    Post subject: Reply with quote

Just use createHotkey
Code:

stringtotype={}
stringtotype[0]=VK_1

currentChar=0;


function typer()

  keyDown(stringtotype[currentChar])
  sleep(2000)
  keyUp(stringtotype[currentChar])

  currentChar=(currentChar + 1);

  if (stringtotype[currentChar] == nil) then
    currentChar=0
  end

end

stringtotype={}

function startTimer(sender)
  t=createTimer(nil, false)
  timer_setInterval(t, 100)
  timer_onTimer(t, typer)
  timer_setEnabled(t, true)
end

function stopTimer(sender)
  object_destroy(t)
end

createHotkey(startTimer, VK_1)
createHotkey(stopTimer, VK_2)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Firered
Cheater
Reputation: 0

Joined: 22 May 2012
Posts: 26

PostPosted: Thu May 24, 2012 11:52 am    Post subject: Reply with quote

did not work .. something is wrong
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Thu May 24, 2012 12:38 pm    Post subject: Reply with quote

what doesn't work. I am assuming that the typer script you posted works without a problem (note that that sleep(2000) will basically freeze ce)

anyhow, first remove the second "stringtotype={} " line

and put a nil check for t in startTimer and set t to nil in stopTimer

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Firered
Cheater
Reputation: 0

Joined: 22 May 2012
Posts: 26

PostPosted: Thu May 24, 2012 8:30 pm    Post subject: Reply with quote

so? no longer works, I do not understand what you said.

Code:
stringtotype={}
stringtotype[0]=VK_1

currentChar=0;


function typer()

  keyDown(stringtotype[currentChar])
  sleep(2000)
  keyUp(stringtotype[currentChar])

  currentChar=(currentChar + 1);

  if (stringtotype[currentChar] == nil) then
    currentChar=0
  end

end

function startTimer(sender)
startTimer(nil, t)
  t=createTimer(nil, false)
  timer_setInterval(t, 100)
  timer_onTimer(t, typer)
  timer_setEnabled(t, true)
end

function stopTimer(sender)
stopTimer(nil, t)
  object_destroy(t)
end

createHotkey(startTimer, VK_1)
createHotkey(stopTimer, VK_2)


Last edited by Firered on Thu May 24, 2012 8:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Thu May 24, 2012 8:38 pm    Post subject: Reply with quote

here is a script that should work:
Code:

stringtotype={}
stringtotype[0]=VK_1

currentChar=0;


function typer()

  doKeyPress(stringtotype[currentChar])

  currentChar=(currentChar + 1);
  if (stringtotype[currentChar] == nil) then
    currentChar=0
  end
end

function startTimer()
  if (t==nil) then
    t=createTimer(nil, false)
    timer_setInterval(t, 100)
    timer_onTimer(t, typer)
    timer_setEnabled(t, true)
  end
end

function stopTimer()
  object_destroy(t)
  t=nil
end

createHotkey(startTimer, VK_1)
createHotkey(stopTimer, VK_2)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Firered
Cheater
Reputation: 0

Joined: 22 May 2012
Posts: 26

PostPosted: Thu May 24, 2012 8:52 pm    Post subject: Reply with quote

also does not work, this is strange
Back to top
View user's profile Send private message
Firered
Cheater
Reputation: 0

Joined: 22 May 2012
Posts: 26

PostPosted: Fri May 25, 2012 9:43 am    Post subject: Reply with quote

why not working? the script is right ..
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Fri May 25, 2012 11:15 am    Post subject: Reply with quote

define not working. When you try it on notepad, doesn't it write 1 constantly?

If you mean in a game, not all games support this type of key input

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Firered
Cheater
Reputation: 0

Joined: 22 May 2012
Posts: 26

PostPosted: Fri May 25, 2012 4:16 pm    Post subject: Reply with quote

yes, he did not write 1 constantly..
anyway thanks for the strength
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25295
Location: The netherlands

PostPosted: Fri May 25, 2012 4:33 pm    Post subject: Reply with quote

Weird, this script works for me. If I press 1 ce will constantly type '1'

You are using CE 6.2 right? (6.1 has a small bug in createHotkey where you need to put the functionname in quotes)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Firered
Cheater
Reputation: 0

Joined: 22 May 2012
Posts: 26

PostPosted: Fri May 25, 2012 7:41 pm    Post subject: Reply with quote

this is my error. thx
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites