locked
Hi Score code made me think of loading web images to users local hard drive. RRS feed

  • Question

  • I made this Hi Score test code below.   JRB424  It won't work on the web, won't work to import either, you have to cut and past to sb.

    It gave me an idea about loading images from the web and saving them to the users local hard drive for the next time the program is loaded. If the user has the files on the hard drive then I assume there will be less lag to get things started the second time a program is loaded. But I just noticed that all the file handling lines are commented out when a file is published, is there any way around this?

    'Hi score File creator
    TextWindow.Show()
    path = Program.Directory
    TextWindow.WriteLine(path)
    TextWindow.Write("Enter your score, ")
    score = TextWindow.Read()
    hiscore = File.ReadContents(path + "\HiScore.txt")
    TextWindow.WriteLine("Hi Score is " + hiscore)
    If score > hiscore Then
      TextWindow.WriteLine("Your hi score of " + score + " has been saved!")
      File.WriteContents(path + "\HiScore.txt",score)
    Else
      TextWindow.WriteLine("You did not get the hi score.")
    EndIf
     

    • Changed type JKrueg Sunday, May 13, 2012 3:42 AM
    Sunday, May 13, 2012 1:04 AM

Answers

  • So I spent about two hours revewing this and I think that unless you use a data extention, there is no way to do it. the reason it comments it out is because you can save things on a hard disk and it might be a bug.
    • Marked as answer by JKrueg Saturday, May 19, 2012 12:19 AM
    Wednesday, May 16, 2012 2:05 AM
    Answerer

All replies

  • If you are worried about the commenting out part, try somthing like this:

    On line seven:  hiscore = FilePlus.ReadContents(path + "\HiScore.txt")

    On line eleven: FilePlus.WriteContents(path + "\HiScore.txt",score)

    this will stop the commenting out because SB does not see fileplus. as the same as file.

    BTW, nice program. do you mind if I use it for part of mine?


    Tuesday, May 15, 2012 12:14 AM
    Answerer
  • What about trying to stay with the stock small basic code so it, "just works for everyone"? How many people with small basic go the next step and load any extensions? I have only loaded the LD extensions, haven't really tried any yet, just looked at sample code.

    As far as using parts of the code, go for it, I would like to see what becomes of it. This was a test to see it work before I put into Soda Pop Showdown.

    Tuesday, May 15, 2012 1:46 AM
  • So I spent about two hours revewing this and I think that unless you use a data extention, there is no way to do it. the reason it comments it out is because you can save things on a hard disk and it might be a bug.
    • Marked as answer by JKrueg Saturday, May 19, 2012 12:19 AM
    Wednesday, May 16, 2012 2:05 AM
    Answerer