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 


Cheat Engine Forum Index
PostGo back to topic
AylinCE
Grandmaster Cheater Supreme
Reputation: 33
Joined: 16 Feb 2017
Posts: 1343

PostPosted: Thu May 02, 2024 9:08 am    Post subject:

I based it on the entries in the picture.
That is, when you click on the button on the side, the entry list in the button function is loaded and focuses on the name in the address description.

First click the button, then select a value from the list.

When you select a value from the list, the address will change with numbers.
So if "182:Warrior Attack 2" is selected, it will push 182 to the address.
If you want to change this and print "Warrior Attack 2" to the address (the value appears as a string in the picture), change this to "l2" in the relevant code snippet.

Code:
        if l2==l3 then
         CheatEdt1.Value=l1 -- l2 <<<<--------
         CEtrainer.Edt2.Text = CheatEdt1.Value
         print("Value: "..l1.."\nName: "..l2)
        end


Code:
if frm1 then frm1.Destroy() frm1=nil end
frm1=createForm()

CEtrainer = {}
CEtrainer.CTComboBox1=createComboBox(frm1)
CEtrainer.CTComboBox1.Left=30
CEtrainer.CTComboBox1.Top=50
CEtrainer.CTComboBox1.ReadOnly=true
CEtrainer.CTComboBox1.Style='csDropDownList'

CEtrainer.Btn1=createButton(frm1)
CEtrainer.Btn1.Left=140 CEtrainer.Btn1.Top=50
CEtrainer.Btn1.Caption="Samurai"

CEtrainer.Btn2=createButton(frm1)
CEtrainer.Btn2.Left=140 CEtrainer.Btn2.Top=80
CEtrainer.Btn2.Caption="Ashigaru"

CEtrainer.Btn3=createButton(frm1)
CEtrainer.Btn3.Left=140 CEtrainer.Btn3.Top=110
CEtrainer.Btn3.Caption="Archer"

CEtrainer.Btn4=createButton(frm1)
CEtrainer.Btn4.Left=140 CEtrainer.Btn4.Top=160
CEtrainer.Btn4.Caption="Value Update"

CEtrainer.Edt1=createEdit(frm1)
CEtrainer.Edt1.Left=50 CEtrainer.Edt1.Top=161

CEtrainer.Edt2=createEdit(frm1)
CEtrainer.Edt2.Left=30 CEtrainer.Edt2.Top=111

local condition = {
 Samurai = {"1:Samurai","11:Warrior Attack","182:Warrior Attack 2","215:Guard Break"},
 Ashigaru = {"3:Ashigaru","131:Ashigaru Attack","184:Ashigaru Attack 2"},
 Archer = {"13:Archer","31:Bow Attack","30:Bow Attack Plus","171:Yamamoto Sweeping Fire"}}

for i,k in pairs(condition) do
     for j,l in pairs(condition[i]) do
       l1 = l:match(":(.*)")
       CEtrainer.CTComboBox1.Items.Add(l1)
     end
end
CEtrainer.CTComboBox1.ItemIndex=0

getMemRecByDesc = getAddressList().getMemoryRecordByDescription
local CheatEdt1

function Samurai()
CheatEdt1=getMemRecByDesc("Main Attack")
CEtrainer.Edt2.Text = CheatEdt1.Value
CEtrainer.CTComboBox1.Clear()
 for i,k in pairs(condition.Samurai) do
   k1 = k:match(":(.*)")
  CEtrainer.CTComboBox1.Items.Add(k1)
 end
CEtrainer.CTComboBox1.ItemIndex=0
end

function Ashigaru()
CheatEdt1=getMemRecByDesc("Special Attack")
CEtrainer.Edt2.Text = CheatEdt1.Value
CEtrainer.CTComboBox1.Clear()
 for i,k in pairs(condition.Ashigaru) do
   k1 = k:match(":(.*)")
  CEtrainer.CTComboBox1.Items.Add(k1)
 end
CEtrainer.CTComboBox1.ItemIndex=0
end

function Archer()
CheatEdt1=getMemRecByDesc("Passive Skill")
CEtrainer.Edt2.Text = CheatEdt1.Value
CEtrainer.CTComboBox1.Clear()
 for i,k in pairs(condition.Archer) do
   k1 = k:match(":(.*)")
  CEtrainer.CTComboBox1.Items.Add(k1)
 end
CEtrainer.CTComboBox1.ItemIndex=0
end

CEtrainer.CTComboBox1.OnChange=function()
  if CEtrainer.CTComboBox1.ItemIndex==0 then
    CEtrainer.CTComboBox1.Clear()
    for i,k in pairs(condition) do
     for j,l in pairs(condition[i]) do
       l1 = l:match(":(.*)")
       CEtrainer.CTComboBox1.Items.Add(l1)
     end
    end
    CEtrainer.CTComboBox1.ItemIndex=0
  end
  for i,k in pairs(condition) do
     for j,l in pairs(condition[i]) do
       l1,l2 = l:match("(.*):(.*)")
        l3 = CEtrainer.CTComboBox1.Items[CEtrainer.CTComboBox1.ItemIndex]
        if l2==l3 then
         CheatEdt1.Value=l1 -- string = l2
         CEtrainer.Edt2.Text = CheatEdt1.Value
         print("Value: "..l1.."\nName: "..l2)
        end
     end
  end
end

function searchValue()
local val = CEtrainer.Edt1.Text
local tbl
local res = 0
 if CEtrainer.Edt1.Text~="" then
  for i,k in pairs(condition) do
     for j,l in pairs(condition[i]) do
       l1 = l:match("(.*):")
        if l1==val then
         tbl=condition[i]
         res=1
        end
     end
  end
 else
   showMessage("Please write a value in the box!")
 end
    if res==1 then
      CEtrainer.CTComboBox1.Clear()
      for i,k in pairs(tbl) do
        k1 = k:match(":(.*)")
        CEtrainer.CTComboBox1.Items.Add(k1)
      end
        CEtrainer.CTComboBox1.ItemIndex=0
    else
      showMessage("The specified value was not found!")
    end
end

CEtrainer.Btn1.OnClick=Samurai
CEtrainer.Btn2.OnClick=Ashigaru
CEtrainer.Btn3.OnClick=Archer
CEtrainer.Btn4.OnClick=searchValue

_________________
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
Post reviews:   Approve 1
Author Review
buyx86
Review: Approve
Post reference:
ReviewPosted: Thu May 02, 2024 9:15 am

Your help will be the first step for me in learning this. This is the first cheat table I am making, and your help is much appreciated.
Back to top
View user's profile Send private message Yahoo Messenger
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites