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 


Very simple script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
liquidmetal17
How do I cheat?
Reputation: 0

Joined: 14 Sep 2013
Posts: 2
Location: Pittsburgh, PA, USA

PostPosted: Sat Sep 14, 2013 1:31 pm    Post subject: Very simple script Reply with quote

Hello,

I have a very simple script that I'd like to use in a cheat table and I was hoping someone here would be willing to help. I have a fair amount of programming knowledge, but assembly is where I started to go cross-eyed and said "enough is enough." All I'm looking for is an autoassembler script that acts according to the following logic:


Code:
if(value of 21FFE941 == 0)
{
     freeze value of 20416888 to 0
     }
     else
     {
     unfreeze 20416888
}


A huge thank you to anyone who chooses to help me out here.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sat Sep 14, 2013 2:32 pm    Post subject: Reply with quote

if you have entry of the address (20416888) in cheat engine you can use this
Code:
if (readInteger(0x21FFE941)==1) then
   getAddressList().getMemoryRecordByDescription("Address To Change").Value = 0; -- Sets value to 0, make sure your address has the same description
   -- Or you change the "Address To Change" to your address description
   getAddressList().getMemoryRecordByDescription("Address To Change").Active = true;
end


If you don't you can use this.

Code:
if (readInteger(0x21FFE941)==1) then
   FreezeTimer = FreezeTimer or createTimer(nil,false);
   FreezeTimer.Interval = 50; -- 100 Ms
   FreezeTimer.onTimer = function () writeInteger(0x20416888,0) end; -- Writes Integer value to the address
   FreezeTimer.Enabled = true;
   FreezeTimer.onTimer(); -- Activates it, so effect will be instantly, and not 100ms later...
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
liquidmetal17
How do I cheat?
Reputation: 0

Joined: 14 Sep 2013
Posts: 2
Location: Pittsburgh, PA, USA

PostPosted: Sat Sep 14, 2013 9:08 pm    Post subject: Reply with quote

Thank you for responding, DaSpamer. When I tried to use that code, it gave me an "attempt to index a userdata value" error. I sort of got it to work by replacing the "getAddress..." part with "writeInteger", but it isn't providing the functionality that I'm after. Basically, I want the script to be constantly running and monitoring the value of 0x21FFE941. If the value is 0, I want to freeze the value of 0x2041688 to 0. If the value is 1, I want to unfreeze the value of 0x2041688 and let it do whatever it wants.

Thank you for your assistance.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sat Sep 14, 2013 9:25 pm    Post subject: Reply with quote

Code:

FreezeTimer = createTimer(nil,false);
FreezeTimer.Interval = 50; -- 50 Ms
FreezeTimer.onTimer = function ()
                     if (readInteger(0x21FFE941)==1) then
                        writeInteger(0x20416888,0);
                     end;
                 end;
FreezeTimer.Enabled = true;
FreezeTimer.onTimer();

-- To destroy the timer execute this code,and stop it, remove the -- before it.
-- FreezeTimer.destroy()

_________________
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