Debuging

Is it possible to not only watch a variable for changes but when it does change, show you the line of code that caused it to change? This would be invaluable knowledge if it's possible.

Thanks in advance.
 

Yal

šŸ§ *penguin noises*
GMC Elder
Not sure if it's possible to do this directly, but you could search for the variable name, open up all scripts/code actions that contain a write to it, then set breakpoints on every line that changes it. Run the game in debug mode, and when any of those lines are executed, the game is paused and the corresponding line is highlighted, and you can also use the normal debugger functionality to check every variable's value, object placement etc.
 
Also, you could put a show_debug_message() in every place in the code where you change it, then you will get a sequence of messages in the output showing the order in which it is being changed. Make sure each debug message is unique (i usually include the instance id and object_index) so you can trace it.
 
Thanks for your reply. The problem is I was sure where these variables are changing the value but I don't know why they are passing a zero value. I am assuming I have left something lieing about where it shouldn't be. I wanted to find out where it was called from without knowing.
 
Thats good news. How did you figure it out. Did you find some other way of tracking the variable, or did you use any of the above methods.
 
Top