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)
User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1637
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 853

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

Post by TheyCallMeTim13 »

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: 76
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

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1637
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 853

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

Post by TheyCallMeTim13 »

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: 76
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

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1637
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 853

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

Post by TheyCallMeTim13 »

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: 76
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

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1637
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 853

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

Post by TheyCallMeTim13 »

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: 76
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: 76
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: 76
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

Post Reply

Who is online

Users browsing this forum: No registered users