For a mini-game I want to make a bunch of variables update every second. The idea is for the player to bet if the value goes up or down.
The base is easy to make. I don't have a problem updating the variable, or having the player guess which number will go up and which number will go down.
I save all the last 20 values of each variable in an array (which is stored in a variable too).
To make this game look more slick, and add some more tactical insight for the player, I would like to show a graph with the last 20 values, like this:
(Gimp made example of what I try to do.)
But even with all my javascript knowledge (which is less than it sounds), I have no idea how to pull this off.
So, I already have the values in an array, in the right order. So element 0 would be on the left (20 turns ago) and element 20 on the right (current turn)
It would be extra swell if I can show the values of multiple arrays in the same graph. Like above, I used 3 lines for 3 different arrays. (not really, though. I just made this in gimp)
Is there an easy way to do this, either with a script-call or a piece of code I can run with a plugin command?
I'm afraid this is going to be very complicated to pull off with a simple script call. I could do it with bars, if I make every bar its own picture picture... But it would be much prettier if I could use lines.
So, is there an easy way to do this, or should I just go for bars?
Edit: Actually the only thing I don't know how to do is how to draw a line from X,Y coordinates of the first value to X,Y coordinates of the second value. And how to draw a white background, unless I can just use show-picture.
The base is easy to make. I don't have a problem updating the variable, or having the player guess which number will go up and which number will go down.
I save all the last 20 values of each variable in an array (which is stored in a variable too).
To make this game look more slick, and add some more tactical insight for the player, I would like to show a graph with the last 20 values, like this:
(Gimp made example of what I try to do.)
But even with all my javascript knowledge (which is less than it sounds), I have no idea how to pull this off.
So, I already have the values in an array, in the right order. So element 0 would be on the left (20 turns ago) and element 20 on the right (current turn)
It would be extra swell if I can show the values of multiple arrays in the same graph. Like above, I used 3 lines for 3 different arrays. (not really, though. I just made this in gimp)
Is there an easy way to do this, either with a script-call or a piece of code I can run with a plugin command?
I'm afraid this is going to be very complicated to pull off with a simple script call. I could do it with bars, if I make every bar its own picture picture... But it would be much prettier if I could use lines.
So, is there an easy way to do this, or should I just go for bars?
Edit: Actually the only thing I don't know how to do is how to draw a line from X,Y coordinates of the first value to X,Y coordinates of the second value. And how to draw a white background, unless I can just use show-picture.