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 


Is it possible to make an 'executor'?

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

Joined: 17 Mar 2020
Posts: 8
Location: nuclear plant

PostPosted: Mon Apr 27, 2020 12:41 pm    Post subject: Is it possible to make an 'executor'? Reply with quote

So, imagine this:

I have a editbox, and you can paste in an auto assembler script. Then, theres an execute button, so, is it possible to make the "Execute" button execute the auto assembler script from the editbox?

_________________
bad ce user with no experience in coding, other than JavaScript, a little of Assembly and Lua
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Apr 27, 2020 2:42 pm    Post subject: Reply with quote

loadstring(scripttext)()
_________________
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
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4694

PostPosted: Mon Apr 27, 2020 3:06 pm    Post subject: Reply with quote

For auto assembler scripts specifically, use the autoAssemble lua function. See celua.txt for documentation and search the forums for examples.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Fri May 08, 2020 6:24 pm    Post subject: what about check box?? Reply with quote

you talked about executer but how to add them to a checkbox. For example, I have an empty checkbox called
Code:
UDF1.CECheckbox
and I want to add on click action how can I do that?? I mean add as a user like the user adds the hack not the trainer maker
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
Back to top
View user's profile Send private message
ProB1
Advanced Cheater
Reputation: 0

Joined: 20 Jul 2019
Posts: 77
Location: At Home

PostPosted: Mon May 11, 2020 1:56 pm    Post subject: Reply with quote

Dark Byte Sent that u can use like That
Create a CEMemo
Create a Panel
later
add a ( panel ) OnClick
later Write

loadstring(UDF1.CEMemo1.lines.text)()

_________________
Hitler Hey im Back Smile
Discord: ProB1#0100
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon May 11, 2020 8:19 pm    Post subject: Reply with quote

If I don't misunderstand, maybe something like this:

Code:
--------------------------------------------------------------------------------
--#Region GUI
--------------------------------------------------------------------------------
if myform then myform.destroy() end

myform = createForm(true)
myform.setSize(700,500)
myform.BorderStyle = 'bsSizeable'
myform.Caption = 'CE Custom Script Engine'
myform.Position = 'poScreenCenter'
myform.Constraints.MinHeight = 235
myform.Constraints.MinWidth = 200

load_dialog = createOpenDialog(myform)
save_dialog = createSaveDialog(myform)

menupanel = createPanel(myform)
menupanel.setSize(120, myform.Height)
menupanel.Align = 'alRight'
menupanel.BorderStyle = 'bsNone'
menupanel.BevelInner = 'bsNone'
menupanel.BevelOuter = 'bsNone'
menupanel.Color = 0x007A7A7A

mainmemo = createMemo(myform)
mainmemo.setPosition(0,0)
mainmemo.Align = 'alClient'
mainmemo.BorderStyle = 'bsSingle'
mainmemo.ScrollBars = 'ssAutoBoth'

cbLua = createCheckBox(menupanel)
cbLua.setPosition(10,10)
cbLua.Caption = 'Lua Script'
cbLua.Checked = true

cbAA = createCheckBox(menupanel)
cbAA.setPosition(10,cbLua.Top + cbLua.Height + 5)
cbAA.Caption = 'Auto Assembler'

btnExecute = createButton(menupanel)
btnExecute.setSize(100,30)
btnExecute.setPosition(10,cbAA.Top + cbAA.Height + 10)
btnExecute.Caption = 'Run Script'

btnSave = createButton(menupanel)
btnSave.setSize(100,30)
btnSave.setPosition(10,370)
btnSave.Anchors = 'akBottom,akRight'
btnSave.Caption = 'Save Script'

btnLoad = createButton(menupanel)
btnLoad.setSize(100,30)
btnLoad.setPosition(10,410)
btnLoad.Anchors = 'akBottom,akRight'
btnLoad.Caption = 'Load Script'

btnReset = createButton(menupanel)
btnReset.setSize(100,30)
btnReset.setPosition(10,450)
btnReset.Anchors = 'akBottom,akRight'
btnReset.Caption = 'Clear'

--------------------------------------------------------------------------------
--#Region functions
--------------------------------------------------------------------------------
local scripts = ""

function reset()
 mainmemo.clear()
 cbLua.Checked = true
 scripts = ""
end

function checkScriptType1()
 if cbLua.Checked == true then
    mainmemo.clear()
    cbAA.Checked = false
    scripts = "print('Hello World')"
    mainmemo.Lines.Text = scripts
 end
end

function checkScriptType2()
 if cbAA.Checked == true then
    mainmemo.clear()
    cbLua.Checked = false
    scripts = '{$lua}\n'..'if syntaxcheck then return end\n'..'print("I have the power")\n'..'{$asm}'
    mainmemo.Lines.Text = scripts
 end
end

function runScript()
 scripts = mainmemo.Lines.Text
 if cbLua.Checked == true then
    loadstring(scripts)()
 else
    autoAssemble(scripts)
 end
end

function saveScript()
 save_dialog.InitalDir = os.getenv('%USERPROFILE%')
 save_dialog.Filter = 'Text files|*.TXT;*.txt|Lua files|*.LUA;*.lua|All files (*.*)|*'
 if save_dialog.execute() then
  local file = save_dialog.FileName
  local fname = file
  contents = mainmemo.Lines.Text
  local file,err = io.open(file,'w')
  if file then
   file:write(contents)
   file:close()
   showMessage('Script has been saved on '..fname)
  else
   showMessage("error:", err)
  end
 else
  return nil
 end
end

local open = io.open
local function read_file(path)
 local file = open(path, "rb")
 if not file then
 showMessage("Error - can't read file content!")
 return nil
 end
 local content = file:read "*a"
 file:close()
 return content
end

function loadScript()
 load_dialog.InitalDir = os.getenv('%USERPROFILE%')
 load_dialog.Filter = 'Text files|*.TXT;*.txt|Lua files|*.LUA;*.lua|All files (*.*)|*'
 if load_dialog.execute() then
    local file = load_dialog.FileName
    local fileContent = read_file(file)
    mainmemo.Clear()
    mainmemo.Lines.Text = fileContent
  else
    return nil
  end
end

--------------------------------------------------------------------------------
--#Region Events handler
--------------------------------------------------------------------------------
cbLua.OnChange = checkScriptType1
cbAA.OnChange = checkScriptType2
btnExecute.OnClick = runScript
btnSave.OnClick = saveScript
btnLoad.OnClick = loadScript
btnReset.OnClick = reset

-- Made by Corroder / 12052020

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Sat May 30, 2020 8:34 am    Post subject: Reply with quote

I like it
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum Wink
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1515

PostPosted: Sat May 30, 2020 10:48 am    Post subject: Reply with quote

From a different perspective, a different idea.
Generate (AA code), save (AA code), create (AA Script), upload (Registered script), enable - disable.

Code:
--[[
Note: Paste the code into the lua script and run it once,
Save as ".CT".
Then continue with the saved CT file.
]]
if f then f.destroy() f = nil end

f = createForm(true)
f.Position=poDesktopCenter f.Width=525 f.Height=270

local m1=createMemo(f)
m1.Height=180 m1.Left=10 m1.Top=50 m1.Width=240
m1.WordWrap=false m1.ScrollBars="ssAutoBoth"

local m2=createMemo(f)
m2.Height=180 m2.Left=275 m2.Top=50 m2.Width=240
m2.WordWrap=false m2.ScrollBars="ssAutoBoth"

local b1=createButton(f)
b1.Left=10 b1.Top=12 b1.caption="Save"

local b2=createButton(f)
b2.Left=439 b2.Top=12 b2.caption="Load"

local e1=createEdit(f)
e1.Left=95 e1.Top=13 e1.Width=155 e1.ShowHint=true e1.TextHint="Your Save Name?"

local e2=createEdit(f)
e2.Left=275 e2.Top=13 e2.Width=155 e2.ShowHint=true e2.TextHint="Your Load Name?"

local e3=createEdit(f)
e3.Left=275 e3.Top=239 e3.Width=155 e3.ShowHint=true e3.TextHint="Your Hack Name?"

local c1=createCheckBox(f)
c1.Left=145 c1.Top=242 c1.caption="Hack OFF >>>>"
--##############################################################################
m1.Lines.Text='[ENABLE]\nAobscan(_code1,AA BB)\n\n_code1:\ndb 90 90\n\n[DISABLE]\n'

local sf = TrainerOrigin or getMainForm()
pth = (sf.."MyHackList\\")
if pth then
os.execute([[mkdir "]]..TrainerOrigin..[[\MyHackList"]])
end

function ListSave()
local index = 1
local text=pth..e1.Text..".txt"
if text then
local settingsFile = io.open(text, "w")
    if (settingsFile ~= nil) then
      settingsFile:write(control_getCaption(m1))
      settingsFile:close()
    end
  end
end

function ListLoad() --Memo2
local text2=pth..e2.Text..".txt"
  if text2 then
    local settingsFile = io.open(text2, "r")
    if (settingsFile ~= nil) then
      m2.Lines.Text = settingsFile:read("*a")
      settingsFile:close()
    end
  end
end

function createAA()
if m1.Lines.Text=="" or e1.Text=="" then
showMessage("Script code not found! Please write the code in the box.")
else
local mr = getAddressList().createMemoryRecord()
mr.Type = vtAutoAssembler
mr.Script = m1.Lines.Text
mr.Description = e1.Text
end
end

b1.OnClick=function() if e1.Text=="" then showMessage("Please enter a valid list name!")
else createAA() ListSave() e3.Text=e1.Text end end

b2.OnClick=function() if e2.Text=="" then showMessage("Please enter a valid list name!")
else ListLoad() end end

c1.OnChange=function() if e3.Text=="" then showMessage("Please enter a valid hack name!")
else
  local name = e3.Text
local addresslist = getAddressList()
 if (checkbox_getState(c1) == 1) then
    CheatEntry=addresslist_getMemoryRecordByID(addresslist,name)
    memoryrecord_freeze(CheatEntry)
  else
    CheatEntry=addresslist_getMemoryRecordByID(addresslist,name)
    memoryrecord_unfreeze(CheatEntry)
  end
end
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
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