Results 1 to 4 of 4

Thread: Loading or savign input

  1. #1

    Loading or savign input

    Hi all,

    I'm doing some prototyping and I made a card that uses an input field to allow me to type on the cards:

    function onLoad(save_state)
    local test = 
    		input_function = "updateInput",
    		function_owner = self,
    		label = nil,
    		position = {0, 0.3, 0.2},
    		rotation = {0, 0, 0},
    		scale = {0.5, 0.5, 0.5}, 
    		width = 2000, 
            height = 2300, 
            font_size = 150,
    		value = "Text"
    function updateInput(objectInputTyped, playerColorTyped, input_value, selected)
    That works and creates an input field that covers the face of the card and I can type on it.
    The issue is that the contents of the input field gets lost easily (e.g. when copy/pasting the object, or putting it in a deck and pulling it out again)

    Ideally what I'd like to do is:

    Have the text for each card stored in some sort of external file (like a spread sheet or similar).
    Give each card an ID in its title and then on load, look up that ID in the external file to find the associated text, load that text and put it in the input field.
    If changes are made to the input field, save them to the external file.

    Is that possible?

    If not, would it be possible to save the input field's text when the card is saved using the Save Object option on the menu. Currently if I save an object, then place it from the Saved Objects menu, it loses its text.
    If I could get it to remember the text then I could make the cards individually and save them all as separate objects. Not as good as loading it automatically from an external file, but I'm okay with it if it's more feasible.

    Oh I should also mention I'm okay if this is doable but complicated, I'm not new to programming, just to lua so just need to be pointed at the relevant functions if they exist.

    Thanks for any help.

    - - - Updated - - -

    Damn can't believe I didn't spot the typo in the subject

  2. #2
    Join Date
    May 2016
    Not seeing an onSave. If you had one, then losing the data you type into the value wouldn't be an issue! Check out [url][/url] and [url][/url] for how to use it. Basically, record the value from the input into a table whenever edits are made to the input. And, when loading, load the value from that recorded table.

    What what you are discussing, if by external you mean online, then yes. The webrequest system would allow you to push and pull tables of data to an external database, but it would require setting up such a database, which is significantly more complex if you aren't familiar with such things

  3. #3
    Okay but then the data would be in the save file right?
    So if I redistributed the cards through steam workshop, the data wouldn't go with it would it?
    Is there a way to save the data into the cards?

  4. #4
    Nevermind I have solved this by encoding the data into the card's description.
    Not ideal, but does what I need.

Similar Threads

  1. Input boxes and Buttons
    By RespawningPleaseWait in forum Scripting
    Replies: 7
    Last Post: 02-19-2018, 03:03 AM
  2. Input Boxes oversight (bug)
    By Flolania in forum Scripting Bug Reports
    Replies: 0
    Last Post: 08-25-2017, 10:37 PM
  3. Input fields in scripting
    By Unreal_Ed in forum Suggestions
    Replies: 0
    Last Post: 07-14-2017, 05:34 PM
  4. Keyboard/other input in the Lua API
    By cosmicAmphibian in forum Scripting Suggestions
    Replies: 1
    Last Post: 01-31-2017, 08:22 AM
  5. Keep input fields after import
    By PsiComa in forum Suggestions
    Replies: 2
    Last Post: 07-10-2015, 04:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts