I am trying to write a simple function that determines a new valueto identify a string, every x frames.
I am relatively new to programming, but I think I'm able to master the basics and some more..
I can't seem to get it working Please take a look and tell me what I am doing wrong..
with this code it seems to be working correctly at the exact frame specified, but not every frame until next change, which is my intention. Sync rate is slowed down to easily follow the changes.
sync on : sync rate 1
iterations = 1
value = 1
hand=1
dim hand$(3)
hand$(1) = "Fist / Stone"
hand$(2) = "Two / Scissors"
hand$(3) = "Hand / Paper"
do
cls
iteration=iteration+1
if iteration>10
iteration=0
endif
chose(iteration)
set cursor 0,80
print "iteration ",iteration
sync
loop
function chose(time)
set cursor 0,0
newvalue=rnd(2)+1
if time=1
if newvalue>value
value=newvalue
endif
if newvalue<value
value=newvalue
endif
time=0
hand=newvalue
endif
chosen$=hand$(hand)
c$=chosen$
print "chosen is: ",chosen$
//display values to debug code:
print "iteration: ",iteration
print "newvalue: ",newvalue
print "hand value: ",hand
endfunction chosen$