View previous topic :: View next topic |
Author |
Message |
lewis08 How do I cheat? Reputation: 0
Joined: 18 Jul 2023 Posts: 8
|
Posted: Tue Jul 18, 2023 7:22 am Post subject: How to change the value in the lua which is preset with tabl |
|
|
Hi, i'm trying to convert a ready table to a trainer. I wanted to use Trackbars to change the value. But i have no idea how to do that with lua. Also values are edited in the table that i use so i cannot access to the exact values. Just look to the images i hope you'll understand what i meant better.
Description: |
|
Filesize: |
94.14 KB |
Viewed: |
2043 Time(s) |
|
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Tue Jul 18, 2023 8:34 am Post subject: |
|
|
It would be better to show the settings you have for this address. Also, is the address static?
|
|
Back to top |
|
|
lewis08 How do I cheat? Reputation: 0
Joined: 18 Jul 2023 Posts: 8
|
Posted: Tue Jul 18, 2023 8:44 am Post subject: |
|
|
LeFiXER wrote: | It would be better to show the settings you have for this address. Also, is the address static? |
Which settings do you want? Also yes, adresses are static, so you don't have to use a pointer, it is same everytime. You can see the adress on the SS. As i said i cannot see the exact values, but if i right click and select show as hex, the %X power text changes to something like 3F666666. But i'm not sure about if this is the value that it changes to.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Tue Jul 18, 2023 10:09 am Post subject: |
|
|
Right-click the entry within the Cheat Table and select 'Set/Change dropdown selection options'. This will prompt with a new window. Copy and paste what you see there here.
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 33
Joined: 16 Feb 2017 Posts: 1330
|
Posted: Tue Jul 18, 2023 11:12 am Post subject: |
|
|
Try this example.
If the idea is right, take what you need from it.
Code: | if CETrainer1 then CETrainer1.Destroy() CETrainer1=nil end
DP1=getScreenDPI()/96
CETrainer1=createForm()
CETrainer1.height=173*DP1 CETrainer1.width=476*DP1 CETrainer1.left=577*DP1 CETrainer1.top=129*DP1
CETrainer1.PopupMode=0 CETrainer1.caption=""
CETrainer1.Position="poDesktopCenter" CETrainer1.BorderStyle="bsSingle" CETrainer1.ShowInTaskBar="stAlways"
-------------------------
local CETrainer = {}
----------------------- CETrainer.CETrackBar1 -----
CETrainer.CETrackBar1=createTrackBar(CETrainer1)
CETrainer.CETrackBar1.AutoSize=false
CETrainer.CETrackBar1.height=29*DP1 CETrainer.CETrackBar1.width=436*DP1 CETrainer.CETrackBar1.left=20*DP1 CETrainer.CETrackBar1.top=25*DP1
CETrainer.CETrackBar1.Max=10 CETrainer.CETrackBar1.Min=0 CETrainer.CETrackBar1.Position=5
-----------------------
----------------------- CETrainer.CEComboBox1 -----
CETrainer.CEComboBox1=createComboBox(CETrainer1)
CETrainer.CEComboBox1.AutoSize=true
CETrainer.CEComboBox1.height=23*DP1 CETrainer.CEComboBox1.width=164*DP1 CETrainer.CEComboBox1.left=160*DP1 CETrainer.CEComboBox1.top=124*DP1
CETrainer.CEComboBox1.text=""
CETrainer.CEComboBox1.Font.Style="fsBold" CETrainer.CEComboBox1.Font.Size=0*DP1
CETrainer.CEComboBox1.ReadOnly=false CETrainer.CEComboBox1.Style="csDropDownList"
-----------------------
----------------------- CETrainer.CELabel1 -----
CETrainer.CELabel1=createLabel(CETrainer1)
CETrainer.CELabel1.AutoSize=true
CETrainer.CELabel1.height=24*DP1 CETrainer.CELabel1.width=440*DP1 CETrainer.CELabel1.left=22*DP1 CETrainer.CELabel1.top=57*DP1
CETrainer.CELabel1.caption="75 80 85 90 95 100 105 110 115 120 125"
CETrainer.CELabel1.alignment="taCenter"
CETrainer.CELabel1.Font.Style="fsBold" CETrainer.CELabel1.Font.Size=-18*DP1
-----------------------
-------------------------------------------
CETrainer.CEComboBox1.clear()
CETrainer.CEComboBox1.Items.Add("75% Power")
CETrainer.CEComboBox1.Items.Add("80% Power")
CETrainer.CEComboBox1.Items.Add("85% Power")
CETrainer.CEComboBox1.Items.Add("90% Power")
CETrainer.CEComboBox1.Items.Add("95% Power")
CETrainer.CEComboBox1.Items.Add("Normal Power")
CETrainer.CEComboBox1.Items.Add("105% Power")
CETrainer.CEComboBox1.Items.Add("110% Power")
CETrainer.CEComboBox1.Items.Add("115% Power")
CETrainer.CEComboBox1.Items.Add("120% Power")
CETrainer.CEComboBox1.Items.Add("125% Power")
CETrainer.CEComboBox1.ItemIndex=5 -- normal power
CETrainer.CEComboBox1.OnChange=function()
indx = CETrainer.CEComboBox1.ItemIndex
CETrainer.CETrackBar1.Position=indx
end
CETrainer.CETrackBar1.OnChange=function()
print(CETrainer.CETrackBar1.Position)
--Example transaction:
al = getAddressList()
scr = al.getMemoryRecordByDescription("Engine Power Rate [Player]")
scr.Value = 75 + tonumber(CETrainer.CETrackBar1.Position) * 5
end
|
Description: |
|
Filesize: |
64.23 KB |
Viewed: |
2005 Time(s) |
|
_________________
|
|
Back to top |
|
|
lewis08 How do I cheat? Reputation: 0
Joined: 18 Jul 2023 Posts: 8
|
Posted: Tue Jul 18, 2023 12:28 pm Post subject: |
|
|
LeFiXER wrote: | Right-click the entry within the Cheat Table and select 'Set/Change dropdown selection options'. This will prompt with a new window. Copy and paste what you see there here. |
0.75:75% Power
0.80:80% Power
0.85:85% Power
0.90:90% Power
0.95:95% Power
1:Normal Power
1.05:105% Power
1.10:110% Power
1.15:115% Power
1.20:120% Power
1.25:125% Power
There you go. I guess left of the : is the value. As final, how to do that in lua could you please write it?
---
AylinCE wrote: | Try this example.
If the idea is right, take what you need from it.
Code: | if CETrainer1 then CETrainer1.Destroy() CETrainer1=nil end
DP1=getScreenDPI()/96
CETrainer1=createForm()
CETrainer1.height=173*DP1 CETrainer1.width=476*DP1 CETrainer1.left=577*DP1 CETrainer1.top=129*DP1
CETrainer1.PopupMode=0 CETrainer1.caption=""
CETrainer1.Position="poDesktopCenter" CETrainer1.BorderStyle="bsSingle" CETrainer1.ShowInTaskBar="stAlways"
-------------------------
local CETrainer = {}
----------------------- CETrainer.CETrackBar1 -----
CETrainer.CETrackBar1=createTrackBar(CETrainer1)
CETrainer.CETrackBar1.AutoSize=false
CETrainer.CETrackBar1.height=29*DP1 CETrainer.CETrackBar1.width=436*DP1 CETrainer.CETrackBar1.left=20*DP1 CETrainer.CETrackBar1.top=25*DP1
CETrainer.CETrackBar1.Max=10 CETrainer.CETrackBar1.Min=0 CETrainer.CETrackBar1.Position=5
-----------------------
----------------------- CETrainer.CEComboBox1 -----
CETrainer.CEComboBox1=createComboBox(CETrainer1)
CETrainer.CEComboBox1.AutoSize=true
CETrainer.CEComboBox1.height=23*DP1 CETrainer.CEComboBox1.width=164*DP1 CETrainer.CEComboBox1.left=160*DP1 CETrainer.CEComboBox1.top=124*DP1
CETrainer.CEComboBox1.text=""
CETrainer.CEComboBox1.Font.Style="fsBold" CETrainer.CEComboBox1.Font.Size=0*DP1
CETrainer.CEComboBox1.ReadOnly=false CETrainer.CEComboBox1.Style="csDropDownList"
-----------------------
----------------------- CETrainer.CELabel1 -----
CETrainer.CELabel1=createLabel(CETrainer1)
CETrainer.CELabel1.AutoSize=true
CETrainer.CELabel1.height=24*DP1 CETrainer.CELabel1.width=440*DP1 CETrainer.CELabel1.left=22*DP1 CETrainer.CELabel1.top=57*DP1
CETrainer.CELabel1.caption="75 80 85 90 95 100 105 110 115 120 125"
CETrainer.CELabel1.alignment="taCenter"
CETrainer.CELabel1.Font.Style="fsBold" CETrainer.CELabel1.Font.Size=-18*DP1
-----------------------
-------------------------------------------
CETrainer.CEComboBox1.clear()
CETrainer.CEComboBox1.Items.Add("75% Power")
CETrainer.CEComboBox1.Items.Add("80% Power")
CETrainer.CEComboBox1.Items.Add("85% Power")
CETrainer.CEComboBox1.Items.Add("90% Power")
CETrainer.CEComboBox1.Items.Add("95% Power")
CETrainer.CEComboBox1.Items.Add("Normal Power")
CETrainer.CEComboBox1.Items.Add("105% Power")
CETrainer.CEComboBox1.Items.Add("110% Power")
CETrainer.CEComboBox1.Items.Add("115% Power")
CETrainer.CEComboBox1.Items.Add("120% Power")
CETrainer.CEComboBox1.Items.Add("125% Power")
CETrainer.CEComboBox1.ItemIndex=5 -- normal power
CETrainer.CEComboBox1.OnChange=function()
indx = CETrainer.CEComboBox1.ItemIndex
CETrainer.CETrackBar1.Position=indx
end
CETrainer.CETrackBar1.OnChange=function()
print(CETrainer.CETrackBar1.Position)
--Example transaction:
al = getAddressList()
scr = al.getMemoryRecordByDescription("Engine Power Rate [Player]")
scr.Value = 75 + tonumber(CETrainer.CETrackBar1.Position) * 5
end
|
|
great base, thats really cool thank you. but i already have the menu and i can check for changes on the trackbar via lua. but my main question is how to rewrite the memory (with the values in ready CT) with that trackbar.
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 33
Joined: 16 Feb 2017 Posts: 1330
|
Posted: Tue Jul 18, 2023 12:43 pm Post subject: |
|
|
Use this function in the example I gave above.
Code: | local valueTable = {0.75, 0.80, 0.85, 0.90, 0.95, 1, 1.05, 1.10, 1.15, 1.20, 1.25}
CETrainer.CETrackBar1.OnChange=function()
print(CETrainer.CETrackBar1.Position)
--Example transaction:
al = getAddressList()
scr = al.getMemoryRecordByDescription("Engine Power Rate [Player]")
scr.Value = valueTable[tonumber(CETrainer.CETrackBar1.Position) +1]
end |
Of course "Float" will interpret these values differently.
(0.80 >> 0.8000000119)
_________________
|
|
Back to top |
|
|
lewis08 How do I cheat? Reputation: 0
Joined: 18 Jul 2023 Posts: 8
|
Posted: Tue Jul 18, 2023 1:23 pm Post subject: |
|
|
AylinCE wrote: | Use this function in the example I gave above.
Code: | local valueTable = {0.75, 0.80, 0.85, 0.90, 0.95, 1, 1.05, 1.10, 1.15, 1.20, 1.25}
CETrainer.CETrackBar1.OnChange=function()
print(CETrainer.CETrackBar1.Position)
--Example transaction:
al = getAddressList()
scr = al.getMemoryRecordByDescription("Engine Power Rate [Player]")
scr.Value = valueTable[tonumber(CETrainer.CETrackBar1.Position) +1]
end |
Of course "Float" will interpret these values differently.
(0.80 >> 0.8000000119) |
Somehow this doesnt works. Pasted exact code to lua but this doesnt apply to the game. But however it works normally with direct from CT. Maybe we can directly change the value of adress that we have from ct. (instead of grabbing address from its name and using a table.) Like seperatly checking the tracker for position 0/1/2/3.. and rewriting the memory in the way i meant(i know its noobway but ) Anyways thanks for your effort..
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Tue Jul 18, 2023 7:05 pm Post subject: |
|
|
lewis08 wrote: |
Somehow this doesnt works. Pasted exact code to lua but this doesnt apply to the game. But however it works normally with direct from CT. Maybe we can directly change the value of adress that we have from ct. (instead of grabbing address from its name and using a table.) Like seperatly checking the tracker for position 0/1/2/3.. and rewriting the memory in the way i meant(i know its noobway but ) Anyways thanks for your effort.. |
Something like this would work also:
Code: |
if f then f.destroy(); f = nil end
-- Set address of engine power here --
---------------------------------------------------
local engine_power_address = 0x13DFF0033
---------------------------------------------------
f = createForm(getMainForm())
f.Caption = 'Set Engine Power'
f.Width = 300
f.Height = 135
f.Left = 400
f.Top = 300
local tb = createTrackBar(f)
tb.Height = 25
tb.Width = 280
tb.Top = (f.Height - tb.Height) / 2
tb.Left = 10
tb.Max = 125
tb.Min = 75
tb.Frequency = 5
tb.PageSize = 5
tb.OnChange = function()
local value = tb.Position
f.Caption = ('Selected Power: %s%%'):format(value)
writeFloat(engine_power_address, value / 100)
end
local lbl = createLabel(f)
lbl.Caption = 'Engine Power Rate:'
lbl.Width = 100
lbl.Height = 28
lbl.Top = tb.Top - (lbl.Height + 2)
lbl.Left = 17
|
Just set the address in the script to the correct one since you said it's a static address it shouldn't change with every restart.
|
|
Back to top |
|
|
lewis08 How do I cheat? Reputation: 0
Joined: 18 Jul 2023 Posts: 8
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Wed Jul 19, 2023 6:24 am Post subject: |
|
|
lewis08 wrote: |
great and clean code, works perfectly. i just added more trackbars and features. but i just figured out that addresses change each time i open the game(also on the cheat table). how to grab the address from cheat table?
just tried
Code: |
gad = getAddressList()
local engine_power_address = gad.getMemoryRecordByDescription("Engine Power Rate [Player]")
|
and same to write memory on tb change;
Code: |
writeFloat(engine_power_address, value / 100)
|
but this doesnt seems working |
I've made some adjustments:
Code: |
if f then f.destroy(); f = nil end
local engine_power = AddressList.MemoryRecord['Engine Power Rate [Player]']
if engine_power ~= nil then
f = createForm(getMainForm())
f.Caption = 'Set Engine Power'
f.Width = 300
f.Height = 135
f.Left = 400
f.Top = 300
local tb = createTrackBar(f)
tb.Height = 25
tb.Width = 280
tb.Top = (f.Height - tb.Height) / 2
tb.Left = 10
tb.Max = 125
tb.Min = 75
tb.Frequency = 5
tb.PageSize = 5
tb.OnChange = function()
local value = tb.Position
f.Caption = ('Selected Power: %s%%'):format(value)
if engine_power.Address ~= nil then
writeFloat(engine_power.Address, value / 100)
else
error('Invalid Engine Power Address')
end
end
local lbl = createLabel(f)
lbl.Caption = 'Engine Power Rate:'
lbl.Width = 100
lbl.Height = 28
lbl.Top = tb.Top - (lbl.Height + 2)
lbl.Left = 17
else
error('Could not find "Engine Power Rate [Player]" within the cheat table.')
end
|
Some error checking and changes for adaptability. Cheat Engine always displays the full value written and there doesn't appear to be a way to round the value at least in memory. Visually there are ways but it has no effect on the value displayed within the address list.
|
|
Back to top |
|
|
|