Oh... The problem was that it didn't work when Shots was 0. (Because you can't divide by 0).
This works:
I just made it for percent. You can change it if you want decimals.
By the way, great game.
Is that good?
Offline
scmb1 wrote:
Oh... The problem was that it didn't work when Shots was 0. (Because you can't divide by 0).
This works:
http://img94.imageshack.us/img94/1010/picture2myy.png
I just made it for percent. You can change it if you want decimals.
By the way, great game.
Is that good?
Yeah, it works great in a remix I'm working on. This is a GREAT game!!
Question: when Accuracy is set to a percentage, is there any way to get rid of all the decimals??? Seeing something like: 83.574639485756% just doesn't do it... :-/
Offline
Larry828 wrote:
scmb1 wrote:
Oh... The problem was that it didn't work when Shots was 0. (Because you can't divide by 0).
This works:
http://img94.imageshack.us/img94/1010/picture2myy.png
I just made it for percent. You can change it if you want decimals.
By the way, great game.
Is that good?Yeah, it works great in a remix I'm working on. This is a GREAT game!!
Question: when Accuracy is set to a percentage, is there any way to get rid of all the decimals??? Seeing something like: 83.574639485756% just doesn't do it... :-/
I messed around with it and couldn't find any trick. The only thing I can think of is just get rid of the join and put the percent outside the variable. That's not as cool though...
Offline
You could try multiplying the percent by a power of ten, rounding it (change it by -.5 first), and dividing it... I did that, and it worked.
Offline
Chrischb wrote:
You could try multiplying the percent by a power of ten, rounding it (change it by -.5 first), and dividing it... I did that, and it worked.
![]()
And it seems to work too if you insert "round" into the script line for Accuracy given by scmb1:
Set (Accuracy) to [join (round (hits/shots * 100)) %]
But maybe we're saying the same thing!
Offline
scmb1 wrote:
Oh... The problem was that it didn't work when Shots was 0. (Because you can't divide by 0).
This works:
http://img94.imageshack.us/img94/1010/picture2myy.png
I just made it for percent. You can change it if you want decimals.
By the way, great game.
Is that good?
**How do you put those screen shots into Forum postings?? They're great!
Offline
Use the image BBcode for images
[img]image url here[/img]
Here is the rest of the bbcode stuff http://scratch.mit.edu/forums/help.php#bbcode
Offline
Larry828 wrote:
scmb1 wrote:
Oh... The problem was that it didn't work when Shots was 0. (Because you can't divide by 0).
This works:
http://img94.imageshack.us/img94/1010/picture2myy.png
I just made it for percent. You can change it if you want decimals.
By the way, great game.
Is that good?**How do you put those screen shots into Forum postings?? They're great!
Like archmage said, I used BBcode. To get the images, I made the blocks on Scratch and took a screen shot. Then, I uploaded them to ImageShack (I use ImageShack because you don't need an account) and used the url in my BBcode. I find that easier to do than using the forum blocks.
About rounding: If you want no decimals, use your method. Chischb's method allows to round to certain number of decimals. For this use, I think your method works fine, but when it is necessary to be a little more precise, Chischb's would be good.
Offline
Thanks to archmage and scmb1 for the tips on BBcode and on rounding and decimals.
Extremely helpful!
(Now I understand better the coding when I "preview" a posting before submitting it.)
The Scratch Forums are terrific.
Offline