I'm trying to create an accuracy value. If a player misses the target, their total value increases by 1, and if they hit the target, their total and hit values increase by 1. To get the accuracy, it's basic math, right? I can't get any acc from this:
hit=0
total=0
do
if total > 0
acc = hit / total * 100
endif
if mouseclick() = 1 then inc total,1
if spacekey() = 1 then inc hit,1
print acc
print hit
print total
sync
loop
Ideally, this would give acc a value between 0 and 100. But acc only returns 0 if total > hit and 100 if total < hit. Why won't a hit value of 8 and a total value of 10 make acc = 80?