View previous topic :: View next topic |
Author |
Message |
lampuiho Expert Cheater Reputation: 6
Joined: 16 Jan 2010 Posts: 122
|
Posted: Sun Mar 18, 2012 11:53 pm Post subject: Disabling one script when another is turned on |
|
|
I have two scripts that alter the same instruction address (HP hack)
Please give me hints on how to do it in CE
|
|
Back to top |
|
|
Kavvman Master Cheater Reputation: 2
Joined: 17 Apr 2004 Posts: 316
|
Posted: Mon Mar 19, 2012 4:58 am Post subject: |
|
|
In your auto assemble code under the [DISABLE] label put the original game code so when you uncheck the script it will restore the game code back to normal
_________________
... |
|
Back to top |
|
|
Freiza Grandmaster Cheater Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Mon Mar 19, 2012 6:01 am Post subject: |
|
|
make a global variable and assign a value to it, when one script is compared to true activate it or activate the second script.
_________________
|
|
Back to top |
|
|
lampuiho Expert Cheater Reputation: 6
Joined: 16 Jan 2010 Posts: 122
|
Posted: Tue Mar 20, 2012 12:51 am Post subject: |
|
|
Freiza wrote: | make a global variable and assign a value to it, when one script is compared to true activate it or activate the second script. |
You mean
Code: | cheatcomponent_isActive(CETrainer_CHEAT2) |
??
EDIT: Nvm, I think you meant making another auto assembly code to make the global variable to activate the scripts. I don't think I can do it with Lua.
But I have two scripts on the table and I don't know the codes so much to make a single script to include those scripts and the trigger mechanism for the scripts.
Too bad that cheatengine is so limited.
Actually now I think my question was pretty bad because I know how it should do it but I just don't know the codes to make it work.
|
|
Back to top |
|
|
Freiza Grandmaster Cheater Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Tue Mar 20, 2012 10:58 am Post subject: |
|
|
Code: | addresslist = getAddressList()
cheat1= [[description1]] -- Just put the description of 1st cheat script here.
cheat2= [[description2]] -- Put the description of 2 cheat script here.
memoryrec1 = addresslist_getMemoryRecordByDescription(addresslist,cheat1)
memoryrec2 = addresslist_getMemoryRecordByDescription(addresslist,cheat2)
memoryrecord_onActivate(memoryrec1,func1)
memoryrecord_onActivate(memoryrec2,func2)
function func1(memoryrec,before,currentstate)
memoryrecord_unfreeze(memoryrec2)
return true
end
function func2(memoryrec,before,currentstate)
memoryrecord_unfreeze(memoryrec1)
return true
end |
It will set only one cheat at a time. Put the cheat description as mentioned in code.
_________________
|
|
Back to top |
|
|
lampuiho Expert Cheater Reputation: 6
Joined: 16 Jan 2010 Posts: 122
|
Posted: Wed Mar 21, 2012 10:13 pm Post subject: |
|
|
Freiza wrote: | Code: | addresslist = getAddressList()
cheat1= [[description1]] -- Just put the description of 1st cheat script here.
cheat2= [[description2]] -- Put the description of 2 cheat script here.
memoryrec1 = addresslist_getMemoryRecordByDescription(addresslist,cheat1)
memoryrec2 = addresslist_getMemoryRecordByDescription(addresslist,cheat2)
memoryrecord_onActivate(memoryrec1,func1)
memoryrecord_onActivate(memoryrec2,func2)
function func1(memoryrec,before,currentstate)
memoryrecord_unfreeze(memoryrec2)
return true
end
function func2(memoryrec,before,currentstate)
memoryrecord_unfreeze(memoryrec1)
return true
end |
It will set only one cheat at a time. Put the cheat description as mentioned in code. |
I haven't tried your code but with my code. It does disable the other cheat (not sure if it's just visual) but it does not set the hotkey state. So let's say if one of the hotkeys is F5 and the other is F6. After pressing F5, you press F6 and you deactivate F5 option and activate F6. But next time you press F5 again, you deactivate F6 without turning on F5 because the trainer thinks F5 is still activated.
So my question is, using the generated code, how do I change the hotkey state as well ( I used cheatcomponent_setActive)
EDIT: Nvm, I used memoryrecord_unfreeze as you mentioned and it now looks okay (pressing F5 activates F5 and deactivate F6 visually)
But the script is not actually activated. Why? please
more information:
If the table was opened in CE, manually ticking the checkbox activates the script normally but after executing the script, pressing hotkeys does tick/untick the checkbox but the script does not run unless the checkboxes are ticked manually with the mouse pointer.
EDIT2: I know why now, it deactivates the other only after itself is activated (pressing F6 activates it and then deactivate F5 which is bad because it runs the disable script and turns the code back to original code)
How do I deactivate F5 before F6 is activated?
Code: | function onPostHotkey1(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_CHEAT1, isActive)
memoryrecord_unfreeze(memrec313)
memoryrecord_unfreeze(memrec311)
if isActive then
memoryrecord_freeze(memrec311)
end
cheatcomponent_setActive(CETrainer_CHEAT2, false)
if gBeepOnAction then
beep()
end
end
memoryrecordhotkey_onPostHotkey(memrec311_hotkey0,onPostHotkey1)
function onPostHotkey2(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_CHEAT2, isActive)
memoryrecord_unfreeze(memrec311)
memoryrecord_unfreeze(memrec313)
if isActive then
memoryrecord_freeze(memrec313)
end
cheatcomponent_setActive(CETrainer_CHEAT1, false)
if gBeepOnAction then
beep()
end
end
memoryrecordhotkey_onPostHotkey(memrec313_hotkey0,onPostHotkey2) |
The above code is the temporary solution but it is slow. Hope someone can answer my question in EDIT2: please
|
|
Back to top |
|
|
Freiza Grandmaster Cheater Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Thu Mar 22, 2012 3:05 am Post subject: |
|
|
Use memoryrecord_onActivate(memoryrecord, function)
memoryrecord_isActive, because
isActive is tested only after your cheat has been activated.
onActivate is triggered two times, once before your memoryrecord becomes active and one just after it has been activated.
So you can write code that deactivates F5 before F6 is activated if you use onActivate function.
_________________
|
|
Back to top |
|
|
lampuiho Expert Cheater Reputation: 6
Joined: 16 Jan 2010 Posts: 122
|
Posted: Sat Mar 24, 2012 12:45 am Post subject: |
|
|
Freiza wrote: | Use memoryrecord_onActivate(memoryrecord, function)
memoryrecord_isActive, because
isActive is tested only after your cheat has been activated.
onActivate is triggered two times, once before your memoryrecord becomes active and one just after it has been activated.
So you can write code that deactivates F5 before F6 is activated if you use onActivate function. |
cheers
here is my final code
Code: | function func1(memoryrec,before,currentstate)
if memrec313isActive then
memoryrecord_unfreeze(memrec313)
memrec313isActive=false
cheatcomponent_setActive(CETrainer_CHEAT2, false)
end
memrec311isActive=currentstate
return true
end
function func2(memoryrec,before,currentstate)
if memrec311isActive then
memoryrecord_unfreeze(memrec311)
memrec311isActive=false
cheatcomponent_setActive(CETrainer_CHEAT1, false)
end
memrec313isActive=currentstate
return true
end |
|
|
Back to top |
|
|
|