Need Help on my Lua Script to force a certain Value permanently constantly

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by ShyTwig16 »

You only changed the load function, if you want it to save you would need to change that function too. And this won't create INI files (those are in a format that this doesn't follow), the file name format is still set to "I2CETState.${StateName}.txt", so it would be "I2CETState.casual.txt".

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

please for the love of god help me out man , deleting any other elseif to only else

gives me errors , worked for load but any other gives an error

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by ShyTwig16 »

Look at how if statements in lua are formatted. Or you can go back to using "AUTO SET:", either way there will be work involved. But you seem to almost be there.

Code: Select all

if condition1 then
    print(1)
elseif condition2 then
    print(2)
else
    print(3)
end
You can put this in the Lua Engine window, move stuff around see when it stops working.

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

well that script is not gonna help with the above issue of removing elseif and making it only else , im going nuts here lol, seriously tho , coding is def not my thing, i also kinda feel you know the answer here , do me a favor and help please im not getting anywhere with this....seriously tho please i beg of you

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by ShyTwig16 »

Ok this is valid Lua. Put it in the lua engine window and execute it, it will work and print 3.

Code: Select all

if condition1 then
    print(1)
elseif condition2 then
    print(2)
else
    print(3)
end
This is NOT valid Lua. Put it in the lua engine window and execute it, it will give an error (i.e.: 'end' expected (to close 'if' at line 1) near 'elseif').

Code: Select all

if condition1 then
    print(1)
else
    print(3)
elseif condition2 then
    print(2)
end
Now look at the if statement you've modified and see which one it's formatted like. Is it like the one that works or is it like the one that gives an error? Sometimes I make smaller code snippets to test things if I'm not sure how it works. You should learn to do this too, it will help a lot. If all else fails you can paste the whole script into the lua engine window and set a breakpoint in the source code and debug the script directly.

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

ok been at this for days....and aint getting anywhere with this , ive tried your above example but i dont get how to use it in order to fix said issue, this is way above my head for sure , think you could help out with a fixed table states function , so all i gotta do is copy paste it and profile saving with autoenable saved profile on start to work proper without the Auto Set in description , would do me a major solid , sorry for the ask but i really REALLY need this

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by ShyTwig16 »

Like I said you'd have to do some debugging to make it work after changing the if statements. And the module is already how I like it, so not really feeling like doing the work. But at this point I'd say if you can't figure out the basic syntax of an if statement then you might want to start with some basic programming before jumping head first into something like this. Try making a Lua program without CE just Lua. Try a fibonacci sequencer, one that takes an input and outputs the sequence 10 iterations.

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

ok , well i think ill wait till someone manages to help out further here, cause i dont got the skillz for sure to get this setup proper, appreciate the help so far

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

again if anybody is able to solve this id appreciate the gesture for sure, im not a code guy , im a regular CT user that just wants some good automation thats all

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

still would appreciate the gesture for sure, sorry for the bump

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

anybody able to help please ?, ..thanks

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 478
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 242

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by LeFiXER »

I don't mean to poke my nose in here but to be given the answer solves nothing. You don't gain anything beneficial from it nor do you learn. Game hacking is not for the feint-hearted and it takes a great amount of effort to learn because it requires many skills, programming is one of them. Lua is actually a very simple language to learn that said, ShyTwig16 has already given advice in which you should follow to resolve your issue and there is an uncountable selection of tutorial sites to choose from. Take it one-step at a time and you will get there and believe me, it is all the more satisfying when you do because you did so without being given the answer which is far more credible.

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

thanks man , do appreciate the input, but yeah , in this case im really not qualified to manage this myself im just a regular joe gamer here dont got the smarts for code comprehension, so yes ...i do need someone that actually knows code to be able to solve this for me , id appreciate this , theres a reason why i opened this thread in the first place, so i can automate my CTs as should be by default imo, been a long standing issue ive been having and would finally like to have that peace of mind , as said would do me a major solid , i mean it :( :-? :mellow:

p.s i also dont enjoy having to bump this thread too often, also i appreciate you guys trying to teach code, but as said my brain just aint made for any of it

aSwedishMagyar
Table Makers
Table Makers
Posts: 670
Joined: Mon Jul 06, 2020 3:19 am
Reputation: 1190

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by aSwedishMagyar »

dreamcactus wrote:
Tue Jun 29, 2021 6:01 pm
p.s i also dont enjoy having to bump this thread too often, also i appreciate you guys trying to teach code, but as said my brain just aint made for any of it
Basically, you don't want to do the work and want someone else to do it for you. That means you should create a post in the requests section and be prepared to pay for it.

I don't understand why people think they can accomplish things in such a short amount of time. Would you expect to become a proficient piano player in just 2 weeks? The same concept applies here, you need to go out and practice on your own. It might not be in the same area even, just getting the basics of lua is a good enough starting point. Do some reading in the celua.txt, watch some tutorials on youtube, and experiment with a few games and I promise you will get better.

Also, for your own benefit: constantly saying that "I'm just not smart enough please do it for me" is not a good way to get help. It's actually annoying and nobody will want to help you. Have you ever heard the phrase: "The lord helps those who help themselves"? Apply that to everything in life except you're not begging some almighty being, just asking some dude who (like you) started at the beginning with no knowledge and just practiced.

User avatar
dreamcactus
Expert Cheater
Expert Cheater
Posts: 144
Joined: Sat Jul 06, 2019 12:21 pm
Reputation: 0

Re: Need Help on my Lua Script to force a certain Value permanently constantly

Post by dreamcactus »

well guess ill do just that ...post up a Request Thread then if thats what it takes, problem is there exists no specific such section only for specific games not for automation code in general , and yes im just stating the facts i do need someone to do it for me since i cant manage to figure out code to make this work and tuts just give me a nervous breakdown , my brain capacity isnt made for this kind of stuff , i can barely copy paste working code and get that to work as should , no joke, if my history in this thread of mine hasnt managed to show exactly how incapable i am then im sorry

Post Reply

Who is online

Users browsing this forum: No registered users