Author Topic: How to save high scores in Lua  (Read 5654 times)

0 Members and 1 Guest are viewing this topic.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
How to save high scores in Lua
« on: July 29, 2011, 01:05:27 pm »
^^That
I tried document.markChanged(), but it didn't save anything.
« Last Edit: July 29, 2011, 01:05:38 pm by pianoman »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: How to save high scores in Lua
« Reply #1 on: July 29, 2011, 01:08:24 pm »
^^That
I tried document.markChanged(), but it didn't save anything.

You need to use var so that you can store (var.store(()) variables forever. And markChanged() is only to warn the user that he must save, it doesn't actually save anything.

I learnt it by looking at code of other programs ;) To be precise, Pixel Escape.
« Last Edit: July 29, 2011, 01:08:59 pm by ephan »

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: How to save high scores in Lua
« Reply #2 on: July 29, 2011, 01:11:26 pm »
Oh, ok, I'll take a look at the code for that. Thanks!

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: How to save high scores in Lua
« Reply #3 on: July 29, 2011, 02:09:33 pm »
Oh, ok, I'll take a look at the code for that. Thanks!

It's actually very easy, don't forget to check #nspire-lua for additional help. I had the guys from there help me with this and I can also help you now.

Offline cypressx1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 45
  • Rating: +0/-0
    • View Profile
Re: How to save high scores in Lua
« Reply #4 on: July 30, 2011, 08:07:36 pm »
l think var.monitor should also be used.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: How to save high scores in Lua
« Reply #5 on: July 30, 2011, 08:10:57 pm »
l think var.monitor should also be used.
Yep, to prevent the user from hacking into the high score ^^
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: How to save high scores in Lua
« Reply #6 on: July 30, 2011, 10:11:54 pm »
yep, definitely, on any non wanted var.change, you could rewrite it from a local lua copy :P
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline cypressx1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 45
  • Rating: +0/-0
    • View Profile
Re: How to save high scores in Lua
« Reply #7 on: August 02, 2011, 07:51:32 am »
all right

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: How to save high scores in Lua
« Reply #8 on: August 04, 2011, 03:18:26 pm »
A little bump for this topic to add a full and detailed answer :
http://www.inspired-lua.org/2011/08/save-a-high-score-without-cheating-possibility/

I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: How to save high scores in Lua
« Reply #9 on: August 12, 2011, 06:54:18 am »
It's still quite easy to cheat...
You just have to
1. open the page sorter
2. cut (Ctrl+X) the Lua app
3. add a math editor
4. change your var
5. paste the Lua app

EDIT : I did not see the last part with on.save() and on.restore()... It makes my solution useless
« Last Edit: August 12, 2011, 06:59:29 am by Chockosta »