View previous topic :: View next topic |
Author |
Message |
staticfluids How do I cheat? Reputation: 0
Joined: 11 Jan 2018 Posts: 4
|
Posted: Thu Jan 11, 2018 9:02 pm Post subject: about active=true and active=false |
|
|
Code: | function CEButton1Click(sender)
getAddressList().getMemoryRecordByDescription("ActivateItFirst").Active=true
end
function CEButton2Click(sender)
getAddressList().getMemoryRecordByDescription("Player Training").Active=true
getAddressList().getMemoryRecordByDescription("Remove countdown").Active=true
getAddressList().getMemoryRecordByDescription("More efficient training").Active=true
getAddressList().getMemoryRecordByDescription("Unlimited Training Sessions").Active=true
getAddressList().getMemoryRecordByDescription("Training Everyday").Active=true
getAddressList().getMemoryRecordByDescription("Training sim - A").Active=true
end |
the button works only for activating the cheat but i cant disable it, what code should i put in there? i mean how to put active=true and active=false each time i click the button?
sorry guys im new into this. i got interested on how things work in CE trainer.
thanks, have a great day.
Last edited by staticfluids on Thu Jan 11, 2018 9:28 pm; edited 1 time in total |
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Thu Jan 11, 2018 9:23 pm Post subject: |
|
|
Big Text!
_________________
|
|
Back to top |
|
|
staticfluids How do I cheat? Reputation: 0
Joined: 11 Jan 2018 Posts: 4
|
Posted: Thu Jan 11, 2018 9:28 pm Post subject: |
|
|
TheyCallMeTim13 wrote: | Big Text! |
hehehe
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Thu Jan 11, 2018 11:38 pm Post subject: |
|
|
use mr.Active = not mr.Active to toggle it eg
getAddressList().getMemoryRecordByDescription("Training sim - A").Active= not getAddressList().getMemoryRecordByDescription("Training sim - A").Active
though it's better in several ways to do something like
local mr = getAddressList().getMemoryRecordByDescription("Training sim - A")
mr.Active = not mr.Active
And in this case I'd use a table and a loop
Code: | local getmr = getAddressList().getMemoryRecordByDescription -- you can store functions too
local first = getmr("ActivateItFirst")
function CEButton1Click(sender)
first.Active = not first.Active
end
local button2Mrs = {
getmr("Player Training"),
getmr("Remove countdown"),
getmr("More efficient training"),
getmr("Unlimited Training Sessions"),
getmr("Training Everyday"),
getmr("Training sim - A")
}
function CEButton2Click(sender)
for index, mr in ipairs(button2Mrs) do
mr.Active = not mr.Active
end
end |
with a CheckBox or ToggleBox you'd use mr.Active = sender.Checked that way the script state gets synced to the gui state if anything strange happens, so that if one gets changed and the other doesn't then the next click would fix things rather than leaving it such that off is on and on is off
|
|
Back to top |
|
|
staticfluids How do I cheat? Reputation: 0
Joined: 11 Jan 2018 Posts: 4
|
Posted: Fri Jan 12, 2018 12:16 am Post subject: |
|
|
FreeER wrote: | use mr.Active = not mr.Active to toggle it eg
getAddressList().getMemoryRecordByDescription("Training sim - A").Active= not getAddressList().getMemoryRecordByDescription("Training sim - A").Active
though it's better in several ways to do something like
local mr = getAddressList().getMemoryRecordByDescription("Training sim - A")
mr.Active = not mr.Active
And in this case I'd use a table and a loop
Code: | local getmr = getAddressList().getMemoryRecordByDescription -- you can store functions too
local first = getmr("ActivateItFirst")
function CEButton1Click(sender)
first.Active = not first.Active
end
local button2Mrs = {
getmr("Player Training"),
getmr("Remove countdown"),
getmr("More efficient training"),
getmr("Unlimited Training Sessions"),
getmr("Training Everyday"),
getmr("Training sim - A")
}
function CEButton2Click(sender)
for index, mr in ipairs(button2Mrs) do
mr.Active = not mr.Active
end
end |
with a CheckBox or ToggleBox you'd use mr.Active = sender.Checked that way the script state gets synced to the gui state if anything strange happens, so that if one gets changed and the other doesn't then the next click would fix things rather than leaving it such that off is on and on is off |
sir i just found out the code for the 2nd button has a problem, it doesnt work with the children because when i activate the code, only the "Player Training" is on but the children are off. i forgot to mention that, sorry
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri Jan 12, 2018 7:56 am Post subject: |
|
|
what exactly is the problem? It should toggle all of them individually, if they are on then they are turned off and vice versa.
If you want them all to have the same state after clicking the button then you'd use a state variable and set them all based on that instead of their own active state, eg.
Code: | local button2MrsActive = false -- start assuming they are disabled
function CEButton2Click(sender)
button2MrsActive = not button2MrsActive -- toggle logical state
-- update actual mr states
for index, mr in ipairs(button2Mrs) do
mr.Active = button2MrsActive
end
end |
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Jan 12, 2018 8:15 am Post subject: |
|
|
One thing to ask is "Will these scripts activate alone?", to insure that they will activate at all.
_________________
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri Jan 12, 2018 8:22 am Post subject: |
|
|
TheyCallMeTim13 wrote: | One thing to ask is "Will these scripts activate alone?", to insure that they will activate at all. | Yeah, that's one thing I kind of assumed
If one does depend on another then that may cause issues, making sure it's lower in the list/table than what it depends on should let it enable, disabling may depend on how it actually works (ipairs goes in the same order each time starting at 1, pairs won't but works with non-number indexes, something to remember if you get into using lua more).
And of course if there's one that doesn't enable/disable at all due to a bug in the script then the lua code won't force it to (though there is disableWithoutExecute to force disable a script)
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Jan 12, 2018 8:39 am Post subject: |
|
|
I only say that because, I have spent a lot of time debugging Lua code to find it was a misspelled label or some thing simple like that.
_________________
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri Jan 12, 2018 8:41 am Post subject: |
|
|
yeah, I imagine we've all had that experience lol
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Jan 12, 2018 8:44 am Post subject: |
|
|
You could also use the "autoAssebleCheck" function to check the syntax of AA script from your Lua code.
EDIT:
Note that the "autoAssebleCheck" function is a newly added one, so it's not perfect yet. If you supply even a nil "targetSelf", "enable" is ignored.
_________________
|
|
Back to top |
|
|
staticfluids How do I cheat? Reputation: 0
Joined: 11 Jan 2018 Posts: 4
|
Posted: Sat Jan 13, 2018 2:18 am Post subject: |
|
|
sorry im new into this... i want to make a trainer from that table but not with a hotkey. instead i put the codes into a button, what function or what code should i use... sorry guys.
Description: |
|
Filesize: |
109.29 KB |
Viewed: |
10620 Time(s) |
|
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat Jan 13, 2018 8:34 am Post subject: |
|
|
To put the code in a button you just need a button and then set the OnClick.
Code: |
local format = string.format
local strE = string.empty or STRING_EMPTY or ''
local t = translate
local fW = 400
local row = 0
local lPush = 90
local sX = fW - (lPush + 10)
local sY = 23
local pX = 3
local pY = 3
local bW = 75
local bH = 24
local padF = 5
local pad1 = 3
local pad2 = 1
local frmHookSetup = createForm(false)
frmHookSetup.centerScreen()
frmHookSetup.setSize(fW, fH)
frmHookSetup.Name = 'frmHookSetup'
frmHookSetup.Caption = t('Hook Setup')
local lblHookName = createLabel(frmHookSetup)
lblHookName.Name = 'lblHookName'
lblHookName.setPosition(pX, pY + sY * row + pad1)
lblHookName.Caption = t('Hook Name') .. ':'
local edHookName = createEdit(frmHookSetup)
edHookName.Name = 'edHookName'
edHookName.setSize(sX, sY)
edHookName.setPosition(pX + lPush, pY + sY * row + pad2)
edHookName.Text = ''
row = row + 1
local lblHookAddress = createLabel(frmHookSetup)
lblHookAddress.Name = 'lblHookAddress'
lblHookAddress.setPosition(pX, pY + sY * row + pad1)
lblHookAddress.Caption = t('Address') .. ':'
local edHookAddress = createEdit(frmHookSetup)
edHookAddress.Name ='edHookAddress'
edHookAddress.setSize(sX, sY)
edHookAddress.setPosition(pX + lPush, pY + sY * row + pad2)
edHookAddress.Text = ''
row = row + 1
local btnOk = createButton(frmHookSetup)
btnOk.Name = 'btnOk'
btnOk.Caption = t('OK')
btnOk.setSize(bW, bH)
btnOk.setPosition((fW / 3) - (bW / 2), pY + sY * row + pad2)
btnOk.Default = true
local btnCancel = createButton(frmHookSetup)
btnCancel.Name = 'btnCancel'
btnCancel.Caption = t('Cancel')
btnCancel.setSize(bW, bH)
btnCancel.setPosition(((fW / 3) * 2) - (bW / 2), pY + sY * row + pad2)
btnCancel.Cancel = true
row = row + 1
frmHookSetup.setSize(fW, pY + sY * row + padF)
btnOk.OnClick = function() print('I have the power!') end ---- Setting to OnClick for the OK Button.
function CancelOnClick()
frmHookSetup.close()
end
btnCancel.OnClick = CancelOnClick ---- Setting the OnClick for the Cancel Button.
frmHookSetup.show() |
To use AA scripts just look in to the "autoAssemble" function.
_________________
|
|
Back to top |
|
|
|