|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Tue Jun 11, 2019 9:09 pm Post subject: Find Next Word In CEMemo And Unicode |
|
|
Code: | vanban = [[Ốc Nhồi
Bác mẹ sinh ra phận ốc nhồi.
Đêm ngày lăn lóc đám cỏ hôi.
Quân tử có thương thì bóc yếm.
Xin đừng ngó ngoáy lỗ trôn tôi.
Quả Mít
Thân em như quả mít trên cây,
Da nó sù sì, múi nó dày.
Quân tử có thương thì đóng cọc,
Xin đừng mân mó nhựa ra tay.
Bác mẹ sinh ra phận ốc nhồi.
Đêm ngày lăn lóc đám cỏ hôi.
Quân tử có thương thì bóc yếm.
Xin đừng ngó ngoáy lỗ trôn tôi.
]]
UDF1.CEMemo1.Lines.Text = vanban
UDF1.CEEdit1.Text = ''
UDF1.CEMemo1.selStart = 234
UDF1.CEMemo1.selLength = 6
--UDF1.CEMemo1.selAttributes.Color = clGreen
UDF1.CEMemo1.HideSelection = false
UDF1.CEMemo1.Font.CharSet = 'VIETNAMESE_CHARSET'
UDF1.CEMemo1.WordWrap = false
function timkimVanBhan()
local x1,x2
x1,x2=string.find(UDF1.CEMemo1.Lines.Text, UDF1.CEEdit1.Text)
if x1 then
x1=x1-1
UDF1.CEMemo1.selectText(x1,x2-x1)
end
end
UDF1.show()
UDF1.CEButton1.OnClick = timkimVanBhan
|
The function 'timkimVanBhan()' meaning 'search text', will highlight the first text found on CEMemo1 if match with input text on CEEdit1.
Questions:
1. How to make the function to find the next matching words on CEMemo1?
2. When using Unicode text (non-English), the search result return text not match with the text to search, how to fix it?
Thanks
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Wed Jun 12, 2019 12:00 am Post subject: |
|
|
1: the 3th find parameter lets you specify the start
string.find(UDF1.CEMemo1.Lines.Text, UDF1.CEEdit1.Text,x1+1)
2:
memo stores text in utf8 format
lua find searches in whatever lua's find searches in
you need to convert either the searchstring or the text to something compatible
_________________
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 |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Wed Jun 12, 2019 1:06 am Post subject: |
|
|
Thank DB for the answer.
No.2,
Then I need to make a function to translate UNICODE to UTF-8 or compatible to UTF-8 for both text on CEEdit1 and CEMemo1.
No.1,
I change the script:
Code: | texture = [[
cheat engine is a tool used to hack an app.
people mostly used cheat engine for hacking a game.
cheat engine is possible to manage memory such as
editing (reading and writing).
cheat engine made by Dark Byte a.k.a Eric henen.
cheat engine or CE, is an open-source
memory scanner/hex editor/debugger.
The first version of cheat engine has released at
June 28, 2000, version 1.3 source code.
]]
UDF1.CEMemo1.clear()
UDF1.CEMemo1.Lines.Text = texture
UDF1.CEEdit1.Text = ''
UDF1.CEMemo1.HideSelection = false
UDF1.CEMemo1.WordWrap = false
function timkimVanBhan()
local s1,s2
s1,s2=string.find(UDF1.CEMemo1.Lines.Text, UDF1.CEEdit1.Text,s1+1)
if s1 then
s1=s1-1
UDF1.CEMemo1.selectText(s1,s2-s1)
UDF1.CEMemo1.selstart=s1
UDF1.CEMemo1.sellength=s2-s1
if s1 == UDF1.CEMemo1.Lines.Count then
s1 = 0
end
end
end
UDF1.show()
UDF1.CEButton1.OnClick = timkimVanBhan |
Getting error: attempt to perform arithmetic on a nil value (upvalue 's1')
when trying to find text 'cheat' on CEMemo1.
Thanks
EDIT 1:
I write another Lua script use for handle text on CEMemo, as shown on the attached picture. But the script does not finish yet. Still, need some remained functions to use for opening a local/online text file, save changes and a function to get a glossary of words on CEMemo1.
I can split each word, for example:
Code: | str = [[
cheat engine is a hack tool.
people mostly use cheat engine to hacking game
]]
for w in str:gmatch("%S+") do print(w) end
|
But I want the result like this:
cheat = 2. Line 1,2
engine = 2. Line 1,2
is = 1, Line 1
and so on...
If someone knows the solutions, please let me know. Thank you
EDIT 2:
All done! See this:
https://forum.cheatengine.org/viewtopic.php?p=5749682#5749682
Description: |
|
Filesize: |
53.3 KB |
Viewed: |
3100 Time(s) |
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
|
|
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
|
|