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 


The activation question twice will work

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

Joined: 27 Jul 2016
Posts: 122

PostPosted: Wed Jan 23, 2019 10:37 am    Post subject: The activation question twice will work Reply with quote

Hello , my code is as follows
Code:
----mod random vip----
function hackClick(sender)
----Scan hack--------------
   local szAOB_ScanHack    = "20 A1 C4 82 D1 AA 60 D4"
   local stringlist=AOBScan(szAOB_ScanHack);
   local firststring = strings_getString(stringlist, 0);
--------------------------------------------------------------------------
   local aob1= "20 A1 C4 82 D1 AA 60 D4"
   local aob2   = "F1 1A 82 D1 AA 60 D4"
   local aob3 = "DF 1A C7 82 D1 AA 60 D4"
   local aob4   = "DF 1A E1 82 D1 AA 60 D4"
   local aob5   = "DF 1A D5 82 D1 AA 60 D4"
-----------------------------------------------------------------
local form = createForm( true );
form.caption="Hack it"

checkBoxes  = createCheckBox( form );
checkBoxes2 = createCheckBox( form );
checkBoxes3 = createCheckBox( form );
checkBoxes4 = createCheckBox( form );

    control_setCaption( checkBoxes, "Checkbox1");
    control_setCaption( checkBoxes2, "Checkbox2");
   control_setCaption( checkBoxes3, "Checkbox3");
   control_setCaption( checkBoxes4, "Checkbox4");

    control_setPosition( checkBoxes, 10,  20 )
    control_setPosition( checkBoxes2, 10,  80 )
    control_setPosition( checkBoxes3, 10,  140 )
    control_setPosition( checkBoxes4, 10,  200 )



------------------------------------------------------------------------------
checkbox_onChange(checkBoxes, test1Click)
time_inc = 0
time1 = 1 -- 5s
time2 = 2 -- 10s
mytimer = mytimer or createTimer(nil, false)
mytimer.Interval = 1000

mytimer.OnTimer = function(timer)

time_inc = time_inc + 1

local time_mod1 = math.mod(time_inc,time1)
local time_mod2 = math.mod(time_inc,time2)

if time_mod1 == 0 then
      autoAssemble(firststring..":\ndb "..aob1);
end
if time_mod2 == 0 then
      autoAssemble( firststring..":\ndb " ..aob2);
    -- My code --
end

if time_inc > 1000 then time_inc = 0 end

end
---------------====checkbox2=====-----------------
checkbox_onChange(checkBoxes2, test2Click)
time3 = 3 -- 5s
time4 = 4 -- 10s
mytimer1 = mytimer1 or createTimer(nil, false)
mytimer1.Interval = 1000

mytimer1.OnTimer = function(timer)

time_inc = time_inc + 1

local time_mod3 = math.mod(time_inc,time3)
local time_mod4 = math.mod(time_inc,time4)

if time_mod3 == 0 then
      autoAssemble(firststring..":\ndb "..aob3);
end
if time_mod4 == 0 then
      autoAssemble( firststring..":\ndb " ..aob4);
    -- My code --
end

if time_inc > 1000 then time_inc = 0 end

end
---------------====checkbox3=====-----------------
checkbox_onChange(checkBoxes3, test3Click)
time4 = 4 -- 5s
time5 = 5 -- 10s
mytimer2 = mytimer2 or createTimer(nil, false)
mytimer2.Interval = 1000

mytimer2.OnTimer = function(timer)

time_inc = time_inc + 1

local time_mod4 = math.mod(time_inc,time4)
local time_mod5 = math.mod(time_inc,time5)

if time_mod4 == 0 then
      autoAssemble(firststring..":\ndb "..aob2);
end
if time_mod5 == 0 then
      autoAssemble( firststring..":\ndb " ..aob5);
    -- My code --
end

if time_inc > 1000 then time_inc = 0 end

end
---------------====checkbox4=====-----------------
checkbox_onChange(checkBoxes4, test4Click)
time6 = 6 -- 5s
time7 = 7 -- 10s
mytimer3 = mytimer3 or createTimer(nil, false)
mytimer3.Interval = 1000

mytimer3.OnTimer = function(timer)

time_inc = time_inc + 1

local time_mod6 = math.mod(time_inc,time6)
local time_mod7 = math.mod(time_inc,time7)

if time_mod6 == 0 then
      autoAssemble(firststring..":\ndb "..aob3);
end
if time_mod7 == 0 then
      autoAssemble( firststring..":\ndb " ..aob1);
    -- My code --
end

if time_inc > 1000 then time_inc = 0 end

end
---------------------------------------------------------------
function test1Click(sender)
if sender.Checked == true then
  showMessage("on hack.")
else
    showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
end
 mytimer.Enabled = sender.Checked
end
----------checkbox2------------
function test2Click(sender)
if sender.Checked == true then
  showMessage("on hack.")
else
    showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
end
 mytimer1.Enabled = sender.Checked
end
----------checkbox3------------
function test3Click(sender)
if sender.Checked == true then
  showMessage("on hack.")
else
    showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
end
 mytimer2.Enabled = sender.Checked
end
----------checkbox4------------
function test4Click(sender)
if sender.Checked == true then
  showMessage("on hack.")
else
    showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
end
 mytimer3.Enabled = sender.Checked
end
end

My question is why I enabled it the second time it can work ?
Is there any way to fix it?
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 122

PostPosted: Thu Jan 24, 2019 4:44 am    Post subject: Reply with quote

I need help, so I post again
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 122

PostPosted: Fri Jan 25, 2019 4:51 am    Post subject: Reply with quote

two days no one helped me Sad
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 28

Joined: 13 Sep 2011
Posts: 1464

PostPosted: Fri Jan 25, 2019 5:06 am    Post subject: Reply with quote

Are you using the latest C.E version?
I did not understand what's the problem, what do you enable the second time? the timer(via test1Click and etc.), or when you execute the whole hackClick function.
Elaborate more so we could help you


EDIT:

Another issue I found in your script, is that you are trying to set the checkbox onChange function with a function that has not been created yet therefore is null, you probably need to create 2 trainers and that's the problem right?
Try this
Code:
----mod random vip----
function hackClick(sender)
----Scan hack--------------
   local szAOB_ScanHack = "20 A1 C4 82 D1 AA 60 D4";
   local stringlist = AOBScan(szAOB_ScanHack);
   local firststring = stringlist.getString(0);
--------------------------------------------------------------------------
   local aob1= "20 A1 C4 82 D1 AA 60 D4"
   local aob2   = "F1 1A 82 D1 AA 60 D4"
   local aob3 = "DF 1A C7 82 D1 AA 60 D4"
   local aob4   = "DF 1A E1 82 D1 AA 60 D4"
   local aob5   = "DF 1A D5 82 D1 AA 60 D4"
   -----------------------------------------------------------------
   local form = createForm( true );
   form.caption="Hack it"
   
   checkBoxes  = createCheckBox( form );
   checkBoxes2 = createCheckBox( form );
   checkBoxes3 = createCheckBox( form );
   checkBoxes4 = createCheckBox( form );
   checkBoxes.Caption = "Checkbox1";
   checkBoxes2.Caption = "Checkbox2";
   checkBoxes3.Caption = "Checkbox3";
   checkBoxes4.Caption = "Checkbox4";
   checkBoxes.setPosition(10, 20)
   checkBoxes2.setPosition(10, 80)
   checkBoxes3.setPosition(10, 140)
   checkBoxes4.setPosition(10, 200)
------------------------------------------------------------------------------
-- checkbox_onChange(checkBoxes, test1Click)
   time_inc = 0
   time1 = 1 -- 5s
   time2 = 2 -- 10s
   mytimer = mytimer or createTimer(nil, false)
   mytimer.Interval = 1000
   mytimer.OnTimer = function(timer)
      time_inc = time_inc + 1
      local time_mod1 = math.mod(time_inc,time1)
      local time_mod2 = math.mod(time_inc,time2)
      if time_mod1 == 0 then
         autoAssemble(firststring..":\ndb "..aob1);
      end
      if time_mod2 == 0 then
         autoAssemble( firststring..":\ndb " ..aob2);
         -- My code --
      end
      if time_inc > 1000 then
         time_inc = 0
      end
   end
---------------====checkbox2=====-----------------
-- checkbox_onChange(checkBoxes2, test2Click)
   time3 = 3 -- 5s
   time4 = 4 -- 10s
   mytimer1 = mytimer1 or createTimer(nil, false)
   mytimer1.Interval = 1000
   mytimer1.OnTimer = function(timer)
      time_inc = time_inc + 1
      local time_mod3 = math.mod(time_inc,time3)
      local time_mod4 = math.mod(time_inc,time4)
      if time_mod3 == 0 then
         autoAssemble(firststring..":\ndb "..aob3);
      end
      if time_mod4 == 0 then
         autoAssemble( firststring..":\ndb " ..aob4);
         -- My code --
      end
      if time_inc > 1000 then
         time_inc = 0
      end
   end
---------------====checkbox3=====-----------------
   -- checkbox_onChange(checkBoxes3, test3Click)
   time4 = 4 -- 5s
   time5 = 5 -- 10s
   mytimer2 = mytimer2 or createTimer(nil, false)
   mytimer2.Interval = 1000
   mytimer2.OnTimer = function(timer)
      time_inc = time_inc + 1
      local time_mod4 = math.mod(time_inc,time4)
      local time_mod5 = math.mod(time_inc,time5)
      if time_mod4 == 0 then
         autoAssemble(firststring..":\ndb "..aob2);
      end
      if time_mod5 == 0 then
         autoAssemble( firststring..":\ndb " ..aob5);
         -- My code --
      end
      if time_inc > 1000 then
         time_inc = 0
      end
   end
---------------====checkbox4=====-----------------
   -- checkbox_onChange(checkBoxes4, test4Click)
   time6 = 6 -- 5s
   time7 = 7 -- 10s
   mytimer3 = mytimer3 or createTimer(nil, false)
   mytimer3.Interval = 1000
   mytimer3.OnTimer = function(timer)
      time_inc = time_inc + 1
      local time_mod6 = math.mod(time_inc,time6)
      local time_mod7 = math.mod(time_inc,time7)
      if time_mod6 == 0 then
         autoAssemble(firststring..":\ndb "..aob3);
      end
      if time_mod7 == 0 then
         autoAssemble( firststring..":\ndb " ..aob1);
         -- My code --
      end
      if time_inc > 1000 then
         time_inc = 0
      end
   end
---------------------------------------------------------------
function test1Click(sender)
   if sender.Checked == true then
      showMessage("on hack.")
   else
      showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
   end
   mytimer.Enabled = sender.Checked
end
----------checkbox2------------
function test2Click(sender)
   if sender.Checked == true then
      showMessage("on hack.")
   else
      showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
   end
   mytimer1.Enabled = sender.Checked
end
----------checkbox3------------
function test3Click(sender)
   if sender.Checked == true then
      showMessage("on hack.")
   else
      showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
   end
   mytimer2.Enabled = sender.Checked
end
----------checkbox4------------
function test4Click(sender)
   if sender.Checked == true then
      showMessage("on hack.")
   else
      showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
   end
      mytimer3.Enabled = sender.Checked
   end
   
   checkBoxes.onChange = test1Click;
   checkBoxes2.onChange = test2Click;
   checkBoxes3.onChange = test3Click;
   checkBoxes4.onChange = test4Click;
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 122

PostPosted: Fri Jan 25, 2019 9:17 am    Post subject: Reply with quote

DaSpamer wrote:
Are you using the latest C.E version?
I did not understand what's the problem, what do you enable the second time? the timer(via test1Click and etc.), or when you execute the whole hackClick function.
Elaborate more so we could help you


EDIT:

Another issue I found in your script, is that you are trying to set the checkbox onChange function with a function that has not been created yet therefore is null, you probably need to create 2 trainers and that's the problem right?
Try this
Code:
----mod random vip----
function hackClick(sender)
----Scan hack--------------
   local szAOB_ScanHack = "20 A1 C4 82 D1 AA 60 D4";
   local stringlist = AOBScan(szAOB_ScanHack);
   local firststring = stringlist.getString(0);
--------------------------------------------------------------------------
   local aob1= "20 A1 C4 82 D1 AA 60 D4"
   local aob2   = "F1 1A 82 D1 AA 60 D4"
   local aob3 = "DF 1A C7 82 D1 AA 60 D4"
   local aob4   = "DF 1A E1 82 D1 AA 60 D4"
   local aob5   = "DF 1A D5 82 D1 AA 60 D4"
   -----------------------------------------------------------------
   local form = createForm( true );
   form.caption="Hack it"
   
   checkBoxes  = createCheckBox( form );
   checkBoxes2 = createCheckBox( form );
   checkBoxes3 = createCheckBox( form );
   checkBoxes4 = createCheckBox( form );
   checkBoxes.Caption = "Checkbox1";
   checkBoxes2.Caption = "Checkbox2";
   checkBoxes3.Caption = "Checkbox3";
   checkBoxes4.Caption = "Checkbox4";
   checkBoxes.setPosition(10, 20)
   checkBoxes2.setPosition(10, 80)
   checkBoxes3.setPosition(10, 140)
   checkBoxes4.setPosition(10, 200)
------------------------------------------------------------------------------
-- checkbox_onChange(checkBoxes, test1Click)
   time_inc = 0
   time1 = 1 -- 5s
   time2 = 2 -- 10s
   mytimer = mytimer or createTimer(nil, false)
   mytimer.Interval = 1000
   mytimer.OnTimer = function(timer)
      time_inc = time_inc + 1
      local time_mod1 = math.mod(time_inc,time1)
      local time_mod2 = math.mod(time_inc,time2)
      if time_mod1 == 0 then
         autoAssemble(firststring..":\ndb "..aob1);
      end
      if time_mod2 == 0 then
         autoAssemble( firststring..":\ndb " ..aob2);
         -- My code --
      end
      if time_inc > 1000 then
         time_inc = 0
      end
   end
---------------====checkbox2=====-----------------
-- checkbox_onChange(checkBoxes2, test2Click)
   time3 = 3 -- 5s
   time4 = 4 -- 10s
   mytimer1 = mytimer1 or createTimer(nil, false)
   mytimer1.Interval = 1000
   mytimer1.OnTimer = function(timer)
      time_inc = time_inc + 1
      local time_mod3 = math.mod(time_inc,time3)
      local time_mod4 = math.mod(time_inc,time4)
      if time_mod3 == 0 then
         autoAssemble(firststring..":\ndb "..aob3);
      end
      if time_mod4 == 0 then
         autoAssemble( firststring..":\ndb " ..aob4);
         -- My code --
      end
      if time_inc > 1000 then
         time_inc = 0
      end
   end
---------------====checkbox3=====-----------------
   -- checkbox_onChange(checkBoxes3, test3Click)
   time4 = 4 -- 5s
   time5 = 5 -- 10s
   mytimer2 = mytimer2 or createTimer(nil, false)
   mytimer2.Interval = 1000
   mytimer2.OnTimer = function(timer)
      time_inc = time_inc + 1
      local time_mod4 = math.mod(time_inc,time4)
      local time_mod5 = math.mod(time_inc,time5)
      if time_mod4 == 0 then
         autoAssemble(firststring..":\ndb "..aob2);
      end
      if time_mod5 == 0 then
         autoAssemble( firststring..":\ndb " ..aob5);
         -- My code --
      end
      if time_inc > 1000 then
         time_inc = 0
      end
   end
---------------====checkbox4=====-----------------
   -- checkbox_onChange(checkBoxes4, test4Click)
   time6 = 6 -- 5s
   time7 = 7 -- 10s
   mytimer3 = mytimer3 or createTimer(nil, false)
   mytimer3.Interval = 1000
   mytimer3.OnTimer = function(timer)
      time_inc = time_inc + 1
      local time_mod6 = math.mod(time_inc,time6)
      local time_mod7 = math.mod(time_inc,time7)
      if time_mod6 == 0 then
         autoAssemble(firststring..":\ndb "..aob3);
      end
      if time_mod7 == 0 then
         autoAssemble( firststring..":\ndb " ..aob1);
         -- My code --
      end
      if time_inc > 1000 then
         time_inc = 0
      end
   end
---------------------------------------------------------------
function test1Click(sender)
   if sender.Checked == true then
      showMessage("on hack.")
   else
      showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
   end
   mytimer.Enabled = sender.Checked
end
----------checkbox2------------
function test2Click(sender)
   if sender.Checked == true then
      showMessage("on hack.")
   else
      showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
   end
   mytimer1.Enabled = sender.Checked
end
----------checkbox3------------
function test3Click(sender)
   if sender.Checked == true then
      showMessage("on hack.")
   else
      showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
   end
   mytimer2.Enabled = sender.Checked
end
----------checkbox4------------
function test4Click(sender)
   if sender.Checked == true then
      showMessage("on hack.")
   else
      showMessage("off hack")
      autoAssemble(firststring..":\ndb "..szAOB_ScanHack);
   end
      mytimer3.Enabled = sender.Checked
   end
   
   checkBoxes.onChange = test1Click;
   checkBoxes2.onChange = test2Click;
   checkBoxes3.onChange = test3Click;
   checkBoxes4.onChange = test4Click;
end

I have applied your code , it is completely inactive

In the button hackClick I created a new from
In this from, when this word works, it will run the AOB
Code:
local szAOB_ScanHack = "20 A1 C4 82 D1 AA 60 D4";

However, I have to turn it off and click it again to work
The version I am using is version 6.7 but when I use version 6.8 my following code still does not work.
Code:
--title game--
function TitleText(OriginalCaption,RootOwner,classNameOrHWND)
  if type(OriginalCaption)=='boolean' then
    OriginalCaption,RootOwner,classNameOrHWND = nil,OriginalCaption,RootOwner
  end
  if type(RootOwner)~='boolean' then
    RootOwner,classNameOrHWND = true,RootOwner
  end
  local pid,wn = GetOpenedProcessID()
  if type(classNameOrHWND)=='number' then
    wn = classNameOrHWND                      -- use windowhandle directly
  elseif type(classNameOrHWND)=='string' then
    wn = findWindow(classNameOrHWND)          -- by ClassName
  elseif type(OriginalCaption)=='string' then
    wn = findWindow(nil,OriginalCaption)      -- by caption
  elseif pid~=0 then
    wn = findWindow(nil,GetWindowlist()[pid]) -- by attached pid
  end
  if wn and wn~=0 then
    local own,max = GetWindow(wn,4),1000
    if RootOwner then                          -- find the topmost owner
      while own~=0 and own~=wn and max>0 do
        max,wn,own = max-1,own,GetWindow(own,4)--get owner window
      end
    end
    return function(newCaption)  -- new function to change Caption
      local lpStr = createMemoryStream()
      lpStr.write(stringToByteTable(tostring(newCaption).."\0"))
      sendMessage(wn,0xc--[[WM_SETTEXT ]],nil--[[not used]],lpStr.Memory)
      lpStr.Destroy()
    end,wn
  end
end
-------------------------------------------------------------------
    local NewCaption = TitleText()-- no parameter to find root owner/topmost window of the attached process

  if NewCaption then -- NewCaption is Global Variable, may be fail to get a right window
    NewCaption("Hack Success !")
    end
end

I need your help , thank you
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 28

Joined: 13 Sep 2011
Posts: 1464

PostPosted: Fri Jan 25, 2019 1:08 pm    Post subject: Reply with quote

When does it throw that error message?
After you call 'hackClick'? could you add print to each checkBox(s) onChange method so we could examine together based on your output.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
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