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 


Looking for 'starter' forms

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

Joined: 30 Aug 2021
Posts: 45

PostPosted: Wed Jun 15, 2022 3:36 am    Post subject: Looking for 'starter' forms Reply with quote

I'm about to start programming a form (eventually an exe) to modify a config file of a game. The game (The Hell 2) has no UI way to modify settings so I want to create an independent exe that will do this.

This will be my first form design/programming in CE/Lua ever. I've only ever worked with Visual Studio before and don't have that anymore.

Before I jump into it, I wanted to ask if anyone has already done such a thing -- read and write a formatted text file using forms -- and is willing to share their forms/file with me. It will be nice to begin with a 'starter' pack rather than from scratch.

Additionally, can anyone tell me if it is possible to easily include a tab interface on a form? Or do I have to 'simulate' tabs with buttons and panels?

Thanks!

_________________
It's not cheating. It's playing by my rules.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Wed Jun 15, 2022 11:16 am    Post subject: Reply with quote

Open the form designer (Table -> Create Form) and play around with it. Look at the object inspector for available properties and events.

See celua.txt for information on some of the properties you can access through Lua.

Use Lua's IO library for reading/writing files. Parsing the config is another issue entirely- maybe try to find a library for whatever config format it is.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
gibberishh
Cheater
Reputation: 1

Joined: 30 Aug 2021
Posts: 45

PostPosted: Thu Jun 16, 2022 8:17 am    Post subject: Reply with quote

ParkourPenguin wrote:
Open the form designer (Table -> Create Form) and play around with it. Look at the object inspector for available properties and events.

See celua.txt for information on some of the properties you can access through Lua.

Use Lua's IO library for reading/writing files. Parsing the config is another issue entirely- maybe try to find a library for whatever config format it is.

Okay, I've created a form and tested it. So far, I have all the fields I require, my Lua script is reading the ini text file and parsing it, and is populating the fields with proper values.

I will write code to output a file later.

However, when I saved this into an exe, it is not able to find/open the ini file. I am assuming this is happening because some io library has not been 'included' in the code. Is this assumption correct? If so, how do I include required libraries in the code so that the exe is compiled with all required resources?

I don't know the exact exception that is raised. My code just checks whether the file/contents were loaded successfully or not and displays an error message if not. Since there is no error raised in the table, I don't know what error the exe is coming up against.

Thanks!

_________________
It's not cheating. It's playing by my rules.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Thu Jun 16, 2022 12:26 pm    Post subject: This post has 1 review(s) Reply with quote

gibberishh wrote:
I am assuming this is happening because some io library has not been 'included' in the code.
I can't verify this right now, but no, Lua's IO library is built into Lua itself. You can test this by writing a "hello world" exe trainer that writes a string to some file somewhere.

What sort of path are you trying to open? If it's not an absolute path or a path from certain environment variables (see os.getenv), files might be searched for in unexpected places.

You can add a label to the form and output errors to that.

If you can't figure out where the error is, posting your code will let others look too.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
gibberishh
Cheater
Reputation: 1

Joined: 30 Aug 2021
Posts: 45

PostPosted: Thu Jun 16, 2022 11:22 pm    Post subject: Reply with quote

ParkourPenguin wrote:
What sort of path are you trying to open? If it's not an absolute path or a path from certain environment variables (see os.getenv), files might be searched for in unexpected places.

You were right! My bad. I was simply looking for 'config.ini' and expecting it to be in the same folder as the exe. Stupid inexperienced me. Embarassed

Solved the problem by adding OpenDialog and SaveDialog controls to the form. Now going to add a lot of checks to see if the user is opening the correct file.

I believe this will be the most reliable way to locate the config file, especially since The Hell 2 doesn't have any standard installer which puts the game in a predefined path. Users extract the game from a zip anywhere they wish.

Thanks for the help.

_________________
It's not cheating. It's playing by my rules.
Back to top
View user's profile Send private message
gibberishh
Cheater
Reputation: 1

Joined: 30 Aug 2021
Posts: 45

PostPosted: Sat Jun 18, 2022 5:48 am    Post subject: Reply with quote

Follow-up questions (should I have created a new post?)

When I create an exe, it ends up being approx. 5.61 MB. The way I do it is File > Save As > exe. Gigantic, Target 32-bit, selecting a small icon file, Compression = Max. No extra files added.

Obviously it must be including a lot of dependencies, probably the entire cheat engine and/or Lua engine itself -- so that it can run on machines without CE.

Question 1: When I create an exe using the Tiny option, the exe that gets created throws an error: You must have CE 6.3 installed. I have 7.2 installed and the exe was created with it. What can I do to fix this?

Question 2: Can I somehow pick and choose what dependencies get included in the exe so maybe I can reduce the overall file size? While 5.6 MB isn't huge, it seems like overkill for a simple configuration UI. Similar tools (which take advantage of Windows Forms components and DLLs) are no larger than a couple of hundred KB.

My form connects to no process, does no aobscans, does not meddle with memory, etc. It's only a form that reads and writes to a text file (form components + Lua engine including Lua file io).

Thanks again!

_________________
It's not cheating. It's playing by my rules.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Sat Jun 18, 2022 11:04 am    Post subject: Reply with quote

Q1: I'm not sure. That might be an error in 7.2, or maybe it's not an error and it really does require 6.3 to be installed. Does it happen on the latest version? (7.4 right now)
Q2: Not really. The gigantic option does bundle an entire copy of CE into that exe. Most components of CE are so connected to each other that it's not feasible to separate them. The few features that can be separated and that most people don't need aren't included by default (e.g. dbk / dbvm stuff IIRC).
gibberishh wrote:
My form connects to no process, does no aobscans, does not meddle with memory, etc. It's only a form that reads and writes to a text file (form components + Lua engine including Lua file io).
That really doesn't sound like something you should be using CE for.
I'd make a CLI tool, but if you need a GUI, maybe try C# or something. I hear Rust is nice too.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
gibberishh
Cheater
Reputation: 1

Joined: 30 Aug 2021
Posts: 45

PostPosted: Sat Jun 18, 2022 3:01 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Does it happen on the latest version? (7.4 right now)

I'll check it a little later. Without testing and tracing, it seems like a legacy error from an old artefact. But that's just an assumption and when I assume I make an ass-of-u-n-me.
If you wish to look, the ct file is at https://fearlessrevolution.com/viewtopic.php?p=255353#p255353 (hope I'm allowed to post this external link!). To 'use' the form you'll need a valid config file, but that requirement won't interfere with the exe creation bit.

Please don't crucify me for the highly procedural code. I'm usually a very clean programmer but this was meant to be a one-time thingee. The game keeps updating every week so this tool will be obsolete within a couple of months.
ParkourPenguin wrote:
That really doesn't sound like something you should be using CE for. I'd make a CLI tool, but if you need a GUI, maybe try C# or something. I hear Rust is nice too.

True. Several years ago I'd have used Visual Basic and a few years ago I'd have used C#. However, as noted in the first post, I don't have access to Visual Studio any more. I have CE installed and therefore ready access to a Lua devenv + compiler.

Moreover, 'need' is a little strong Very Happy I don't need this GUI. This was more of a personal project to learn CE forms, especially since it didn't involve external processes and memory manipulation. I did learn a lot and some people will benefit off it, so it's a win-win at the moment. Next step is to learn the interfacing of MemoryRecords and scripts in forms. Wish me luck! Wink

_________________
It's not cheating. It's playing by my rules.
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