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 


Execute 2 hotkey functions by clicking 1 Hotkey (HELP)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
DTeCH
Newbie cheater
Reputation: 0

Joined: 19 Jul 2013
Posts: 23
Location: Cayman Islands

PostPosted: Wed Apr 23, 2014 8:57 am    Post subject: Execute 2 hotkey functions by clicking 1 Hotkey (HELP) Reply with quote

Hello again dudes Very Happy


I want to have both (or more) hotkeys executed, or just the code of each executed by a single hotkey trigger... the multiple beeps are driving me nutty. Razz

Here's my code so far:

Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="16">
  <Forms>
    <CETrainer Class="TTrainerForm" Encoding="Ascii85">R E M O V E D</CETrainer>
  </Forms>
  <CheatEntries>
    <CheatEntry>
      <ID>5</ID>
      <Description>"Experiment Bow Ammo 1"</Description>
      <Color>80000008</Color>
      <VariableType>4 Bytes</VariableType>
      <Address>"GAME.dll"+008EF7C4</Address>
      <Offsets>
        <Offset>41C</Offset>
        <Offset>48</Offset>
        <Offset>354</Offset>
        <Offset>6CC</Offset>
        <Offset>614</Offset>
      </Offsets>
      <Hotkeys>
        <Hotkey>
          <Action>Toggle Activation</Action>
          <Keys>
            <Key>112</Key>
          </Keys>
          <Description>AmmoLock</Description>
          <ID>0</ID>
        </Hotkey>
        <Hotkey>
          <Action>Set Value</Action>
          <Keys>
            <Key>113</Key>
          </Keys>
          <Value>999</Value>
          <Description>Ammo999</Description>
          <ID>1</ID>
        </Hotkey>
      </Hotkeys>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
  <LuaScript>
--TRAINERGENERATORSTART--
--This is autogenerated code. Changing code in this block will
--get erased and rewritten if you regenerate the trainer code

--Uncomment the following line if this is a Cheat Table format trainer and you don't want CE to show (Tip, save as .CETRAINER alternatively)
--hideAllCEWindows()

RequiredCEVersion=6.3
if (getCEVersion==nil) or (getCEVersion()&lt;RequiredCEVersion) then
  messageDialog('Please install Cheat Engine '..RequiredCEVersion, mtError, mbOK)
  closeCE()
end
addresslist=getAddressList()
memrec5=addresslist_getMemoryRecordByID(addresslist,5)

memrec5_hotkey0=memoryrecord_getHotkeyByID(memrec5,0)
memrec5_hotkey1=memoryrecord_getHotkeyByID(memrec5,1)

function onPostHotkey0(Hotkey)
  --Executed after the "toggle*" cheat got executed
  local memrec=memoryrecordhotkey_getOwner(Hotkey)
  local isActive=memoryrecord_isActive(memrec) --get the state after the hotkey got triggered
  cheatcomponent_setActive(CETrainer_CHEAT0, isActive)
  if gBeepOnAction then
    beep()
  end
end

memoryrecordhotkey_onPostHotkey(memrec5_hotkey0,onPostHotkey0)

function onHotkey1(Hotkey)
  --Executed before the hotkey is handled
  cheatcomponent_setActive(CETrainer_CHEAT1, true, 1500)
  if gBeepOnAction then
    beep()
  end
end

memoryrecordhotkey_onHotkey(memrec5_hotkey1,onHotkey1)
control_setVisible(CETrainer_SEPERATOR, false)

strings_add(getAutoAttachList(), "GAME.exe")
gBeepOnAction=true
form_show(CETrainer)
function AboutClick()
  showMessage(gAboutText)
end
gAboutText=[[DTeCH]]

function CloseClick()
  closeCE()
  return caFree --onClick doesn't care, but onClose would like a result
end

--TRAINERGENERATORSTOP--
</LuaScript>
</CheatTable>


F1 will do one thing, & F2 another, but I want to click F1, & have the thingy both set the value, AND Lock it in one click ( F1 + F2 ). Smile without heariing 2, or sometimes 4 system Beeps/Dings.

I have seen it done, but not in CE LUA script.

Help + TAX lol

EDIT:

I changed the title Smile

Anyway, is it even possible to trigger the execution of other hotkeys by clicking just one?

The following is where I'm getting confused:

Code:


--        <Hotkey>
--          <Action>Toggle Activation</Action>
--          <Keys>
--            <Key>112</Key> ---- F1
--          </Keys>
--          <Description>AmmoLock</Description>
--          <ID>0</ID>
--        </Hotkey>
--        <Hotkey>
--          <Action>Set Value</Action>
--          <Keys>
--            <Key>113</Key> ---- F2
--          </Keys>
--          <Value>999</Value>
--          <Description>Ammo999</Description>
--          <ID>1</ID>
--        </Hotkey>

-------- How are these used, or what do they do? --------
memrec5_hotkey0=memoryrecord_getHotkeyByID(memrec5,0) ---- AmmoLock?
memrec5_hotkey1=memoryrecord_getHotkeyByID(memrec5,1) ---- Ammo999?
-----------------------------------------------------------------


function onPostHotkey0(Hotkey) ---- Is this fired after the Hotkey0 completes executing... ie: Locked the Ammo, or does one of the lines of code inside execute it? (Which one)
  --Executed after the "toggle*" cheat got executed
  local memrec=memoryrecordhotkey_getOwner(Hotkey)
  local isActive=memoryrecord_isActive(memrec) --get the state after the hotkey got triggered
  cheatcomponent_setActive(CETrainer_CHEAT0, isActive)
  if gBeepOnAction then
    beep()
  end
end

--------------------- What does this do? ---------------------
memoryrecordhotkey_onPostHotkey(memrec5_hotkey0,onPostHotkey0)
-----------------------------------------------------------------


I just want to allow both to execute when I click F1... Set Ammo to 999, then LOCK it, then Beep. Smile

ps: Would this do it?
Code:
function onPostHotkey0(Hotkey)
  --Executed after the "toggle*" cheat got executed
  local memrec=memoryrecordhotkey_getOwner(Hotkey)
  local isActive=memoryrecord_isActive(memrec) --get the state after the hotkey got triggered
  cheatcomponent_setActive(CETrainer_CHEAT0, isActive)
  cheatcomponent_setActive(CETrainer_CHEAT1, isActive) ---- ??? :)
  if gBeepOnAction then
    beep()
  end
end


...or this?
Code:
function onPostHotkey0(Hotkey)
  --Executed after the "toggle*" cheat got executed
  local memrec=memoryrecordhotkey_getOwner(Hotkey)
  local isActive=memoryrecord_isActive(memrec) --get the state after the hotkey got triggered
  cheatcomponent_setActive(CETrainer_CHEAT0, isActive)
  onHotkey1(113) ---- ??? :)
  if gBeepOnAction then
    beep()
  end
end

function onHotkey1(Hotkey)
  --Executed before the hotkey is handled
  cheatcomponent_setActive(CETrainer_CHEAT1, true, 1500)
--  if gBeepOnAction then
--    beep()
--  end
end

_________________
Hitler... When all else fails, you'll be in the right state of mind. Jesus Saves.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
DTeCH
Newbie cheater
Reputation: 0

Joined: 19 Jul 2013
Posts: 23
Location: Cayman Islands

PostPosted: Thu Apr 24, 2014 5:09 am    Post subject: Reply with quote

Well, this is the absolute longest I've ever waited for a response here, so, I guess it can't be done, or no one knows how.

...or someone is writing a long long long response full of details that takes time to write, test, & check. lol - That would be nice. Smile

_________________
Hitler... When all else fails, you'll be in the right state of mind. Jesus Saves.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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