View previous topic :: View next topic |
Author |
Message |
FIRESKY Newbie cheater Reputation: 0
Joined: 01 Mar 2017 Posts: 16
|
Posted: Fri Sep 07, 2018 4:53 am Post subject: Change different scripts |
|
|
Hi everyone, my goal is change everything through edit.
Last edited by FIRESKY on Sat Sep 08, 2018 2:48 pm; edited 2 times in total |
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri Sep 07, 2018 5:31 am Post subject: |
|
|
If you want to do it by number why do you want to use the description?
There are 3 ways to access memory records in CE, AddressList[i], AddressList.getMemoryRecordByID, and getMemoryRecordByDescription. The first two both use numbers, the first based on the position in the address list and the second based on unique numbers saved in the CT file (that you could open in a text editor and change).
Ah, you're not letting the user disable arbitrary things by number...Though I'm not certain what you are trying to do either.
That code makes no sense btw... a text field / edit box doesn't have a "state" to get, nor could it's state be both 1 and 2 as the 2nd and 3rd checks would imply...
perhaps you just mean something like Code: | -- AddressList exists since 6.7
local script1 = AddressList.getMemoryRecordByDescription("Infinite Health")
local script2 = AddressList.getMemoryRecordByDescription("Infinite Items")
function toggle()
script1.Active = not script1.Active
script2.Active = not script2.Active
end
function CEToggleBox1Click(sender)
toggle()
end |
If you want to change them separately... just have separate checkboxes rather than an edit box that you have to type into and check the Text of and compare it to see if the user even gave valid input etc. and then have to explain to the user what number does what etc. etc.
_________________
|
|
Back to top |
|
|
FIRESKY Newbie cheater Reputation: 0
Joined: 01 Mar 2017 Posts: 16
|
Posted: Fri Sep 07, 2018 6:19 am Post subject: |
|
|
Solved tx
Last edited by FIRESKY on Sat Sep 08, 2018 2:43 pm; edited 1 time in total |
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri Sep 07, 2018 7:03 am Post subject: |
|
|
Why not a combolist/listview that has each script name/description then? Easier than typing a number etc. If you really really just want to use CEEDIT and numbers then I guess you could do something like
Code: | --setup
--CETrainer = UDF1 -- testing with manually created form
local _ = AddressList.getMemoryRecordByDescription
-- [1]=, [2]= are unnecessary, but make the mapping explicit/obvious
memrec_mapping = {[1]=_"Infinite Health", [2]=_"Infinite Ammo"}
function disableToggleBox(tb)
tb.Tag = 0
tb.Checked = false
tb.Enabled = false
end
function enableToggleBox(tb,mr)
-- save mr address in tag to avoid having to redo mapping
-- though in this case it's relatively simple it could be
-- more advanced if say, you allowed typing part of the name
-- as long as it uniquely ided the script eg 'ammo'
tb.Tag = userDataToInteger(mr)
tb.Checked = mr.Active
tb.Enabled = true
end
-- start out unset/unusable, until a valid mapping is typed in
disableToggleBox(CETrainer.CEToggleBox1)
function CEEdit1Change(sender) -- update TB when user is typing
local mr = memrec_mapping[tonumber(CETrainer.CEEdit1.Text)]
if not mr then disableToggleBox(CETrainer.CEToggleBox1)
else enableToggleBox(CETrainer.CEToggleBox1,mr) end
end
function CEToggleBox1Click(sender) -- update mr state on click
local mr = integerToUserData(sender.Tag)
if not mr then return end
mr.Active = sender.Checked
end |
I don't really recommend it from the user's perspective but of course it's possible.
_________________
|
|
Back to top |
|
|
FIRESKY Newbie cheater Reputation: 0
Joined: 01 Mar 2017 Posts: 16
|
Posted: Sat Sep 08, 2018 4:05 am Post subject: |
|
|
I tested and copied this script exactly as you did it, it does not work and it also disables the button, I was looking for something simpler.
I do not need to disable or enable a button, I do not want to change the button in any way, I just wanted to activate different scripts using a number typed on CEEDIT, and activated by pressing a simple button or ToggleBox.
If anyone had any other ideas, they are welcome.
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Sep 08, 2018 10:04 am Post subject: |
|
|
Code: | function CEToggleBox1Click(sender)
local n = ({[1]="Infinite Health", [2]="Infinite Ammo"})[tonumber(CETrainer.CEEdit1.Text)]
if not n then return end
local mr = AddressList.getMemoryRecordByDescription(n)
if not mr then return end
mr.Active = not mr.Active
end | but that's even worse imo than something that actually shows whether the id is valid and whether it's currently active or not (A checkbox will be checked obviously but even a togglebox button has a slightly different color to it to indicate it's state, if you just want a button then just use a button not a toggle box with a separate state).
You're not going to get much simpler than that if you want them to type arbitrary numbers in rather than numbers CE already knows like the memrec position or id or the full description (eg. "Infinite Health") mentioned in my first post.
_________________
|
|
Back to top |
|
|
FIRESKY Newbie cheater Reputation: 0
Joined: 01 Mar 2017 Posts: 16
|
Posted: Sat Sep 08, 2018 2:40 pm Post subject: |
|
|
Finally, this is exactly what I was looking for, thank you!
|
|
Back to top |
|
|
|