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 


AutoAssembly AutoDisable by Timer

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

Joined: 31 Aug 2013
Posts: 305

PostPosted: Sun Jul 03, 2016 1:18 pm    Post subject: AutoAssembly AutoDisable by Timer Reply with quote

Hi

Maybe,I ask this question or request.
How to make lua script Timer for auto uncheck checkbox(disable) in Script2:

This is health script for cheat engine 6.4 Tutorial Program:

Script1:
Code:
[Enable]
alloc(HEALTH,2048)
label(RETURNHERE_HEALTH)

label(PLAYERH_1)
label(PLAYERH_FLAG)
registersymbol(PLAYERH_FLAG)

label(ENEMYH_1)
label(ENEMYH_FLAG)
registersymbol(ENEMYH_FLAG)

label(HEALTH_ORIG)

HEALTH:
cmp [ebx+10],1
je PLAYERH_1
jmp ENEMYH_1


PLAYERH_1:
cmp [PLAYERH_FLAG],0
je HEALTH_ORIG
mov [ebx+04],000003E7
fstp dword ptr [ebp-30]
jmp RETURNHERE_HEALTH

PLAYERH_FLAG:
dd 0


ENEMYH_1:
cmp [ENEMYH_FLAG],0
je HEALTH_ORIG
fadd dword ptr [ebx+04]
fstp dword ptr [ebp-30]
jmp RETURNHERE_HEALTH

ENEMYH_FLAG:
dd 0


HEALTH_ORIG:
fsubr dword ptr [ebx+04]
fstp dword ptr [ebp-30]
jmp RETURNHERE_HEALTH

"Tutorial-i386.exe"+27D7D:
jmp HEALTH
nop
RETURNHERE_HEALTH:

[Disable]
dealloc(HEALTH)
"Tutorial-i386.exe"+27D7D:
fsubr dword ptr [ebx+04]
fstp dword ptr [ebp-30]

unregistersymbol(PLAYERH_FLAG)
unregistersymbol(ENEMYH_FLAG)



Script2:
Code:
[Enable]

{$lua}
   //--Lua script here
{$asm}

PLAYERH_FLAG:
dd 1

[Disable]

{$lua}
   //--Lua script here
{$asm}

PLAYERH_FLAG:
dd 0


Thanks for your answers
*SJL002*
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jul 03, 2016 2:09 pm    Post subject: Reply with quote

Code:
{$lua}
if syntaxcheck then return end
[ENABLE]
writeInteger("PLAYERH_FLAG", 1)
if mytimer == nil then
  mytimer = createTimer(nil, false)
  mytimer.Interval = 1000
  mytimer.OnTimer = function(timer)
    getAddressList().getMemoryRecordByDescription("Script2").Active = false
  end
end
mytimer.Enabled = true
[DISABLE]
mytimer.Enabled = false
writeInteger("PLAYERH_FLAG", 0)
Back to top
View user's profile Send private message
sjl002
Master Cheater
Reputation: 0

Joined: 31 Aug 2013
Posts: 305

PostPosted: Sun Jul 03, 2016 2:16 pm    Post subject: Reply with quote

Thanks Zanzer this lua script work perfectly.

Q1:
This script make this Error and not uncheck script:
Error:[string "local syntaxcheck=......"]:8: attempt to index a nil value
My description is (Infinite Health) and i think this error for my description but when put in "Description" (Script2) my problem solve.Why?

Q2:
Ican use only from Description "Script2" and not can use other text .Why? Question Shocked Sad
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jul 03, 2016 3:48 pm    Post subject: Reply with quote

Save, close, and reopen the table.

By surrounding the code in that IF statement, it didn't recreate the function with your new name after you first tested it.
Back to top
View user's profile Send private message
sjl002
Master Cheater
Reputation: 0

Joined: 31 Aug 2013
Posts: 305

PostPosted: Sun Jul 03, 2016 10:45 pm    Post subject: Reply with quote

This lua script work perfectly.

Thanks for your great helping Zanzer.
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