Page 3 of 3

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

Posted: Fri May 28, 2021 9:51 pm
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".

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

Posted: Sat May 29, 2021 2:15 am
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

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

Posted: Sat May 29, 2021 2:47 am
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.

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

Posted: Sat May 29, 2021 3:45 am
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

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

Posted: Sat May 29, 2021 4:10 am
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.

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

Posted: Tue Jun 01, 2021 9:03 pm
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

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

Posted: Tue Jun 01, 2021 10:14 pm
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.

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

Posted: Wed Jun 02, 2021 1:06 pm
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

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

Posted: Tue Jun 08, 2021 8:01 am
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

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

Posted: Sun Jun 13, 2021 4:01 pm
by dreamcactus
still would appreciate the gesture for sure, sorry for the bump