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 


Cheat init, enable and disable (LUA+AA)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Fri Feb 25, 2011 6:00 am    Post subject: Cheat init, enable and disable (LUA+AA) This post has 1 review(s) Reply with quote

I'm not sure about this is correcty, but may be useful to someone

Code:
script_Init = "[[
   alloc(Requisition,2048)
   registersymbil(Requisition)
   label(back_Requisition)
   registersymbil(back_Requisition)
   
   Requisition:
   fstp dword ptr [ebx+00000104]
   cmp [ebx+08],3E8
   jne back_Requisition
   cmp [ebx+00000104],47435000
   jg back_Requisition
   mov [ebx+00000104],47435000
   
   DOW2.exe+2144A5:
   jmp Requisition
   nop
   back_Requisition:
   ]]"
   
script_enable = "[[
   DOW2.exe+2144A5:
   jmp Requisition
   nop
   ]]"

script_disable = "[[
   DOW2.exe+2144A5:
   fstp dword ptr [ebx+00000104]
   ]]"

cheatRequisitionINIT = false;
cheatRequisition = true;

while (true) do
 sleep(1000)
 if keyUp(45) then

   if (cheatRequisitionINIT==false)
      autoAssemble(script_Init)
      cheatRequisitionINIT = true
      continue
   end

   if (cheatRequisition==true) then
      autoAssemble(script_enable)
   else
      autoAssemble(script_disable)

   cheatRequisition = not cheatRequisition
 end
end


Last edited by GH*master on Thu Dec 15, 2011 2:01 am; edited 7 times in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Fri Feb 25, 2011 7:36 am    Post subject: Reply with quote

I would rather create a timer object with interval of 1000 instead of
Code:

while (true)
 sleep(1000)


or perhaps a luathread but I have no idea how they work or even if they work

as for the code behind the infinite loop:
1: the if's need then's at the end
2: I have no idea what you mean with " cheatRequisition= cheatRequisition not true "

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Fri Feb 25, 2011 9:32 am    Post subject: Reply with quote

Dark Byte wrote:
2: I have no idea what you mean with " cheatRequisition= cheatRequisition not true "


I mean this:
Code:
if (cheatRequisition==true) then
  cheatRequisition= false
else
  cheatRequisition=true
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Fri Feb 25, 2011 10:00 am    Post subject: Reply with quote

ah, in that case it is "cheatRequisition = not cheatRequisition"
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
hiring_dude
Newbie cheater
Reputation: 0

Joined: 28 Nov 2010
Posts: 20

PostPosted: Tue Dec 13, 2011 3:28 pm    Post subject: Reply with quote

Hi,
i hope it's the good place to post my question since it's related about activation/desactivation of AA script through LUA.
apparently there is only 1 LUA script possible by cheat table.
i also have a lot of AA script and it's not very practical to put my whole AA code in the unique LUA script. Also for debugging/readability reasons i don't particularly want to use the autoAssemble LUA function (too hardcore for me to mix stuff like that) but the memoryrecord table.

after searching the documentation it appear we can access AA script through memoryrecord list. can't we toggle the script "enable/disable" more simply than creating an useless shortcut then memoryrecordhotkey_doHotkey() ?

there is a simple :
boolean = memoryrecord_isActive(memoryrecord);

is there something like :
memoryrecord_setActive(memoryrecord,boolean);

btw what is a CETRAINER File purpose ??
the documentation is quite straight sometime Confused

ps : sorry for my engrish
Back to top
View user's profile Send private message
hiring_dude
Newbie cheater
Reputation: 0

Joined: 28 Nov 2010
Posts: 20

PostPosted: Wed Dec 14, 2011 5:58 am    Post subject: Reply with quote

Ok i think i got the answer..
I'll provide à tutorial soon..
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Wed Dec 14, 2011 9:45 am    Post subject: Reply with quote

Just in case you didn't find your answer, these should be what you are looking for:

memoryrecord_freeze(te, updownfreeze OPTIONAL): sets the entry to frozen state. updownfreeze is optional. 0=freeze, 1=allow increase, 2=allow decrease
memoryrecord_unfreeze(te) :unfreezes an entry

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
hiring_dude
Newbie cheater
Reputation: 0

Joined: 28 Nov 2010
Posts: 20

PostPosted: Wed Dec 14, 2011 2:59 pm    Post subject: Reply with quote

Ohh, right that's exactly what i was searching for !
thanks Wiccaan.

arghh the documentation is quite straight...
so it also toogle AA script.

no need to create a tutorial..
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 Tutorials -> LUA Tutorials 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 cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites