I am using the following two scripts "text" and "print":
See the Blender file at:
https://drive.google.com/file/d/188u-SkTq5q7y1GSkdG4fgcaK6yMpHn6c/view?usp=sharing
In the logic editor I use a Keyboard sensor connected to a "text" and "print" scripting controller. Simply pressing a specific key on the keyboard executes the script "text", but, to my surprise, I see in the console that pressing the key causing the re-execution of the script does not increment i.
System console shows:
0
0
0
0
0
0
instead of
0
1
2
3
4
5
An experienced man told me that this is normal because the reexecution of the script does not keep the variable i in memory. He told me that to remedy this, it is necessary to create an external file, use the fopen function, etc ... in order to save a variable which will be used during each re-execution of the script, but I do not know how to do it correctly.
Can you please help me to realize the script and use this external file? Can this external file simply be an internal text file in Blender's text editor? If so, what is its path to use with open ("text file path)", "r")?
Thank you for your help