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 


Making A Checkbox that infinitely writes a value

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

Joined: 09 Jun 2015
Posts: 77

PostPosted: Sun Aug 21, 2016 9:38 pm    Post subject: Making A Checkbox that infinitely writes a value Reply with quote

Well guys, I've came across a bit of a dilemma. I want a code to loop continuously, but only when a box is checked. I have a bit of code that only works when looped continuously. If I just create a while loop, the application will get stuck infinitely doing that process, but will be unable to do anything else but that. I want to infinitely loop something until the user decides not to and to retain functionality of the rest of the trainer. Thanks in advanced.
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Sun Aug 21, 2016 9:39 pm    Post subject: Reply with quote

Have a timer that runs, the timer checks if the box is active, if it is, do the stuff, if it isnt dont do the stuff.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Aug 21, 2016 10:16 pm    Post subject: Reply with quote

Just freeze the value?
Back to top
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Mon Aug 22, 2016 6:21 am    Post subject: Re: Making A Checkbox that infinitely writes a value Reply with quote

I think that's what this need

[code]
function CECheckbox1Change(sender)
if (UDF1.CECheckbox1.State=cbCheckd) then
--trainer name. checkbox name.State
--Here places that will be executed when the check box is checked

function code()
--code to be executed
end

t=createTimer(nil)
timer_setInterval(t, 1) --Interval in MS
timer_onTimer(t, code)

else
--code when the check box is cleared
--destroy the timer
t.destroy();
t=nil
end
end[/code]
Back to top
View user's profile Send private message
Reclaimer Shawn
Advanced Cheater
Reputation: 0

Joined: 09 Jun 2015
Posts: 77

PostPosted: Tue Aug 23, 2016 6:13 pm    Post subject: Re: Making A Checkbox that infinitely writes a value Reply with quote

Filipe_Br wrote:
I think that's what this need

Code:

function CECheckbox1Change(sender)
   if (UDF1.CECheckbox1.State=cbCheckd) then
      --trainer name. checkbox name.State
      --Here places that will be executed when the check box is checked

      function code()
         --code to be executed
      end

      t=createTimer(nil)
      timer_setInterval(t, 1) --Interval in MS
      timer_onTimer(t, code)

   else
      --code when the check box is cleared
      --destroy the timer
      t.destroy();
      t=nil
   end
end


Would this be how to utilize your code?
Code:

function CECheckbox1Change(sender)
   if ((checkbox_getState(UDF1.CECheckbox1)) == 1) then


      function code()
         writeBytes("804990D3",73)
         writeBytes("80499018",0,249)
         writeBytes("8049901C",127,255)
         writeBytes("804990A8",127,255)
         writeBytes("804990AA",255,255)
         writeBytes("804990AC",255,255)
         writeBytes("804990AE",255,255)
         writeBytes("804990B0",255,255)
         writeBytes("804990B2",255,255)
      end

      t=createTimer(nil)
      timer_setInterval(t, 1)
      timer_onTimer(t, code)
   else
      t.destroy();
      t=nil
   end
end


When I place this in my trainer, it closes directly after it runs this statement. Without it, the program still opens.
Back to top
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Tue Aug 23, 2016 9:32 pm    Post subject: Re: Making A Checkbox that infinitely writes a value Reply with quote

I've never seen this error. But try this.
When placing the box in your trainer, open the Events tab, select onChage, and click "...".
created within the function set:
Code:

   if (UDF1.CECheckbox1.State=cbCheckd) then

      function code()
         writeBytes("804990D3",73)
         writeBytes("80499018",0,249)
         writeBytes("8049901C",127,255)
         writeBytes("804990A8",127,255)
         writeBytes("804990AA",255,255)
         writeBytes("804990AC",255,255)
         writeBytes("804990AE",255,255)
         writeBytes("804990B0",255,255)
         writeBytes("804990B2",255,255)
      end

      t=createTimer(nil)
      timer_setInterval(t, 1)
      timer_onTimer(t, code)

   else
      t.destroy()
      t=nil
   end

If I have already done it, tell me if the error only when conteceu used this script.
make sure you are using static addresses.
remember that UDF1 is the name of the trainer, if you are using the tool for generating trainer, the default name is CETrainer.
Back to top
View user's profile Send private message
Reclaimer Shawn
Advanced Cheater
Reputation: 0

Joined: 09 Jun 2015
Posts: 77

PostPosted: Tue Aug 23, 2016 10:12 pm    Post subject: Re: Making A Checkbox that infinitely writes a value Reply with quote

Filipe_Br wrote:
I've never seen this error. But try this.
When placing the box in your trainer, open the Events tab, select onChage, and click "...".
created within the function set:
Code:

   if (UDF1.CECheckbox1.State=cbCheckd) then

      function code()
         writeBytes("804990D3",73)
         writeBytes("80499018",0,249)
         writeBytes("8049901C",127,255)
         writeBytes("804990A8",127,255)
         writeBytes("804990AA",255,255)
         writeBytes("804990AC",255,255)
         writeBytes("804990AE",255,255)
         writeBytes("804990B0",255,255)
         writeBytes("804990B2",255,255)
      end

      t=createTimer(nil)
      timer_setInterval(t, 1)
      timer_onTimer(t, code)

   else
      t.destroy()
      t=nil
   end

If I have already done it, tell me if the error only when conteceu used this script.
make sure you are using static addresses.
remember that UDF1 is the name of the trainer, if you are using the tool for generating trainer, the default name is CETrainer.


It's was actually correct code. DBK_INITIALIZE was messing with the function, and I worked around it a bit. Had to deal with protected memory.
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