how to increment variable by 1 using bolt

Right this is what I am currently doing, below I will try and describe it clearly, cant include the flow graph, because I am a useless and it is needlessly large so wont fit.

I have a timer which lasts for 1 second then it updates a variable called one second timer with the value

when the one second timer variable updates, i have an if statement which checks if the one second timer variable is equals to one, if it is then i want the Seconds elapsed since start variable to be incremented by one.

when the seconds elapsed since start reach 60, i have another if statement which does the same thing again but this time it increments the minutes elapsed since start variable by one.

i am programming my own skybox in bolt and this is so I can keep track of the amount of time that has elapsed since the game has been started, i know that there are probably more intelligent ways of doing it, but i have only just started and this is the only way I could think of doing it.

it is relatively simple in programming, although I cant programme at all using the csharp language there are plenty of resources online which show you how to do it, but in bolt I haven’t seen a single mention of increment at all, I am currently searching through all of YouTube to try and see if anyone just happens to do this in there tutorials, thank you in advanced

Bolt doesn’t have a native increment operator at this moment in time. So what you do is this:

  1. Get current variable value with Get Variable unit
  2. Use scalar Add unit to add + 1 to current variable value
  3. Wire the Add value output to a Set Variable unit

Get Variable X → Add +1 to variable X → Set Variable X.

2 Likes
void update
{
variable++;
}