Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- place on your Table of Contents Object. You will have to set your own button positions
- function onLoad()
- createButtons()
- bag_rules = getObjectFromGUID('abc131')
- pos = {77.61, 3, -43.62}
- zone = getObjectFromGUID('92e76c')
- end
- function createButtons()
- self.createButton({click_function = "display_3", function_owner = self, label = "", position = {0, 0.6, -5.4}, width = 3200, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_2", function_owner = self, label = "", position = {0, 0.6, -4.9}, width = 3200, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_4", function_owner = self, label = "", position = {0, 0.6, -4.35}, width = 3200, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_8", function_owner = self, label = "", position = {0, 0.6, -3.8}, width = 3200, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_9", function_owner = self, label = "", position = {0, 0.6, -3.2}, width = 3200, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_10", function_owner = self, label = "", position = {0, 0.6, -2.15}, width = 3200, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_11", function_owner = self, label = "", position = {0, 0.6, -1.6}, width = 3200, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_14", function_owner = self, label = "", position = {0, 0.6, -1.05}, width = 5500, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_17", function_owner = self, label = "", position = {0, 0.6, -0.48}, width = 5500, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_18", function_owner = self, label = "", position = {0, 0.6, 0.09}, width = 5500, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_19", function_owner = self, label = "", position = {0, 0.6, 1.25}, width = 5500, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_19", function_owner = self, label = "", position = {0, 0.6, 1.75}, width = 2000, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_21", function_owner = self, label = "", position = {0, 0.6, 2.33}, width = 2900, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_21", function_owner = self, label = "", position = {0, 0.6, 2.83}, width = 3100, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_22", function_owner = self, label = "", position = {0, 0.6, 3.43}, width = 3100, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_22", function_owner = self, label = "", position = {0, 0.6, 4.53}, width = 5800, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_22", function_owner = self, label = "", position = {0, 0.6, 5.13}, width = 4000, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_23", function_owner = self, label = "", position = {0, 0.6, 5.73}, width = 2500, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_23", function_owner = self, label = "", position = {0, 0.6, 6.3}, width = 2500, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "display_24", function_owner = self, label = "", position = {0, 0.6, 6.82}, width = 1600, height = 225, font_size = 200,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- end
- function display_1()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 1" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_2()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 2" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_3()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 3" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_4()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 4" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_5()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 5" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_6()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 6" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_7()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 7" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_8()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 8" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_9()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 9" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_10()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 10" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_11()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 11" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_12()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 12" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_13()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 13" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_14()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 14" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_15()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 15" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_16()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 16" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_17()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 17" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_18()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 18" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_19()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 19" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_20()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 20" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_21()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 21" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_22()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 22" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_23()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 23" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function display_24()
- remove_current_page()
- for _, card in ipairs(bag_rules.getObjects()) do
- local name = card.name
- if name == "Page 24" then
- bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
- end
- end
- end
- function remove_current_page()
- for _, object in ipairs(zone.getObjects()) do
- if object.tag == "Card" or object.tag == "Deck" then
- object.destroy()
- end
- end
- end
- ---------------------------------------------------------------
- -- place on second object where rule pages spawn for next/previous page functionality
- function onLoad()
- createButtons()
- bag_rules = getObjectFromGUID('abc131')
- zone = getObjectFromGUID('92e76c')
- contents_menu = getObjectFromGUID('168ed8')
- end
- function createButtons()
- self.createButton({click_function = "previous_page", function_owner = self, label = "", position = {-5.3, 0.6, 7.9}, width = 2000, height = 300, font_size = 300,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "next_page", function_owner = self, label = "", position = {5.2, 0.6, 7.9}, width = 2000, height = 300, font_size = 300,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- self.createButton({click_function = "remove_current_page", function_owner = self, label = "",
- position = {0, 0.6, 8}, scale = {0.5, 0.5, 0.5}, width = 4100, height = 400, font_size = 400,
- color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
- end
- function remove_current_page()
- for _, object in ipairs(zone.getObjects()) do
- if object.tag == "Card" or object.tag == "Deck" then
- object.destroy()
- end
- end
- end
- function next_page()
- remove_current_page()
- for _, page in ipairs(zone.getObjects()) do
- if page.getName() == "Page 1" then
- contents_menu.call("display_2")
- elseif page.getName() == "Page 2" then
- contents_menu.call("display_3")
- elseif page.getName() == "Page 3" then
- contents_menu.call("display_4")
- elseif page.getName() == "Page 4" then
- contents_menu.call("display_5")
- elseif page.getName() == "Page 5" then
- contents_menu.call("display_6")
- elseif page.getName() == "Page 6" then
- contents_menu.call("display_7")
- elseif page.getName() == "Page 7" then
- contents_menu.call("display_8")
- elseif page.getName() == "Page 8" then
- contents_menu.call("display_9")
- elseif page.getName() == "Page 9" then
- contents_menu.call("display_10")
- elseif page.getName() == "Page 10" then
- contents_menu.call("display_11")
- elseif page.getName() == "Page 11" then
- contents_menu.call("display_12")
- elseif page.getName() == "Page 12" then
- contents_menu.call("display_13")
- elseif page.getName() == "Page 13" then
- contents_menu.call("display_14")
- elseif page.getName() == "Page 14" then
- contents_menu.call("display_15")
- elseif page.getName() == "Page 15" then
- contents_menu.call("display_16")
- elseif page.getName() == "Page 16" then
- contents_menu.call("display_17")
- elseif page.getName() == "Page 17" then
- contents_menu.call("display_18")
- elseif page.getName() == "Page 18" then
- contents_menu.call("display_19")
- elseif page.getName() == "Page 19" then
- contents_menu.call("display_20")
- elseif page.getName() == "Page 20" then
- contents_menu.call("display_21")
- elseif page.getName() == "Page 21" then
- contents_menu.call("display_22")
- elseif page.getName() == "Page 22" then
- contents_menu.call("display_23")
- elseif page.getName() == "Page 23" then
- contents_menu.call("display_24")
- end
- end
- end
- function previous_page()
- remove_current_page()
- for _, page in ipairs(zone.getObjects()) do
- if page.getName() == "Page 2" then
- contents_menu.call("display_1")
- elseif page.getName() == "Page 3" then
- contents_menu.call("display_2")
- elseif page.getName() == "Page 4" then
- contents_menu.call("display_3")
- elseif page.getName() == "Page 5" then
- contents_menu.call("display_4")
- elseif page.getName() == "Page 6" then
- contents_menu.call("display_5")
- elseif page.getName() == "Page 7" then
- contents_menu.call("display_6")
- elseif page.getName() == "Page 8" then
- contents_menu.call("display_7")
- elseif page.getName() == "Page 9" then
- contents_menu.call("display_8")
- elseif page.getName() == "Page 10" then
- contents_menu.call("display_9")
- elseif page.getName() == "Page 11" then
- contents_menu.call("display_10")
- elseif page.getName() == "Page 12" then
- contents_menu.call("display_11")
- elseif page.getName() == "Page 13" then
- contents_menu.call("display_12")
- elseif page.getName() == "Page 14" then
- contents_menu.call("display_13")
- elseif page.getName() == "Page 15" then
- contents_menu.call("display_14")
- elseif page.getName() == "Page 16" then
- contents_menu.call("display_15")
- elseif page.getName() == "Page 17" then
- contents_menu.call("display_16")
- elseif page.getName() == "Page 18" then
- contents_menu.call("display_17")
- elseif page.getName() == "Page 19" then
- contents_menu.call("display_18")
- elseif page.getName() == "Page 20" then
- contents_menu.call("display_19")
- elseif page.getName() == "Page 21" then
- contents_menu.call("display_20")
- elseif page.getName() == "Page 22" then
- contents_menu.call("display_21")
- elseif page.getName() == "Page 23" then
- contents_menu.call("display_22")
- elseif page.getName() == "Page 24" then
- contents_menu.call("display_23")
- end
- end
- end
- function remove_current_page()
- for _, object in ipairs(zone.getObjects()) do
- if object.tag == "Card" or object.tag == "Deck" then
- object.destroy()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement