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