Advertisement
ModerkaScripts

Orion Library API

May 15th, 2024
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.94 KB | None | 0 0
  1. -- Orion Library
  2.  
  3. -- This documentation is for the stable release of Orion Library (ttwizz edition).
  4.  
  5.  
  6. -- Booting the Library
  7.  
  8. local OrionLib = loadstring(game:HttpGet("https://raw.githubusercontent.com/ttwizz/Roblox/master/Orion.lua", true))()
  9.  
  10.  
  11. -- Creating a Window
  12.  
  13. local Window = OrionLib:MakeWindow({Name = "Title of the library", TestMode = true, SaveConfig = true, ConfigFolder = "OrionTest"})
  14.  
  15. --[[
  16. Name = <string> - The name of the UI.
  17. TestMode = <bool> - Whether or not to show the Tester label under the player's display name.
  18. SaveConfig = <bool> - Toggles the config saving in the UI.
  19. ConfigFolder = <string> - The name of the folder where the configs are saved.
  20. IntroEnabled = <bool> - Whether or not to show the intro animation.
  21. IntroText = <string> - Text to show in the intro animation.
  22. IntroIcon = <string> - URL to the image you want to use in the intro animation.
  23. Icon = <string> - URL to the image you want displayed on the window.
  24. CloseCallback = <function> - Function to execute when the window is closed.
  25. ]]
  26.  
  27.  
  28. -- Creating a Tab
  29.  
  30. local Tab = Window:MakeTab({
  31.     Name = "Tab 1",
  32.     Icon = "rbxassetid://4483345998",
  33.     TestersOnly = false
  34. })
  35.  
  36. --[[
  37. Name = <string> - The name of the tab.
  38. Icon = <string> - The icon of the tab.
  39. TestersOnly = <bool> - Makes the tab not accessible to players.
  40. ]]
  41.  
  42.  
  43. -- Creating a Section
  44.  
  45. local Section = Tab:AddSection({
  46.     Name = "Section"
  47. })
  48.  
  49. --[[
  50. Name = <string> - The name of the section.
  51. ]]
  52.  
  53. -- You can add elements to sections the same way you would add them to a tab normally.
  54.  
  55.  
  56. -- Notifying the User
  57.  
  58. OrionLib:MakeNotification({
  59.     Name = "Title!",
  60.     Content = "Notification content... what will it say?",
  61.     Image = "rbxassetid://4483345998",
  62.     Time = 5
  63. })
  64.  
  65. --[[
  66. Title = <string> - The title of the notification.
  67. Content = <string> - The content of the notification.
  68. Image = <string> - The icon of the notification.
  69. Time = <number> - The duration of the notfication.
  70. ]]
  71.  
  72.  
  73. -- Creating a Button
  74.  
  75. Tab:AddButton({
  76.     Name = "Button!",
  77.     Callback = function()
  78.             print("button pressed")
  79.     end    
  80. })
  81.  
  82. --[[
  83. Name = <string> - The name of the button.
  84. Callback = <function> - The function of the button.
  85. ]]
  86.  
  87.  
  88. -- Creating a Checkbox toggle
  89.  
  90. Tab:AddToggle({
  91.     Name = "This is a toggle!",
  92.     Default = false,
  93.     Callback = function(Value)
  94.         print(Value)
  95.     end    
  96. })
  97.  
  98. --[[
  99. Name = <string> - The name of the toggle.
  100. Default = <bool> - The default value of the toggle.
  101. Callback = <function> - The function of the toggle.
  102. ]]
  103.  
  104.  
  105. -- Changing the value of an existing Toggle
  106.  
  107. CoolToggle:Set(true)
  108.  
  109.  
  110. -- Creating a Color Picker
  111.  
  112. Tab:AddColorpicker({
  113.     Name = "Colorpicker",
  114.     Default = Color3.fromRGB(255, 0, 0),
  115.     Callback = function(Value)
  116.         print(Value)
  117.     end  
  118. })
  119.  
  120. --[[
  121. Name = <string> - The name of the colorpicker.
  122. Default = <color3> - The default value of the colorpicker.
  123. Callback = <function> - The function of the colorpicker.
  124. ]]
  125.  
  126.  
  127. -- Setting the Color Picker's value
  128.  
  129. ColorPicker:Set(Color3.fromRGB(255,255,255))
  130.  
  131.  
  132. -- Creating a Slider
  133.  
  134. Tab:AddSlider({
  135.     Name = "Slider",
  136.     Min = 0,
  137.     Max = 20,
  138.     Default = 5,
  139.     Color = Color3.fromRGB(255,255,255),
  140.     Increment = 1,
  141.     ValueName = "bananas",
  142.     Callback = function(Value)
  143.         print(Value)
  144.     end    
  145. })
  146.  
  147. --[[
  148. Name = <string> - The name of the slider.
  149. Min = <number> - The minimal value of the slider.
  150. Max = <number> - The maxium value of the slider.
  151. Increment = <number> - How much the slider will change value when dragging.
  152. Default = <number> - The default value of the slider.
  153. ValueName = <string> - The text after the value number.
  154. Callback = <function> - The function of the slider.
  155. ]]
  156.  
  157.  
  158. -- Change Slider value
  159.  
  160. Slider:Set(2)
  161.  
  162. -- Make sure you make your slider a variable (local CoolSlider = Tab:AddSlider...) for this to work.
  163.  
  164.  
  165. -- Creating a Label
  166.  
  167. Tab:AddLabel("Label")
  168.  
  169.  
  170. -- Changing the value of an existing Label
  171.  
  172. CoolLabel:Set("Label New!")
  173.  
  174.  
  175. -- Creating a Paragraph
  176.  
  177. Tab:AddParagraph("Paragraph", "Paragraph Content")
  178.  
  179.  
  180. -- Changing an existing Paragraph
  181.  
  182. CoolParagraph:Set("Paragraph New!", "New Paragraph Content!")
  183.  
  184.  
  185. -- Creating an Adaptive Input
  186.  
  187. Tab:AddTextbox({
  188.     Name = "Textbox",
  189.     Default = "default box input",
  190.     TextDisappear = true,
  191.     Callback = function(Value)
  192.         print(Value)
  193.     end  
  194. })
  195.  
  196. --[[
  197. Name = <string> - The name of the textbox.
  198. Default = <string> - The default value of the textbox.
  199. TextDisappear = <bool> - Makes the text disappear in the textbox after losing focus.
  200. Callback = <function> - The function of the textbox.
  201. ]]
  202.  
  203.  
  204. -- Creating a Keybind
  205.  
  206. Tab:AddBind({
  207.     Name = "Bind",
  208.     Default = Enum.KeyCode.E,
  209.     Hold = false,
  210.     Callback = function()
  211.         print("press")
  212.     end    
  213. })
  214.  
  215. --[[
  216. Name = <string> - The name of the bind.
  217. Default = <keycode> - The default value of the bind.
  218. Hold = <bool> - Makes the bind work like: holding the key > the bind returns true, not holding the key > bind returns false.
  219. Callback = <function> - The function of the bind.
  220. ]]
  221.  
  222.  
  223. -- Chaning the value of a Keybind
  224.  
  225. Bind:Set(Enum.KeyCode.E)
  226.  
  227.  
  228. -- Creating a Dropdown menu
  229.  
  230. Tab:AddDropdown({
  231.     Name = "Dropdown",
  232.     Default = "1",
  233.     Options = {"1", "2"},
  234.     Callback = function(Value)
  235.         print(Value)
  236.     end    
  237. })
  238.  
  239. --[[
  240. Name = <string> - The name of the dropdown.
  241. Default = <string> - The default value of the dropdown.
  242. Options = <table> - The options in the dropdown.
  243. Callback = <function> - The function of the dropdown.
  244. ]]
  245.  
  246.  
  247. -- Adding a set of new Dropdown buttons to an existing menu
  248.  
  249. Dropdown:Refresh(List<table>, true)
  250.  
  251. -- The above boolean value "true" is whether or not the current buttons will be deleted.
  252.  
  253.  
  254. -- Selecting a Dropdown option
  255.  
  256. Dropdown:Set("dropdown option")
  257.  
  258.  
  259. -- Finishing your script (REQUIRED)
  260.  
  261. -- The below function needs to be added at the end of your code.
  262.  
  263. OrionLib:Init()
  264.  
  265.  
  266. -- How Flags work
  267.  
  268. -- The flags feature in the UI may be confusing for some people. It serves the purpose of being the Id of an element in the config file, and makes accessing the value of an element anywhere in the code possible. Below in an example of using flags.
  269.  
  270. Tab1:AddToggle({
  271.     Name = "Toggle",
  272.     Default = true,
  273.     Save = true,
  274.     Flag = "toggle"
  275. })
  276.  
  277. print(OrionLib.Flags["toggle"].Value) -- prints the value of the toggle.
  278.  
  279. -- Flags only work with the toggle, slider, dropdown, bind, and colorpicker.
  280.  
  281.  
  282. -- Making your Interface work with configs
  283.  
  284. -- In order to make your interface use the configs function you first need to add the SaveConfig and ConfigFolder arguments to your window function. The explanation of these arguments in above. Then you need to add the Flag and Save values to every toggle, slider, dropdown, bind, and colorpicker you want to include in the config file. The Flag = <string> argument is the Id of an element in the config file. The Save = <bool> argument includes the element in the config file. Config files are made for every game the library is launched in.
  285.  
  286.  
  287. -- Destroying the Interface
  288.  
  289. OrionLib:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement