Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
DataSaver and user input/user name? — Gideros Forum

DataSaver and user input/user name?

underblissunderbliss Member
edited December 2014 in General questions
Hi! :)
I'm sorry if this is a silly question. I'm pretty clueless, but Gideros and the community make it fun!

I think I'm starting to get dataSaver working for the most part... but I am looking for a way to allow users to name their character. (Well, for the name to be saved.)
The user defines 'username' with a TextInputDialog...

local function onComplete(event)
if event.buttonIndex then
username = event.text,
dataSaver.saveValue("|D|username", username)

...doesn't seem to work, and I'm not sure if I'm just doing something wrong, or dataSaver isn't meant for that. If that can't be done with dataSaver is there something else I can use in Gideros for it?

Comments

  • @underbliss you don't need |D| for saveValue because it is saving value in common document.
    You only need |D| for save and load methods, because they are saving data in separate files.

    But all in all it should have worked
    local function onComplete(event)
       if event.buttonIndex then
          username = event.text, 
          dataSaver.saveValue("username", username)
          print(dataSaver.loadValue("username"))
  • Ohhhh!

    Humm..
    in the main.lua I've got...

    username = dataSaver.loadValue("username")
    if(not username) then
    username = "Alice"
    dataSaver.saveValue("username", username)
    end

    when I close and reopen the game username always reverts back to Alice, maybe I'm doing something wrong there?
Sign In or Register to comment.