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 autocomplete text?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Fri Nov 17, 2023 8:00 am    Post subject: Is it possible to autocomplete text? Reply with quote

Is it possible to autocomplete text in a Lua script or Lua engine? Just like in the Lua engine after writing the dot character.
For example, if in Lua script or Lua engine typed text "if" (without quotes), then prompt to insert following text:
Code:
if x == 0 then

end

if typed "fo" then prompt to insert:
Code:
for x = 0, 1 do

end


If you write the symbol: ( or [ or { or ' or " ,then automatically write the symbol: ) or ] or } or ' or " respectively.
Is it possible to create such lua extension?

if you type "l", you will be prompted to insert: local

if typed "tim" then prompt to insert:
Code:
if timer then timer.destroy() timer=nil end

timer = createTimer(UDF1, false)
timer.Interval = 1000

timer.OnTimer = function()

end

timer.Enabled = true


if typed "re" then prompt to insert text:
Code:
readBytes(address) --or readSmallInteger(address) or readInteger(address)
-- or 9 CE lua functions that start with "read": readBytes(address), readByte(address), readSmallInteger(), readInteger(), readQword(), readPointer, readFloat, readDouble, readString


if typed "wr" then prompt to insert:
Code:
writeBytes(address, value) --or writeSmallInteger(address,value) or writeInteger(address,value)


if typed "cr" then prompt to insert:
Code:
createForm() --or createEdit(owner) or createButton(owner)


if typed "OnK" then prompt to insert:
Code:
OnKeyPress = function(sender, key)

  return key
end


if typed "OnS" then prompt to insert:
Code:
OnSelect = function(sender)

  sender.ItemIndex
end


if typed "pr" then prompt to insert: print()

As a result, we will be able to write code faster.


Last edited by Razi on Sat Nov 18, 2023 2:42 am; edited 1 time in total
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1480

PostPosted: Fri Nov 17, 2023 2:02 pm    Post subject: Reply with quote

I have completed the usage code of this project.
I tried it in CE Lua Script Table and it was partially successful.
However, since the CE and Lua library is very large, it will take time to cover and adapt the entire syntax.
I will complete the project when I have time.

_________________
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
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Fri Nov 17, 2023 4:48 pm    Post subject: Reply with quote

AylinCE wrote:
However, since the CE and Lua library is very large, it will take time to cover and adapt the entire syntax.
I will complete the project when I have time.

Okay, I can wait.
P.S.: One more thing could be added:
If you write "if f" or "f =", then suggest inserting the following code:
Code:
if f then f.destroy() end

f = createForm()
f.Height = 240
f.Width = 320
f.Position = 'poScreenCenter'


and if you write "for k", then suggest inserting:
Code:
for key, value in pairs(table) do

end
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1480

PostPosted: Sat Nov 18, 2023 1:38 pm    Post subject: Reply with quote

This is exactly why I wanted to prepare a library, and I think it will be beyond what you think.
Namely;
If you want to create a form or an object with a form, a list will open with the "cre" hint.
This list consists of all components including the form. (createForm, Label, Button etc.)
Each ingredient is listed with 2 examples.
"createForm()" and "createForm"
If the second option is selected, a form will open and all properties of the desired component can be edited. (Height, Width, Left, Top, AutoSize, etc.)
When the OK key is pressed, the edited object information will be transferred to the Lua Table.

Or, if a table component is selected, a library with sample table options opens and this can both meet the request and be used as a tutorial.
(For example, to print table items, or to process tables 2,3,4 etc. within the table, or simply with the word "cre" (in the "create" list), the "createTable" element is selected and an "input" is opened where the table name will be processed and the table is created. ("inputOut = { }" )

As I said, building this entire library will take time.
There are many components and syntaxes in CE and Lua.

Note;
There is a timer in my project that reads every typed word of more than 2 letters, and it would be very annoying to open an example or completion window for a single letter like "f" or "k".

For this reason, a key consisting of at least 2 or 3 characters should be used.

Here is a wildcard "." For dot we can list all non-alphanumeric characters.
Thus, we use the help of the "Ctrl" or "Alt" keys less often.

_________________
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
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Sat Nov 18, 2023 5:26 pm    Post subject: Reply with quote

AylinCE wrote:
There is a timer in my project that reads every typed word of more than 2 letters, and it would be very annoying to open an example or completion window for a single letter like "f" or "k".

Is it possible to do this with OnKeyUp/OnKeyPress event? For example, if in the selected line in Lua Script, last 3 symbols contain "cre" then open list with hints?

Quote:
As I said, building this entire library will take time.
There are many components and syntaxes in CE and Lua.

I think if after three letters a list with a hundred components/words appears, then you can spend more time choosing one word than writing the whole word yourself. It might be better to have more components/words from the list immediately visible and place them in alphabetical order or the most frequently used components/words first, so as not to spend too much time searching for the right word.
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