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 


add a number / letter to a cememo

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Mon May 03, 2021 2:38 am    Post subject: add a number / letter to a cememo Reply with quote

how can i add a letter or number to cememo? example

CEMemo1.text = goodby

when u press button it add letter e to it so it becomes

CEMemo1.text = goodbye
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon May 03, 2021 3:56 am    Post subject: Reply with quote

Example :

Code:
if f then f.Destroy() end

f = createForm()
memo1 = createMemo(f)
memo1.Lines.Text = 'goodby'
btn = createButton(f)
btn.Left = memo1.Width + 20
btn.Caption = 'Press Me'

function addEtoMemo()
 local mytext = 'e lover'
 memo1.Lines.Text=memo1.Lines.Text..[[]]..mytext
end

btn.OnClick = addEtoMemo

f.show()

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

Joined: 29 Mar 2021
Posts: 64

PostPosted: Mon May 03, 2021 8:06 am    Post subject: Reply with quote

so i asked my friend for some help and he gave me this script with the example ct i gave him, does this work too?


Code:
function UDF1_CEButton1Click(sender)
UDF1.CEMemo1.Lines[0] = string.format("%s%s", UDF1.CEMemo1.Lines[0], "e")
end
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon May 03, 2021 8:49 am    Post subject: Reply with quote

HexaG0n wrote:
so i asked my friend for some help and he gave me this script with the example ct i gave him, does this work too?


Code:
function UDF1_CEButton1Click(sender)
UDF1.CEMemo1.Lines[0] = string.format("%s%s", UDF1.CEMemo1.Lines[0], "e")
end


Yes, if want append text/number at the end of specific memo lines.

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

Joined: 29 Mar 2021
Posts: 64

PostPosted: Mon May 03, 2021 9:23 am    Post subject: Reply with quote

does it work for ceedit too? or is there another way for it to be used for ceedit
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Mon May 03, 2021 9:28 am    Post subject: Reply with quote

I think you forgot to mention that there is more than one line in "Memo" in your question.

Code:
if f then f.Destroy() end

f = createForm()
memo1 = createMemo(f)
memo1.Top=35
edt1 = createEdit(f) edt1.AutoSize=false
edt1.Left=5 edt1.Width=70
edt2 = createEdit(f) edt2.AutoSize=false
edt2.Left=90 edt2.Width=30
btn = createButton(f)
btn.Left = memo1.Width + 20
btn.Caption = 'Press Me'

local txt=[[Hello ther
Good by
I came again
I went
]]

memo1.Lines.Text=txt
edt1.Text="e"
edt2.Text="0"

function addEtoMemo()
 local myline = tonumber(edt2.Text)
local cnt=memo1.Lines.Count -1
if myline>=cnt then showMessage("The specified line is empty or does not exist.Line: 0/"..cnt);
else
 local mytext = edt1.Text
 memo1.Lines[myline]=memo1.Lines[myline]..mytext
end
end

btn.OnClick = addEtoMemo

f.show()

It shouldn't be difficult to apply them to your scenario.
Code:
--[[f=UDF1
memo1=UDF1.CEMemo1
edt1=UDF1.CEEdit1
etc
]]
Back to top
View user's profile Send private message
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Mon May 03, 2021 9:38 am    Post subject: Reply with quote

ohh i understand how it works now... thank you so much Very Happy
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