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 


[ask help] shorthest way to write addresslist

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

Joined: 31 Aug 2020
Posts: 29

PostPosted: Mon Jan 11, 2021 6:43 am    Post subject: [ask help] shorthest way to write addresslist Reply with quote

hello, is there any shorthest way to write addresslist on a script?
here the script

Form.show()
local al=getAddressList()
A1=addresslist_getMemoryRecordByDescription(al, "A1")
A2=addresslist_getMemoryRecordByDescription(al, "A2")
A3=addresslist_getMemoryRecordByDescription(al, "A3")
A4=addresslist_getMemoryRecordByDescription(al, "A4")
etc

its ok to write all while only 4 address, but how if i have 300 address to write down in the script? any example will be appreciate it. thanks in advance
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25836
Location: The netherlands

PostPosted: Mon Jan 11, 2021 8:57 am    Post subject: Reply with quote

Code:

A1=AddressList["A1"]
A2=AddressList["A2"]
....



you can of course automate it with a table and a for loop that uses some string concatentations

e.g
Code:

A={}
for i=1,400 do
  A[i]=AddressList["A"..i]
end


and then access it with A[1] for A1 etc...

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Mon Jan 11, 2021 12:25 pm    Post subject: Reply with quote

Why are you trying to list?
Make it exist and start using it.

Code:
if f then f.destroy() end

f=createForm()
f.Position=poDesktopCenter
f.Width=200
f.Height=200

local A1=createCheckBox(f) A1.Left=40 A1.Top=20 A1.caption="Hack 1" A1.Name="A1"

local A5=createCheckBox(f) A5.Left=40 A5.Top=45 A5.caption="Hack 5" A5.Name="A5"

local cb1=createComboBox(f) cb1.Left=40 cb1.Top=80

mr1 = getAddressList().createMemoryRecord()
               mr1.Type = vtAutoAssembler
               mr1.Script = '[ENABLE]\n\n\n[DISABLE]'
               mr1.Description = 'A1'

mr5 = getAddressList().createMemoryRecord()
               mr5.Type = vtAutoAssembler
               mr5.Script = '[ENABLE]\n\n\n[DISABLE]'
               mr5.Description = 'A5'

local al = getAddressList()

cb1.Clear()
cb1.Items.Add("Select Hack!")
for x = 1, 299 do
cb1.Items.Add("A"..x)
end

cb1.ItemIndex=0

cb1.OnChange=function()
local capt1=cb1.Text
local Index1=cb1.ItemIndex
mem1 = addresslist_getMemoryRecordByDescription(al, capt1)
if Index1==0 then return end
if mem1==nil then
showMessage("Make sure the valid name is in the address list.")
return
else
if (mem1.Active==false) then
memoryrecord_freeze(mem1)
showMessage("The hack is active.")
else
memoryrecord_unfreeze(mem1)
showMessage("Hack is not active")
end
end
end

A1.OnChange=function(sender)
local nm=sender.name
mem1 = addresslist_getMemoryRecordByDescription(al, nm)
if mem1==nil then return end
if sender.checked==true then
memoryrecord_freeze(mem1)
sender.caption="Hack 1 is active"
else
memoryrecord_unfreeze(mem1)
sender.caption="Hack 1"
end
end

A5.OnChange=function(sender)
local nm=sender.name
mem1 = addresslist_getMemoryRecordByDescription(al, nm)
if mem1==nil then return end
if sender.checked==true then
memoryrecord_freeze(mem1)
sender.caption="Hack 5 is active"
else
memoryrecord_unfreeze(mem1)
sender.caption="Hack 5"
end
end
Back to top
View user's profile Send private message
icsmoke+
Cheater
Reputation: 0

Joined: 31 Aug 2020
Posts: 29

PostPosted: Mon Jan 11, 2021 3:59 pm    Post subject: Reply with quote

thanks guys for the reply
i have to list the address because i have to put that addres to a function and button with timer
something like this

Form.show()
local al=getAddressList()
A1=addresslist_getMemoryRecordByDescription(al, "A1")
A2=addresslist_getMemoryRecordByDescription(al, "A2")
A3=addresslist_getMemoryRecordByDescription(al, "A3")
A4=addresslist_getMemoryRecordByDescription(al, "A4")

AToggleBox1 = Form.MombeToggleBox1
on = cbChecked
off = cbUnchecked
heal = 1

function foo()
if tonumber(health.getValue()) == heal
then
A1.Value="0"
A2.Value="0"
A3.Value="0"
A4.Value="0"
end
end

function Form_AToggleBox1Change(sender)
if (Form.AToggleBox1.State == on) then
AToggleBox1.Caption = "on"
t1=createTimer(nil)
timer_setInterval(t1, 100)
timer_onTimer(t1, foo)
timer_setEnabled(t1, true)
else
AToggleBox1.Caption = "off"
timer_setEnabled(t1, false)
t1.Destroy()
t1=nil
end
end
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