the problem with the previous script was that it didn't take into account that if someone deleted a random screen_x.png file that it stopped looping the check_cond() function as soon as it returned a file does not exist!
the new method runs when you hit the create screenshot key - "F12" in this case & continues to loop until it returns a file does not exist!
this method prevents you from accidentally overwriting existing files & on the whole the amount of code needed is significantly much less than the first script ![]()
I have left the original script link on the thread & have also added a project file for the new script version!
P.S don't forget to comment out the 2 print statements on the file exists part - you'll know which they are as I added a "-- comment this out ..." after both of them, otherwise each time you press screenshot it will print a load of "screen_x.png already exists!" into the log file (messages.txt) - which I only added to check if the script was working correctly ![]()
if you have noticed I have recently started adding extra "print('-- * --')" to my scripts before certain print statements ... I have been adding these to create a line break (separation line) between various log messages so we don't end up with a ton of clumped together randomness!
hopefully they'll install the GitHub system David mentioned to me in a pm as that would be a really nice feature for the forum, scripting, bug finding, to do lists & much more - all color coded & so on too which will be nice - there used to be a similar tool on a smf forum I used to be active on & it was a really good feature! ![]()
it's the sticky topics page I have created which contains links to loads of useful threads, information & external resources; all compiled into various categories for ease of use ![]()
all my lua scripts as well as other peoples can be found in the linked wiki page, sorted into categories of how complicated the scripts are.
there's also a general FAQ explaining the various license options for Visionaire Studio & the recommended audio/video formats & so on.
safe ![]()
Basically I want each time the player clicks on button (action) I made to randomly generate a 4 digit code which is stored as an integer so I can use it later on.
Any ideas?
there's also a "set random value" action inside of select action part > condition, if, value ...
values will be saved on game save / quick save.
you could also use lua to write the value(s) to an external file if you liked?
may I ask what it is for?