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 


problem with redundant trainer option . (CE trainer)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
happyreadygo
Advanced Cheater
Reputation: 1

Joined: 14 Sep 2011
Posts: 87

PostPosted: Sat Jan 14, 2012 9:50 pm    Post subject: problem with redundant trainer option . (CE trainer) Reply with quote

Hello ,everybody

I sucessfully create my trainer at full functional.
but one thing problem.

the trainer need to enable hack before every option( it ll be crash if not). the options are very redundant(for good pratice is we shouldn't duplicate code)

for example.

hotkey effect
alt+1 enable hack
alt+1 add money
alt+2 enable hack(duplicate)
alt+2 add speed
alt+2 add HP
alt+3 enable hack(duplicate again)
alt+3 xxxx
alt+4 enable hack(..)
.
.
.

what i think is if I turn on enable hack at the trainer start.
or disable and hide others option before enable hack option is on.
but i don't know how.

or can we conbind the options with same hotkey.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

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

PostPosted: Sat Jan 14, 2012 10:45 pm    Post subject: Reply with quote

I take it the add XXX entries are just hotkeys for memoryrecords right ? (No special script, or something you toggle on/off)

The easiest method is declaring the "onOpenProcess" function and in there enable the cheats:
e.g:
Code:

function onOpenProcess(processid)
  reinitializeSymbolhandler() --important to call this
 
  --here either call autoAssemble([[yourscript]]) or
  --mr=addresslist_getMemoryRecordByDescription(getAddressList(),"Description of Record with hack script")
  --memoryrecord_freeze(mr)
end


Note though that when a process has just opened it sometimes happens that the affected code has not be loaded just yet (dll's, JIT, etc...)
In those cases you need to create a timer that enables the script and only on successful enabling make the functions available to the users. (and disable the timer)

Alternatively, you could use
Code:

createHotkey("functionname", key1, key2, key3,...)

And in "functionname" always enable the script if it has to be enabled
Multiple hotkeys can be assigned to the same function, and the same hotkey can be used by cheat entry tables (Note that table hotkeys execute their action before lua hotkeys...)


There are lots of other methods as well (like doing the add using a createHotkey as well...)

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Jan 22, 2012 2:19 pm    Post subject: Reply with quote

personally, I'm not enabling cheats inside onOpenProcess.


I'm using this after "generate trainer from table":
Code:
addresslist=getAddressList()

RequiredMemrec=addresslist_getMemoryRecordByID(addresslist,7)
-- note, RequiredMemrec points to cheat table AA script without hotkey
-- and it is required for other scripts(cheats)
-- it can contain registered symbols

-- it this case, required script is 7th cheat entry (it's ID is 7)
-- alternatively you can give it a description "RequiredMemrec" (or "MainScript", "MasterScript"):
-- RequiredMemrec = addresslist_getMemoryRecordByDescription(addresslist, 'RequiredScript')
(....) -- autogenerated code (other addresslist_get... and etc.), or your code

processOpened=false

function onOpenProcess(processid)
  processOpened=true
end

function onHotkey0(Hotkey)
 if processOpened then

  if ( memoryrecord_isActive(RequiredMemrec) == false ) then
    memoryrecord_freeze(RequiredMemrec)
  end
 
  if memoryrecord_isActive(RequiredMemrec) then
 
   (....) -- your AA code. Or other things: writeFloat, writeByte, (etc.) with registered symbols
   
   cheatcomponent_setActive(CETrainer_CHEAT0, true, 1500)

   beep()
  end
 end
end

memoryrecordhotkey_onHotkey(memrec0_hotkey0,onHotkey0)

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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