Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onSave()
- saved_boxdata = JSON.encode(ref_checkboxes)
- --saved_boxdata=""
- return saved_boxdata
- end
- function onload(saved_boxdata)
- --Loads the tracking for if the game has started yet
- saved_boxdata=""
- if saved_boxdata ~= "" then
- local loaded_data = JSON.decode(saved_boxdata)
- ref_checkboxes = loaded_data
- else
- ref_checkboxes = {
- --Notes Section
- {pos={0.211,0.1,0.386}, state=false},
- {pos={0.257,0.1,0.386}, state=false},
- {pos={0.302,0.1,0.386}, state=false},
- {pos={0.409,0.1,0.386}, state=false},
- {pos={0.455,0.1,0.386}, state=false},
- {pos={0.500,0.1,0.386}, state=false},
- {pos={0.606,0.1,0.386}, state=false},
- {pos={0.652,0.1,0.386}, state=false},
- {pos={0.697,0.1,0.386}, state=false},
- {pos={0.211,0.1,0.445}, state=false},
- {pos={0.257,0.1,0.445}, state=false},
- {pos={0.302,0.1,0.445}, state=false},
- {pos={0.409,0.1,0.445}, state=false},
- {pos={0.455,0.1,0.445}, state=false},
- {pos={0.500,0.1,0.445}, state=false},
- {pos={0.606,0.1,0.445}, state=false},
- {pos={0.652,0.1,0.445}, state=false},
- {pos={0.697,0.1,0.445}, state=false},
- --Perks Section
- {pos={0.163,0.1,-0.801}, state=false},
- {pos={0.212,0.1,-0.801}, state=false},
- {pos={0.163,0.1,-0.726}, state=false},
- {pos={0.163,0.1,-0.651}, state=false},
- {pos={0.163,0.1,-0.527}, state=false},
- {pos={0.163,0.1,-0.403}, state=false},
- {pos={0.212,0.1,-0.403}, state=false},
- {pos={0.163,0.1,-0.276}, state=false},
- {pos={0.212,0.1,-0.276}, state=false},
- {pos={0.163,0.1,-0.198}, state=false},
- {pos={0.163,0.1,-0.123}, state=false},
- {pos={0.212,0.1,-0.123}, state=false},
- {pos={0.163,0.1,-0.002}, state=false},
- {pos={0.163,0.1,0.076}, state=false},
- {pos={0.163,0.1,0.183}, state=false},
- }
- end
- createCheckboxes()
- end
- function createCheckboxes()
- --print('createCheckboxes funcatoin has been called')
- for i, boxData in ipairs(ref_checkboxes) do
- --Set up the function trigger
- local funcName = "checkbox"..i
- local func = function() toggleCheck(i) end
- self.setVar(funcName, func)
- --Set the X
- local label = ""
- print(tostring(label))
- if boxData.state == true then label = "X" end
- --Make the button
- self.createButton({
- click_function = funcName, function_owner = self, label = label,
- position =boxData.pos, width = 150, height = 150, font_size = 145,
- scale = {0.1,0.1,0.1}
- })
- end
- end
- function toggleCheck(i)
- if ref_checkboxes[i].state == true then
- self.editButton({index=i-1, label=""})
- ref_checkboxes[i].state = false
- else
- self.editButton({index=i-1, label="X"})
- ref_checkboxes[i].state = true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement