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 


Custom Lua Script Templates

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Wed Oct 05, 2016 8:18 am    Post subject: Custom Lua Script Templates This post has 2 review(s) Reply with quote

As suggested by ++METHOS, adds template function to cheat table Lua script, similar to the awesome "Custom AOB Injection Templates" by mgr.inz.Player.

Suggestions welcome for any additional keywords, templates or features.
Post your own templates below if you want me to merge it into main branch.

Adding Custom Scripts
Method 1:
Update Lua file with another entry, inside myLuaScriptTemplates.Templates:
Code:
{
displayName="Name for Lua script template",
templateSections=
[==[
--Write script here--
]==]
},

To create template groups:
Code:
{
displayName="Name for template group",

{
displayName="Name for Lua script template",
templateSections=
[==[
--Write script here--
]==]
}

},


Method 2:
Save script as a .lua file in CEDirectory\autorun\templates folder. Create new folder if necessary.
Display name will be taken from file name.
Sub-directories can be used to create template groups.
Group name is taken from sub-directory name.

Example of a template group here.
Drop folder into templates folder.

Keywords are:
%processName% - Self explainable
%placeholder_XXX% - Prompts the user for replacement string. Cancelling prompt would stop generating the template. Underscores in "XXX" section are replaced with spaces allowing for multi-worded tags. Prompts repeatedly until all unique placeholders have a replacement string.

To install:
1. Drop .lua file in CEDirectory\autorun folder

Quote:
Update 1:
- Added support for loading Lua scripts from templates folder as suggested by Dark Byte.

Update 2:
- Added a new keyword.
- Added a few new templates from Zanzer.
- Added support for creating template groups.
- Added support for loading templates in sub-directories inside templates folder.

Update 3:
- Major update to localize all functions to avoid conflicts between extensions due to similar names, especially commonly used library functions.


Credits and Thanks to:
mgr.inz.Player
Dark Byte
Zanzer



Custom Lua Script Templates.lua
 Description:

Download
 Filename:  Custom Lua Script Templates.lua
 Filesize:  5.52 KB
 Downloaded:  1689 Time(s)


_________________


Last edited by predprey on Sat Oct 08, 2016 12:42 am; edited 10 times in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Wed Oct 05, 2016 8:37 am    Post subject: Reply with quote

Tip: With the folder and directory list functions of 6.6 you can enhance this script so people can add scripts to a special folder which this script can read out and use for template
_________________
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
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Wed Oct 05, 2016 8:41 am    Post subject: Reply with quote

Dark Byte wrote:
Tip: With the folder and directory list functions of 6.6 you can enhance this script so people can add scripts to a special folder which this script can read out and use for template


Thanks! I'll look into it.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Oct 05, 2016 9:21 am    Post subject: Reply with quote

Awesome work, predprey! Thanks!

Dark Byte, some of the LUA plugins that are being created are quite good and could really benefit the community if they were integrated in to CE, permanently. I was wondering if you had any plans to do that.
I think there are a lot of users that never look at this sub-forum and will never benefit from these plugins. Additionally, if any of the original authors disappear for some reason, someone else will have to step up in order to ensure that everything is compatible with future versions. Anyway, just a thought. I appreciate the work, guys!

Thanks!
Back to top
View user's profile Send private message
usernotfound
Expert Cheater
Reputation: 0

Joined: 21 Feb 2016
Posts: 115

PostPosted: Wed Oct 05, 2016 5:49 pm    Post subject: Reply with quote

Thank you for sharing this, will be very helpful for my upcoming projects! Also I agree with ++METHOS, it would be really cool to see these plugins in CE Very Happy
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Wed Oct 05, 2016 6:19 pm    Post subject: Reply with quote

I think there are a few issues that have to be considered before these extensions are merged into CE.

The first of which is that merging them into CE does not mean they will be better maintained than if they aren't. Essentially, the responsibility is not and should not be pushed to DB and the other members maintaining the code base even if they are merged.

Secondly, if some of the extensions are to be merged, should they be coded directly into CE by translating into pascal or just bundled as Lua plugins like Mono and Java Data Collector. The former might be really tedious if there are a lot of plugins to be merged while the latter would provide no other benefits other than to allow the plugins to be bundled together with CE and hopefully gain more exposure. Also, the original authors may not be able to push updates out as easily without causing differences in versions being released out there.

Finally, what is the criteria for a extension to be deemed essential and be merged permanently? Should it be the extent of the functionality and usefulness it provides such as mgr.inz's Custom AOB Templates, or should it be the lightweight yet basic functions such as mgr.inz's Scan Type NOT?

Ultimately, I believe these are the issues that have to be thought through before merging these extensions into CE's main branch, in order to not cause any unforeseen trouble or quirks in time to come.

EDIT: By the way do provide inputs towards adding more keywords or templates as its really quite barren as it is. I currently have in mind a placeholder keyword where the user is prompted for the string to replace it with. There can be a variable number of these placeholders in the template.


Last edited by predprey on Thu Oct 06, 2016 1:49 am; edited 2 times in total
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Oct 05, 2016 8:57 pm    Post subject: Reply with quote

Regarding certain plugins making the cut, that's ultimately DB's decision, I would think. Whether or not they would be a pain to code and/or maintain is unknown to me.

Regarding useful LUA features that could be added to this plugin, I am not the best to offer up suggestions on that at the moment. I do know that there are loads of examples on this forum that people ask about all of the time. Whether or not they would be suitable for this, I couldn't say. One that comes to mind is auto-launching target.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Oct 05, 2016 9:36 pm    Post subject: This post has 1 review(s) Reply with quote

Maybe add the ability to configure prompts and add your own keywords.

For example:
Code:
{
  displayName="Name for Lua script template",
  templateSections=
[==[
--Write script here--
]==],
  prompts = {
    {
      question = "Please enter the timer's interval",
      keyword = "timer_interval"
    }
  }
},


Timer Template
Code:
mytimer=createTimer(nil, false)
mytimer.Interval = %timer_interval%
mytimer.OnTimer = function(timer)
  -- insert code here
end
mytimer.Enabled = true

Breakpoint Template
Code:
debug_setBreakpoint(address, 1, bptExecute, function()
  debug_continueFromBreakpoint(co_run)
  return 1
end)

Auto-Activate Scripts On Attach
Code:
function onOpenProcess()
  local timer = createTimer(nil, false)
  timer.Interval = 500
  timer.OnTimer = function(timer)
    local list = getAddressList()
    list.getMemoryRecordByDescription("Script Name (Description)").Active = true
    timer.Destroy()
  end
  timer.Enabled = true
end

Hotkey Template
Code:
myhotkey = createHotkey(function()
  -- insert code here
end, VK_A) -- define key here
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Wed Oct 05, 2016 11:19 pm    Post subject: Reply with quote

Zanzer wrote:
Maybe add the ability to configure prompts and add your own keywords.


Thanks a lot. I'll add these into the next update. 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 Extensions 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