Trying to return the value of a global variable.
The variable is designated to count the number of steps total made in playthrough.
How do I return the value of that variable at a specific time, but without it steadily increasing as you walk?
In other words, the variable needs to return a static number (unchanging),
so I can compare it to itself after six steps have been taken when that value was returned.
For example:
if (Battle = true || NewStepCount is less than or equal to 6 steps than the OldStepCount) return true;
This is what I have so far:
function CheckAction(){
CheckActionButtons();
if (Battle = true || (Steps - OldStepCount) <= 6) {return true}
else {return false;}
}
function GetStepCount(){ return Steps; }
function CheckActionButtons(){
if (IsKeyPressed(KEY_SPACE)) {return true, OldStepCount = GetStepCount();}
if (IsKeyPressed(KEY_Z)) {return true, OldStepCount = GetStepCount();}
else {return false;}
}
The reason is I want to display my interface on when an action button is pressed, or if a battle is going on.
Which I've already place in:
if (CheckAction() == true) {Interface_Render();}
Also, note: OldStepCount is a global variable, and so is Steps.
The weird thing though is OldStepCount is always at zero (because I haven't pressed any ActionButtons), but the interface is still displaying.