@aliz94 said:
How do I calculate the rate per second of an attribute.
An attribute does not have a 'rate'.
@aliz94 said:
For example if I am earning 10 oranges/sec how do I display this?
I'd simply use "10"
?
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
edited June 2014
Hi @aliz94 as @Socks says, an attribute doesn't have a rate, an attribute value can have, but I'm certain you meant to say that! so I'll revise your question:
How do I display an integer (attribute) showing an average amount every second?
I'm almost finished putting together a little test for you to show that; I'll post it soon.
The basic principle is using integer attributes: game.PrevTotal, game.LatestTotal, game.AverageTotal and game.Count and use the following in your Average attribute in a Display Text behaviour to display every period of time required:
Change Attribute game.Count to game.Count+1
Change Attribute game.PrevTotal to ( game.PrevTotal + game.LatestTotal )
Change Attribute game.AverageTotal to game.PrevTotal / game.Count
Change Attribute LatestTotal to 0
At least, I think that should work... off to finish the game file now... I'll be back...
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
edited June 2014
Here it is for you to check out... the only thing I've changed is the rate every 1 second seemed too quick in this user picking example, so I've made it every 4 seconds. Obviously you can change that to whatever you want.
Edit again: if anyone's downloaded v1, 2 or 3, I've added changing Count to 0 in the Go button + deleted test actors, etc: here's latest version v4 now.
@gyroscope said:
Here it is for you to check out... the only thing I've changed is the rate every 1 second seemed too quick in this user picking example, so I've made it every 4 seconds. Obviously you can change that to whatever you want.
Edit again: if anyone's downloaded v1, 2 or 3, I've added changing Count to 0 in the Go button + deleted test actors, etc: here's latest version v4 now.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Comments
An attribute does not have a 'rate'.
I'd simply use "10"
?
Hi @aliz94 as @Socks says, an attribute doesn't have a rate, an attribute value can have, but I'm certain you meant to say that!
so I'll revise your question:
I'm almost finished putting together a little test for you to show that; I'll post it soon.
The basic principle is using integer attributes: game.PrevTotal, game.LatestTotal, game.AverageTotal and game.Count and use the following in your Average attribute in a Display Text behaviour to display every period of time required:
At least, I think that should work... off to finish the game file now... I'll be back...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Here it is for you to check out... the only thing I've changed is the rate every 1 second seemed too quick in this user picking example, so I've made it every 4 seconds. Obviously you can change that to whatever you want.
Edit again: if anyone's downloaded v1, 2 or 3, I've added changing Count to 0 in the Go button + deleted test actors, etc: here's latest version v4 now.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Wow thanks a lot, really appreciate it.
You're welcome, and glad it helped.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Lol, I'm glad you worked that one out, I was stumped !!
Ah, Cheers, @Socks
I was on a roll this morning for some reason.... ham or cheese, I wasn't sure...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Don't give up the day job
But...but...The Comedy Club beckons.....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps