Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Saving timer string data to store as highscore

Author
Message
rockethippo
9
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 24th Feb 2015 03:15
I currently have a timer connected to a button that will display the amount of time the button has been held down:
AddVirtualButton( 4, 50, 80, 30)
SetVirtualButtonAlpha(4,255)
SetVirtualButtonImageUp(4,4)
SetVirtualButtonImagedown(4,4)
SetVirtualButtonVisible(4,0)
SetVirtualButtonActive(4,0)

do
if GetVirtualButtonState(4)=1
SetTextString(myText, str(Timer(),1))
SetTextVisible(3,0)
endif
sync()
loop

I don't know how to store the timer data as a string and then later bring up the stored timer string data in a different screen. I'm trying to create a high score display with the score consisting of how long the button has been held down. I've been experimenting with opentowrite,opentoread commands but nothing if working for me.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Feb 2015 06:53
Try something like this:


There's no need to store a string in a text file, you can use a string variable declared as so:



Using AppGameKit V2 Tier 1
rockethippo
9
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 24th Feb 2015 10:17 Edited at: 24th Feb 2015 10:19
Hmm I don't think your code will make it possible to store and display a high score though?

Login to post a reply

Server time is: 2024-11-23 08:00:16
Your offset time is: 2024-11-23 08:00:16