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 


[ HELP ] lua script release button

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

Joined: 29 Jul 2020
Posts: 34

PostPosted: Sun Aug 23, 2020 11:02 pm    Post subject: [ HELP ] lua script release button Reply with quote

hello master...

let me ask something hehe Very Happy

i want to make button in my trainer auto press space bar.
when i click that button it press " SPACE " and when i click again it stop press " space "

Thank you master.
Have a nice day Very Happy
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Aug 24, 2020 12:42 am    Post subject: Reply with quote

I don't know what I've done!!

Code:
if f then f.destroy() end

f = createForm()
f.width = 100
f.height = 70
f.Position = 'poScreenCenter'

tb = createToggleBox(f)
tb.top = 10
tb.left = 10
tb.width = 105
tb.height = 50
tb.Caption = 'OFF'

function tbChange(sender)
 if (checkbox_getState(tb) == 1) then
  tb.Caption = 'ON'
  timer2.Enabled=true
  doKeyPress(VK_SPACE)
  print('Space key is down')
 else
  print('Space key is up')
  tb.Caption = 'OFF'
  timer2.Enabled=false
  end
end

function stop()
 timer2.Enabled=false
 timer2.Destroy()
end

timer2=createTimer(nil, false)
timer2.Interval=500
timer2.OnTimer=tbChange

f.show()
tb.onChange = tbChange
f.onClose = stop

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Mon Aug 24, 2020 11:17 pm    Post subject: Reply with quote

Corroder wrote:
I don't know what I've done!!

Code:
if f then f.destroy() end

f = createForm()
f.width = 100
f.height = 70
f.Position = 'poScreenCenter'

tb = createToggleBox(f)
tb.top = 10
tb.left = 10
tb.width = 105
tb.height = 50
tb.Caption = 'OFF'

function tbChange(sender)
 if (checkbox_getState(tb) == 1) then
  tb.Caption = 'ON'
  timer2.Enabled=true
  doKeyPress(VK_SPACE)
  print('Space key is down')
 else
  print('Space key is up')
  tb.Caption = 'OFF'
  timer2.Enabled=false
  end
end

function stop()
 timer2.Enabled=false
 timer2.Destroy()
end

timer2=createTimer(nil, false)
timer2.Interval=500
timer2.OnTimer=tbChange

f.show()
tb.onChange = tbChange
f.onClose = stop

finally it work master thanks for your helping
but,it make new trainer ,i mean i want to add to my button trainer



click mouse.png
 Description:
 Filesize:  118.25 KB
 Viewed:  2503 Time(s)

click mouse.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Aug 25, 2020 12:52 am    Post subject: Reply with quote

Easy way, just change your CEButton to CEToggleBox.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Tue Aug 25, 2020 3:49 am    Post subject: Reply with quote

Corroder wrote:
Easy way, just change your CEButton to CEToggleBox.

i've try master but it show error Invalid class object Confused
will you teach me more about that master? Very Happy



problem.png
 Description:
 Filesize:  136.47 KB
 Viewed:  2486 Time(s)

problem.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Aug 25, 2020 4:23 am    Post subject: Reply with quote

Please check what is your trainer components/classes name and make sure you use correct name for the components.

In your case:

Code:
function CETrainer_CECheckbox1Change(sender)
 if CETrainer.CECheckbox1.State == 1 then
  CETrainer.CECheckbox1.Caption = 'AUTOLOOT IS ON'
  timer2.Enabled=true
  doKeyPress(VK_SPACE)
  print('Space key is down')
 else
  print('Space key is up')
  CETrainer.CECheckbox1.Caption = 'AUTOLOOT IS OFF'
  timer2.Enabled=false
  end
end

timer2=createTimer(nil, false)
timer2.Interval=500
timer2.OnTimer=CETrainer_CECheckbox1Change

CETrainer.Show()

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Tue Aug 25, 2020 4:55 am    Post subject: Reply with quote

Corroder wrote:
Please check what is your trainer components/classes name and make sure you use correct name for the components.

In your case:

Code:
function CETrainer_CECheckbox1Change(sender)
 if CETrainer.CECheckbox1.State == 1 then
  CETrainer.CECheckbox1.Caption = 'AUTOLOOT IS ON'
  timer2.Enabled=true
  doKeyPress(VK_SPACE)
  print('Space key is down')
 else
  print('Space key is up')
  CETrainer.CECheckbox1.Caption = 'AUTOLOOT IS OFF'
  timer2.Enabled=false
  end
end

timer2=createTimer(nil, false)
timer2.Interval=500
timer2.OnTimer=CETrainer_CECheckbox1Change

CETrainer.Show()

yeeayyyy, work master
but any way to not display dialog " lua engine " ?
"space is down" and "space is up" i mean direct to program what i choose
then when i run / check box it run at program what i choose without showing dialog " lua engine "
example : i want pick item in game ,maybe you can show me that code hehe
Very Happy
sorry master for wasting your time



WORK.png
 Description:
 Filesize:  151.16 KB
 Viewed:  2470 Time(s)

WORK.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Aug 25, 2020 7:25 am    Post subject: Reply with quote

Just DELETE this line from the function.

Code:
print('Space key is down')


and

Code:
print('Space key is up')


or change the script to what you want to do.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Tue Aug 25, 2020 10:56 am    Post subject: Reply with quote

Corroder wrote:
Just DELETE this line from the function.

Code:
print('Space key is down')


and

Code:
print('Space key is up')


or change the script to what you want to do.

it not work master, i've try...
The program show but when i delete that function
"auto loot" not runing correctly Sad
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Aug 25, 2020 12:25 pm    Post subject: Reply with quote

I am not say to delete the function, I am say to delete the LINE on the function with say "print('Space key is down')" and print('Space key is up) ". Delete those lines only not all the function.

And I say "or change the script to what you want to do".

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Tue Aug 25, 2020 3:00 pm    Post subject: Reply with quote

Corroder wrote:
I am not say to delete the function, I am say to delete the LINE on the function with say "print('Space key is down')" and print('Space key is up) ". Delete those lines only not all the function.

And I say "or change the script to what you want to do".

finally it work master
i just fill this code
Code:
function CETrainer_CECheckbox1Change(sender)
 if CETrainer.CECheckbox1.State == 1 then
  CETrainer.CECheckbox1.Caption = 'AUTOLOOT IS ON'
  timer2.Enabled=true
  doKeyPress(VK_SPACE)
 else
  timer2.Enabled=false
  doKeyPress(VK_SPACE)
  end
end

timer2=createTimer(nil, false)
timer2.Interval=500
timer2.OnTimer=CETrainer_CECheckbox1Change

CETrainer.Show()


Thank you so much for you support/helping master
You'are so kind
Have a nice day master Smile
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