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 


Custom Box

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
moon1
How do I cheat?
Reputation: 0

Joined: 11 Apr 2022
Posts: 5

PostPosted: Thu Apr 14, 2022 1:20 am    Post subject: Custom Box Reply with quote

Hello,

I need help with this one. I'm fairly new to cheat engine and wanted to ask what type of box do I need to use for it to have a drop down box and choose one whenever I want to change the value of my scan. (Refer to first photo)

And if guys have a sample code for that type of boxes that I can play with that would be very helpful!

Thank you in advance.



277821869_949297252407590_2433894437245997977_n.png
 Description:
 Filesize:  1.91 KB
 Viewed:  1423 Time(s)

277821869_949297252407590_2433894437245997977_n.png


Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Thu Apr 14, 2022 11:51 am    Post subject: Reply with quote

This is not a tutorial, moved to Lua section.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Thu Apr 14, 2022 12:12 pm    Post subject: Reply with quote

It's just called a combobox. You can set the values based on the itemindex of the combobox.

For example:
Code:

-- Check if the form exists, if so then destroy it
if f then f.destroy(); f = nil end
-- Create a new form and assign some properties
local f = createForm(getMainForm())
f.Caption = 'Dropdown Example'
f.BorderStyle = 'bsDialog'
f.Position = 'poScreenCenter'
f.Height = 100
f.Width = 250

local combobox = createComboBox(f)
-- Width/Height of the combobox
combobox.Width = 100
combobox.Height = 30
-- Align centrally for both horizontal/vertical axes
combobox.Left = (f.Width - combobox.Width) / 2
combobox.Top = (f.Height - combobox.Height) / 2
-- Populate the combobox with some entries
for i = 0, 10 do
  combobox.Items.Add('Item ' .. tostring(i))
end
-- What to do when we change the value of the combobox
combobox.OnChange = function()
                     f.Caption = 'Item Selected is : ' .. combobox.Items[combobox.ItemIndex]
                    end
Back to top
View user's profile Send private message
moon1
How do I cheat?
Reputation: 0

Joined: 11 Apr 2022
Posts: 5

PostPosted: Thu Apr 14, 2022 2:04 pm    Post subject: Reply with quote

Thank you for this one LeFIXER. After how many tries on switching codes from my normal buttons to this comboBox, still haven't figured it out. Can you please help me figure out on how can I combine my codes to make it applicable for a comboBox. Just an overview on how can I do it would be great. Here's my code for my normal boxes.


Code:
CETrainer.CEButton1.OnClick=function() --AOE LEVEL 1 ..
  local mr1 = AddressList.getMemoryRecordByDescription('AOE')
  mr1.value = 1500
  CETrainer.CELabel1.caption="Level 1 AOE Active!"
end

CETrainer.CEButton2.OnClick=function() --AOE LEVEL 2.
  local mr1 = AddressList.getMemoryRecordByDescription('AOE')
  mr1.value = 2000
  CETrainer.CELabel1.caption="Level 2 AOE Active!"
end

CETrainer.CEButton3.OnClick=function() --AOE LEVEL 3.
  local mr1 = AddressList.getMemoryRecordByDescription('AOE')
  mr1.value = 2500
  CETrainer.CELabel1.caption="Level 3 AOE Active!"
end

CETrainer.CEButton4.OnClick=function() --AOE OFF.
  local mr1 = AddressList.getMemoryRecordByDescription('AOE')
  mr1.value = '43a'
  CETrainer.CELabel1.caption="AOE is turned off!"
end

-- AS --
if frzTim1 then frzTim1.Destroy() frzTim1=nil end
frzTim1=createTimer(false) frzTim1.Interval=1 frzTim1.Enabled=false

local adrr1=""
local val1=0
local frzIndex=0

frzTim1.OnTimer=function()
frzIndex = tonumber(frzIndex) + 1
 if frzIndex==150 then --15=1500 msec, 1.5 sec .. 150=15.000 msec, 15 sec
  adrr1.Active = false
  frzTim1.Enabled=false
  else
  adrr1.Value = val1
  adrr1.Active = true
 end
end

CETrainer.CEButton5.OnClick=function() --AS LEVEL 1 ..
  adrr1 = AddressList.getMemoryRecordByDescription('AS')
  val1 = 0.4
  frzIndex=0
  frzTim1.Enabled=true
  CETrainer.CELabel3.caption="Level 1 AS Active!"
end

CETrainer.CEButton6.OnClick=function() --AS LEVEL 2.
  adrr1 = AddressList.getMemoryRecordByDescription('AS')
  val1 = 0.8
  frzIndex=0
  frzTim1.Enabled=true
  CETrainer.CELabel3.caption="Level 2 AS Active!"
end

CETrainer.CEButton7.OnClick=function() --AS LEVEL 3.
  adrr1 = AddressList.getMemoryRecordByDescription('AS')
  val1 = 1
  frzIndex=0
  frzTim1.Enabled=true
  CETrainer.CELabel3.caption="Level 3 AS Active!"
end

CETrainer.CEButton8.OnClick=function() --AS OFF.
  adrr1 = AddressList.getMemoryRecordByDescription('AS')
  val1 = 0.18
  frzIndex=0
  frzTim1.Enabled=true
  CETrainer.CELabel3.caption="AS is turned off!"
end
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 30

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Thu Apr 14, 2022 2:58 pm    Post subject: Reply with quote

Some features have changed for use.
You can rearrange this according to your script.

Code:
-- AS --
if frzTim1 then frzTim1.Destroy() frzTim1=nil end
frzTim1=createTimer(false) frzTim1.Interval=1 frzTim1.Enabled=false

local adrr1=""
local val1=0
local frzIndex=1500
local cboxIndex=0
local cptn=""

frzTim1.OnTimer=function()
frzIndex = tonumber(frzIndex) - 1
 if frzIndex==0 then
  adrr1.Active = false
  CETrainer.CELabel3.caption=cptn .. " >> ".. frzIndex .. " <<"
  frzTim1.Enabled=false
  else
  adrr1.Value = val1
  adrr1.Active = true
  CETrainer.CELabel3.caption=cptn .. " >> ".. frzIndex .. " <<"
 end
end


function asL1() --AS LEVEL 1 ..
  adrr1 = AddressList.getMemoryRecordByDescription('AS')
  val1 = 0.4
  frzIndex=1500
  frzTim1.Enabled=true
  cptn="Level 1 AS Active!"
end

function asL2() --AS LEVEL 2.
  adrr1 = AddressList.getMemoryRecordByDescription('AS')
  val1 = 0.8
  frzIndex=1500
  frzTim1.Enabled=true
  cptn="Level 2 AS Active!"
end

function asL3() --AS LEVEL 3.
  adrr1 = AddressList.getMemoryRecordByDescription('AS')
  val1 = 1
  frzIndex=1500
  frzTim1.Enabled=true
  cptn="Level 3 AS Active!"
end

function asLOff() --AS OFF.
  adrr1 = AddressList.getMemoryRecordByDescription('AS')
  val1 = 0.18
  frzIndex=1500
  frzTim1.Enabled=true
  cptn="AS is turned off!"
end

CETrainer.CEComboBox1.clear()
CETrainer.CEComboBox1.Items.Add("Level Select")
CETrainer.CEComboBox1.Items.Add("Level 1 AS")
CETrainer.CEComboBox1.Items.Add("Level 2 AS")
CETrainer.CEComboBox1.Items.Add("Level 3 AS")
CETrainer.CEComboBox1.Items.Add("Level OFF")
CETrainer.CEComboBox1.ItemIndex="0"

CETrainer.CEComboBox1.OnChange=function()
cboxIndex=CETrainer.CEComboBox1.ItemIndex
 if cboxIndex==1 then asL1() end
 if cboxIndex==2 then asL2() end
 if cboxIndex==3 then asL3() end
 if cboxIndex==4 then asLOff() end
end

CETrainer.CEButton5.OnClick=function() --AS LEVEL 1 ..
CETrainer.CEComboBox1.ItemIndex=1
CETrainer.CEComboBox1.OnChange()
end

CETrainer.CEButton6.OnClick=function() --AS LEVEL 2 ..
CETrainer.CEComboBox1.ItemIndex=2
CETrainer.CEComboBox1.OnChange()
end

CETrainer.CEButton7.OnClick=function() --AS LEVEL 3 ..
CETrainer.CEComboBox1.ItemIndex=3
CETrainer.CEComboBox1.OnChange()
end

CETrainer.CEButton8.OnClick=function() --AS LEVEL off ..
CETrainer.CEComboBox1.ItemIndex=4
CETrainer.CEComboBox1.OnChange()
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
moon1
How do I cheat?
Reputation: 0

Joined: 11 Apr 2022
Posts: 5

PostPosted: Fri Apr 15, 2022 5:52 am    Post subject: Reply with quote

I managed to play with the codes and are fully functioning now. Thank you AylineCE and LeFIXER!
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