SHARE
TWEET

Untitled

a guest Nov 8th, 2017 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- place on your Table of Contents Object. You will have to set your own button positions
  2. function onLoad()
  3.   createButtons()
  4.   bag_rules = getObjectFromGUID('abc131')
  5.   pos = {77.61, 3, -43.62}
  6.   zone = getObjectFromGUID('92e76c')
  7.  
  8. end
  9.  
  10. function createButtons()
  11. self.createButton({click_function = "display_3", function_owner = self, label = "", position = {0, 0.6, -5.4}, width = 3200, height = 225, font_size = 200,
  12. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  13.  
  14. self.createButton({click_function = "display_2", function_owner = self, label = "", position = {0, 0.6, -4.9}, width = 3200, height = 225, font_size = 200,
  15. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  16.  
  17. self.createButton({click_function = "display_4", function_owner = self, label = "", position = {0, 0.6, -4.35}, width = 3200, height = 225, font_size = 200,
  18. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  19.  
  20. self.createButton({click_function = "display_8", function_owner = self, label = "", position = {0, 0.6, -3.8}, width = 3200, height = 225, font_size = 200,
  21. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  22.  
  23. self.createButton({click_function = "display_9", function_owner = self, label = "", position = {0, 0.6, -3.2}, width = 3200, height = 225, font_size = 200,
  24. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  25.  
  26. self.createButton({click_function = "display_10", function_owner = self, label = "", position = {0, 0.6, -2.15}, width = 3200, height = 225, font_size = 200,
  27. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  28.  
  29. self.createButton({click_function = "display_11", function_owner = self, label = "", position = {0, 0.6, -1.6}, width = 3200, height = 225, font_size = 200,
  30. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  31.  
  32. self.createButton({click_function = "display_14", function_owner = self, label = "", position = {0, 0.6, -1.05}, width = 5500, height = 225, font_size = 200,
  33. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  34.  
  35. self.createButton({click_function = "display_17", function_owner = self, label = "", position = {0, 0.6, -0.48}, width = 5500, height = 225, font_size = 200,
  36. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  37.  
  38. self.createButton({click_function = "display_18", function_owner = self, label = "", position = {0, 0.6, 0.09}, width = 5500, height = 225, font_size = 200,
  39. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  40.  
  41. self.createButton({click_function = "display_19", function_owner = self, label = "", position = {0, 0.6, 1.25}, width = 5500, height = 225, font_size = 200,
  42. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  43.  
  44. self.createButton({click_function = "display_19", function_owner = self, label = "", position = {0, 0.6, 1.75}, width = 2000, height = 225, font_size = 200,
  45. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  46.  
  47. self.createButton({click_function = "display_21", function_owner = self, label = "", position = {0, 0.6, 2.33}, width = 2900, height = 225, font_size = 200,
  48. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  49.  
  50. self.createButton({click_function = "display_21", function_owner = self, label = "", position = {0, 0.6, 2.83}, width = 3100, height = 225, font_size = 200,
  51. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  52.  
  53. self.createButton({click_function = "display_22", function_owner = self, label = "", position = {0, 0.6, 3.43}, width = 3100, height = 225, font_size = 200,
  54. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  55.  
  56. self.createButton({click_function = "display_22", function_owner = self, label = "", position = {0, 0.6, 4.53}, width = 5800, height = 225, font_size = 200,
  57. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  58.  
  59. self.createButton({click_function = "display_22", function_owner = self, label = "", position = {0, 0.6, 5.13}, width = 4000, height = 225, font_size = 200,
  60. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  61.  
  62. self.createButton({click_function = "display_23", function_owner = self, label = "", position = {0, 0.6, 5.73}, width = 2500, height = 225, font_size = 200,
  63. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  64.  
  65. self.createButton({click_function = "display_23", function_owner = self, label = "", position = {0, 0.6, 6.3}, width = 2500, height = 225, font_size = 200,
  66. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  67.  
  68. self.createButton({click_function = "display_24", function_owner = self, label = "", position = {0, 0.6, 6.82}, width = 1600, height = 225, font_size = 200,
  69. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  70. end
  71.  
  72. function display_1()
  73.   remove_current_page()
  74.   for _, card in ipairs(bag_rules.getObjects()) do
  75.     local name = card.name
  76.     if name == "Page 1" then
  77.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  78.     end
  79.   end
  80. end
  81.  
  82. function display_2()
  83.   remove_current_page()
  84.   for _, card in ipairs(bag_rules.getObjects()) do
  85.     local name = card.name
  86.     if name == "Page 2" then
  87.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  88.     end
  89.   end
  90. end
  91.  
  92. function display_3()
  93.   remove_current_page()
  94.   for _, card in ipairs(bag_rules.getObjects()) do
  95.     local name = card.name
  96.     if name == "Page 3" then
  97.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  98.     end
  99.   end
  100. end
  101.  
  102. function display_4()
  103.   remove_current_page()
  104.   for _, card in ipairs(bag_rules.getObjects()) do
  105.     local name = card.name
  106.     if name == "Page 4" then
  107.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  108.     end
  109.   end
  110. end
  111.  
  112. function display_5()
  113.   remove_current_page()
  114.   for _, card in ipairs(bag_rules.getObjects()) do
  115.     local name = card.name
  116.     if name == "Page 5" then
  117.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  118.     end
  119.   end
  120. end
  121.  
  122. function display_6()
  123.   remove_current_page()
  124.   for _, card in ipairs(bag_rules.getObjects()) do
  125.     local name = card.name
  126.     if name == "Page 6" then
  127.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  128.     end
  129.   end
  130. end
  131.  
  132. function display_7()
  133.   remove_current_page()
  134.   for _, card in ipairs(bag_rules.getObjects()) do
  135.     local name = card.name
  136.     if name == "Page 7" then
  137.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  138.     end
  139.   end
  140. end
  141.  
  142. function display_8()
  143.   remove_current_page()
  144.   for _, card in ipairs(bag_rules.getObjects()) do
  145.     local name = card.name
  146.     if name == "Page 8" then
  147.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  148.     end
  149.   end
  150. end
  151.  
  152. function display_9()
  153.   remove_current_page()
  154.   for _, card in ipairs(bag_rules.getObjects()) do
  155.     local name = card.name
  156.     if name == "Page 9" then
  157.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  158.     end
  159.   end
  160. end
  161.  
  162. function display_10()
  163.   remove_current_page()
  164.   for _, card in ipairs(bag_rules.getObjects()) do
  165.     local name = card.name
  166.     if name == "Page 10" then
  167.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  168.     end
  169.   end
  170. end
  171.  
  172. function display_11()
  173.   remove_current_page()
  174.   for _, card in ipairs(bag_rules.getObjects()) do
  175.     local name = card.name
  176.     if name == "Page 11" then
  177.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  178.     end
  179.   end
  180. end
  181.  
  182. function display_12()
  183.   remove_current_page()
  184.   for _, card in ipairs(bag_rules.getObjects()) do
  185.     local name = card.name
  186.     if name == "Page 12" then
  187.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  188.     end
  189.   end
  190. end
  191.  
  192. function display_13()
  193.   remove_current_page()
  194.   for _, card in ipairs(bag_rules.getObjects()) do
  195.     local name = card.name
  196.     if name == "Page 13" then
  197.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  198.     end
  199.   end
  200. end
  201.  
  202. function display_14()
  203.   remove_current_page()
  204.   for _, card in ipairs(bag_rules.getObjects()) do
  205.     local name = card.name
  206.     if name == "Page 14" then
  207.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  208.     end
  209.   end
  210. end
  211.  
  212. function display_15()
  213.   remove_current_page()
  214.   for _, card in ipairs(bag_rules.getObjects()) do
  215.     local name = card.name
  216.     if name == "Page 15" then
  217.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  218.     end
  219.   end
  220. end
  221.  
  222. function display_16()
  223.   remove_current_page()
  224.   for _, card in ipairs(bag_rules.getObjects()) do
  225.     local name = card.name
  226.     if name == "Page 16" then
  227.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  228.     end
  229.   end
  230. end
  231.  
  232. function display_17()
  233.   remove_current_page()
  234.   for _, card in ipairs(bag_rules.getObjects()) do
  235.     local name = card.name
  236.     if name == "Page 17" then
  237.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  238.     end
  239.   end
  240. end
  241.  
  242. function display_18()
  243.   remove_current_page()
  244.   for _, card in ipairs(bag_rules.getObjects()) do
  245.     local name = card.name
  246.     if name == "Page 18" then
  247.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  248.     end
  249.   end
  250. end
  251.  
  252. function display_19()
  253.   remove_current_page()
  254.   for _, card in ipairs(bag_rules.getObjects()) do
  255.     local name = card.name
  256.     if name == "Page 19" then
  257.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  258.     end
  259.   end
  260. end
  261.  
  262. function display_20()
  263.   remove_current_page()
  264.   for _, card in ipairs(bag_rules.getObjects()) do
  265.     local name = card.name
  266.     if name == "Page 20" then
  267.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  268.     end
  269.   end
  270. end
  271.  
  272. function display_21()
  273.   remove_current_page()
  274.   for _, card in ipairs(bag_rules.getObjects()) do
  275.     local name = card.name
  276.     if name == "Page 21" then
  277.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  278.     end
  279.   end
  280. end
  281.  
  282. function display_22()
  283.   remove_current_page()
  284.   for _, card in ipairs(bag_rules.getObjects()) do
  285.     local name = card.name
  286.     if name == "Page 22" then
  287.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  288.     end
  289.   end
  290. end
  291.  
  292. function display_23()
  293.   remove_current_page()
  294.   for _, card in ipairs(bag_rules.getObjects()) do
  295.     local name = card.name
  296.     if name == "Page 23" then
  297.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  298.     end
  299.   end
  300. end
  301.  
  302. function display_24()
  303.   remove_current_page()
  304.   for _, card in ipairs(bag_rules.getObjects()) do
  305.     local name = card.name
  306.     if name == "Page 24" then
  307.       bag_rules.takeObject({position = pos, rotation = {0, 180, 0}, guid = card.guid})
  308.     end
  309.   end
  310. end
  311.  
  312. function remove_current_page()
  313.   for _, object in ipairs(zone.getObjects()) do
  314.     if object.tag == "Card" or object.tag == "Deck" then
  315.       object.destroy()
  316.     end
  317.   end
  318. end
  319.  
  320. ---------------------------------------------------------------
  321.  
  322. -- place on second object where rule pages spawn for next/previous page functionality
  323.  
  324. function onLoad()
  325.   createButtons()
  326.   bag_rules = getObjectFromGUID('abc131')
  327.   zone = getObjectFromGUID('92e76c')
  328.   contents_menu = getObjectFromGUID('168ed8')
  329. end
  330.  
  331. function createButtons()
  332. self.createButton({click_function = "previous_page", function_owner = self, label = "", position = {-5.3, 0.6, 7.9}, width = 2000, height = 300, font_size = 300,
  333. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  334.  
  335. self.createButton({click_function = "next_page", function_owner = self, label = "", position = {5.2, 0.6, 7.9}, width = 2000, height = 300, font_size = 300,
  336. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  337.  
  338. self.createButton({click_function = "remove_current_page", function_owner = self, label = "",
  339. position = {0, 0.6, 8}, scale = {0.5, 0.5, 0.5}, width = 4100, height = 400, font_size = 400,
  340. color = {1, 1, 1, 0}, font_color = {0, 0, 0, 100}})
  341. end
  342.  
  343. function remove_current_page()
  344.   for _, object in ipairs(zone.getObjects()) do
  345.     if object.tag == "Card" or object.tag == "Deck" then
  346.       object.destroy()
  347.     end
  348.   end
  349. end
  350.  
  351. function next_page()
  352.   remove_current_page()
  353.   for _, page in ipairs(zone.getObjects()) do
  354.     if page.getName() == "Page 1" then
  355.       contents_menu.call("display_2")
  356.     elseif page.getName() == "Page 2" then
  357.       contents_menu.call("display_3")
  358.     elseif page.getName() == "Page 3" then
  359.       contents_menu.call("display_4")
  360.     elseif page.getName() == "Page 4" then
  361.       contents_menu.call("display_5")
  362.     elseif page.getName() == "Page 5" then
  363.       contents_menu.call("display_6")
  364.     elseif page.getName() == "Page 6" then
  365.       contents_menu.call("display_7")
  366.     elseif page.getName() == "Page 7" then
  367.       contents_menu.call("display_8")
  368.     elseif page.getName() == "Page 8" then
  369.       contents_menu.call("display_9")
  370.     elseif page.getName() == "Page 9" then
  371.       contents_menu.call("display_10")
  372.  
  373.     elseif page.getName() == "Page 10" then
  374.       contents_menu.call("display_11")
  375.     elseif page.getName() == "Page 11" then
  376.       contents_menu.call("display_12")
  377.     elseif page.getName() == "Page 12" then
  378.       contents_menu.call("display_13")
  379.     elseif page.getName() == "Page 13" then
  380.       contents_menu.call("display_14")
  381.     elseif page.getName() == "Page 14" then
  382.       contents_menu.call("display_15")
  383.     elseif page.getName() == "Page 15" then
  384.       contents_menu.call("display_16")
  385.     elseif page.getName() == "Page 16" then
  386.       contents_menu.call("display_17")
  387.     elseif page.getName() == "Page 17" then
  388.       contents_menu.call("display_18")
  389.     elseif page.getName() == "Page 18" then
  390.       contents_menu.call("display_19")
  391.     elseif page.getName() == "Page 19" then
  392.       contents_menu.call("display_20")
  393.     elseif page.getName() == "Page 20" then
  394.       contents_menu.call("display_21")
  395.     elseif page.getName() == "Page 21" then
  396.       contents_menu.call("display_22")
  397.     elseif page.getName() == "Page 22" then
  398.       contents_menu.call("display_23")
  399.     elseif page.getName() == "Page 23" then
  400.       contents_menu.call("display_24")
  401.  
  402.     end
  403.   end
  404. end
  405.  
  406. function previous_page()
  407.   remove_current_page()
  408.   for _, page in ipairs(zone.getObjects()) do
  409.  
  410.     if page.getName() == "Page 2" then
  411.       contents_menu.call("display_1")
  412.     elseif page.getName() == "Page 3" then
  413.       contents_menu.call("display_2")
  414.     elseif page.getName() == "Page 4" then
  415.       contents_menu.call("display_3")
  416.     elseif page.getName() == "Page 5" then
  417.       contents_menu.call("display_4")
  418.     elseif page.getName() == "Page 6" then
  419.       contents_menu.call("display_5")
  420.     elseif page.getName() == "Page 7" then
  421.       contents_menu.call("display_6")
  422.     elseif page.getName() == "Page 8" then
  423.       contents_menu.call("display_7")
  424.     elseif page.getName() == "Page 9" then
  425.       contents_menu.call("display_8")
  426.  
  427.     elseif page.getName() == "Page 10" then
  428.       contents_menu.call("display_9")
  429.     elseif page.getName() == "Page 11" then
  430.       contents_menu.call("display_10")
  431.     elseif page.getName() == "Page 12" then
  432.       contents_menu.call("display_11")
  433.     elseif page.getName() == "Page 13" then
  434.       contents_menu.call("display_12")
  435.     elseif page.getName() == "Page 14" then
  436.       contents_menu.call("display_13")
  437.     elseif page.getName() == "Page 15" then
  438.       contents_menu.call("display_14")
  439.     elseif page.getName() == "Page 16" then
  440.       contents_menu.call("display_15")
  441.     elseif page.getName() == "Page 17" then
  442.       contents_menu.call("display_16")
  443.     elseif page.getName() == "Page 18" then
  444.       contents_menu.call("display_17")
  445.     elseif page.getName() == "Page 19" then
  446.       contents_menu.call("display_18")
  447.     elseif page.getName() == "Page 20" then
  448.       contents_menu.call("display_19")
  449.     elseif page.getName() == "Page 21" then
  450.       contents_menu.call("display_20")
  451.     elseif page.getName() == "Page 22" then
  452.       contents_menu.call("display_21")
  453.     elseif page.getName() == "Page 23" then
  454.       contents_menu.call("display_22")
  455.     elseif page.getName() == "Page 24" then
  456.       contents_menu.call("display_23")
  457.  
  458.     end
  459.   end
  460. end
  461.  
  462. function remove_current_page()
  463.   for _, object in ipairs(zone.getObjects()) do
  464.     if object.tag == "Card" or object.tag == "Deck" then
  465.       object.destroy()
  466.     end
  467.   end
  468. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top