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:
Code:
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,
nil,
nil,
nil,
nil,
value = "Text"
}
self.createInput(test)
end
function updateInput(objectInputTyped, playerColorTyped, input_value, selected)
print(input_value)
end
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