Saving a variable between power ups
Posted: Thu Jan 05, 2023 4:31 pm
Hi,
I'm really confused right now. I've been trying for hours to have a variable saved across power ups but to no avail... I set the following :
int *Last_Tool = &persist.UserData[50];
The value starts at 0
Then later after manipulating the variables , it is set this way:
*Last_Tool = Index;
So now the value is set to my last position of my tool holder.
When I power up again , the variable is set to 0 again. How do I make it so that when it powers up , it will retain the last value that was stored in?
I'm really confused. Thanks for you help.
I'm really confused right now. I've been trying for hours to have a variable saved across power ups but to no avail... I set the following :
int *Last_Tool = &persist.UserData[50];
The value starts at 0
Then later after manipulating the variables , it is set this way:
*Last_Tool = Index;
So now the value is set to my last position of my tool holder.
When I power up again , the variable is set to 0 again. How do I make it so that when it powers up , it will retain the last value that was stored in?
I'm really confused. Thanks for you help.