Try something like this:
AddVirtualButton( 4, 50, 80, 30)
SetVirtualButtonAlpha(4,255)
SetVirtualButtonImageUp(4,4)
SetVirtualButtonImagedown(4,4)
SetVirtualButtonVisible(4,0)
SetVirtualButtonActive(4,0)
StartTime# = 0.0
mode = 0
do
select mode
case 0
if GetVirtualButtonPressed(4)=1
StartTime# = timer()
mode = 1
endif
endcase
case 1
if GetVirtualButtonState(4)=0
SetTextString(myText, timer()-str(StartTime#))
mode = 0
endif
endselect
sync()
loop
There's no need to store a string in a text file, you can use a string variable declared as so:
myString1 as string
myString1 = Str(timer(), 0) ' here the zero represents the number of decimal places to keep
'or
myString2$ = Str(timer())
Using AppGameKit V2 Tier 1