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 


Help With Builder and Variable Problems

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Akiros
Newbie cheater
Reputation: 0

Joined: 11 Apr 2020
Posts: 24
Location: my house

PostPosted: Sun Apr 12, 2020 3:01 am    Post subject: Help With Builder and Variable Problems Reply with quote

Im trying to make a builder but have encountered a problem.
I am not sure how to make a script that prints with variables

example:
Farm = (UDF1.CEEdit1.text)
script = [[
1.CreateForm()
1.Color = [[
(farm)
]]
function UDF1_CEPanel1Click(sender)
print(script)
Print(Farm)
end
---------------------------------------------------------
i want it to turn the color into the modifiable text (farm)
so that if i turn farm's value into clBlack the color will be clBlack

_________________
help pls im noob Sad
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sun Apr 12, 2020 7:13 am    Post subject: Reply with quote

I am also have encountered a problem to understand what you mean, but maybe something like this according to your script:

Code:
function UDF1_CEPanel1Click(sender)
 print(script)
 print(Farm)
end

Farm = UDF1.CEEdit1.text
script = '1.CreateForm()\n'..'1.Color = '..Farm

UDF1.show()

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Sun Apr 12, 2020 9:48 am    Post subject: Reply with quote

You can use this separately for each button.
Just specify the edit box in which it will pick up the color.

example :

Code:
--f example form. form = UDF1

if f then f.destroy() f = nil end

f=createForm(true) -- or UDF1
f.Position=poDesktopCenter
f.Width=220 f.Height=130

local e1=createEdit(f) e1.Left=65 e1.Top=25 e1.Width=90 -- UDF1.CEEdit1

p2 = createPanel(f) --UDF1.CEPanel1
p2.Height=40 p2.Left=65 p2.Top=70 p2.Width=90
p2.Color='clBlack' --or "0x000000"
p2.Font.Color='0x56ffff' p2.Caption="Click"
p2.Font.Size=16 p2.Font.Style="fsBold"
p2.Cursor="-21"

--local Farm=e1.Text --or Farm=UDF1.CEEdit1.text

function ColorFarm(colors, text)
if form then form.Destroy() form=nil end
form=createForm()
form.name=form
form.Color=colors
form.caption=text
end

p2.OnClick=function() --or function UDF1_CEPanel1Click(sender)
if e1.Text=="" then --or UDF1.CEEdit1.text==""
showMessage("Please write a color.")
else
ColorFarm(e1.Text, "Farm and Color") --or ColorFarm(UDF1.CEEdit1.Text, "Farm and Color")
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
Akiros
Newbie cheater
Reputation: 0

Joined: 11 Apr 2020
Posts: 24
Location: my house

PostPosted: Mon Apr 13, 2020 2:38 am    Post subject: changing the script within the trainer Reply with quote

I Want to change the script within trainer like aylin did with his answer but when instead of color its script.
example:
script = [[
Avocados are (answer)
]]
answer = (udf1.ceedit1.text)
--udf1.ceedit1.text is changeable
function print(sender)
print(script)
------------------------------------------------------------------------
so that if i put in ceedit1 "terrible" the script will print

Avocados are Terrible

_________________
help pls im noob Sad
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Mon Apr 13, 2020 6:09 am    Post subject: Reply with quote

Maybe you may need to smell and code all the colors you will use.
See the "Color Sniffing Plugin" code of @ Corroder below.

https://forum.cheatengine.org/viewtopic.php?t=609767

And an example color assignment.
Code:
if f then f.destroy() f = nil end

f=createForm(true) -- or UDF1
f.Position=poDesktopCenter
f.Width=220 f.Height=130

local e1=createEdit(f) e1.Left=65 e1.Top=25 e1.Width=90 -- UDF1.CEEdit1

local p2 = createPanel(f) --UDF1.CEPanel1
p2.Height=40 p2.Left=65 p2.Top=70 p2.Width=90
p2.Color='clBlack' --or "0x000000"
p2.Font.Color='0x56ffff' p2.Caption="Click"
p2.Font.Size=16 p2.Font.Style="fsBold"
p2.Cursor="-21"

--local Farm=e1.Text --or Farm=UDF1.CEEdit1.text

function ColorFarm(colors, text)
if colors=="Apple" then  colors=216 end
if colors=="Lettuce" then  colors=50432 end
if colors=="Orange" then  colors=178685 end
if colors=="Banana" then  colors=65535 end
--print(colors)
if colors=="" then
 showMessage("Please write a valid color name")
else
if form then form.Destroy() form=nil end
form=createForm()
form.name=form
form.Color=colors
form.caption=(text..": "..tostring(colors))
p2.visible=true
end
end

p2.OnClick=function() --or function UDF1_CEPanel1Click(sender)
if e1.Text=="" then --or UDF1.CEEdit1.text==""
showMessage("Please write a color.")
else
ColorFarm(e1.Text, e1.Text) --or ColorFarm(UDF1.CEEdit1.Text, "Farm and Color")
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Mon Apr 13, 2020 6:38 am    Post subject: Reply with quote

If Aylin script gives you a solution then just modify that script according to what you need.

If you try to send value from trainer1 to trainer2 which different instances, because use said "within trainer" then you need to use share memory or store your trainer1 value to a file or clipboard and then read the value from trainer2.
It will differ if you send value from form1 to form2 or forms with same instances, like Aylin example script.

Not sure what exactly you want, but if just need print the text from editbox as a variable and put into a strings script variable, here is an example:

Code:
if myform then myform.destroy() end

myform = createForm()

edit1 = createEdit(myform)
edit1.setPosition(20,20)

b1 = createButton(myform)
b1.setPosition(20,50)
b1.Caption = 'Answer'

local script, script1, script2, answer

function printScript()
 answer = edit1.Text
 if answer == "" then return nil end

 script1 = [[
 There are many fruits in the world.
 They have many fresh colors.
 When they are still raw, the color usually is green.
 One of them is Avocado.
 ]]

 script2 = ' Avocado are '..answer

 script = script1..'\n'..script2

 print(script)

end

b1.OnClick = printScript

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

Joined: 11 Apr 2020
Posts: 24
Location: my house

PostPosted: Mon Apr 13, 2020 10:16 pm    Post subject: Hi sorry to bother you again Reply with quote

your answer worked successfully worked but i have encountered a different problem
when the user types the trainer name for example (Hacktrainer100)
the script is supposed to print

CELabel1 = createLabel(UDF1)
CELabel1.Caption = ("Hacktrainer100")

instead it prints

CELabel1 = createLabel(UDF1)
CELabel1.Caption = Hacktrainer100

And when the user types this into the lua engine the above script does not work Sad I've tried other solutions but my small mind cannot find the answer.

_________________
help pls im noob Sad
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Apr 14, 2020 12:08 am    Post subject: Reply with quote

Which answer is work succesfully?. You are not mentioned it.

Maybe:

Code:
local trainername = 'Hacktrainer100'

UDF1 = createForm()
CELabel1 = createLabel(UDF1)
CELabel1.Caption = trainername

print('CELabel1 = createLabel(UDF1)\n'..'CELabel1.Caption = '..trainername)

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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