918 lines
24 KiB
Plaintext
918 lines
24 KiB
Plaintext
import "macros" as { $ }
|
|
$load $FILE
|
|
|
|
--Include
|
|
Create = assert(LoadLibrary "RbxUtility").Create
|
|
|
|
-- A Few Script Globals
|
|
gui = script.Parent\FindFirstChild"ControlFrame" or script.Parent
|
|
|
|
-- Dev-Console Root
|
|
|
|
Dev_Container = Create"Frame"
|
|
Name: "DevConsoleContainer"
|
|
Parent: gui
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.9
|
|
Position: UDim2.new 0, 100, 0, 10
|
|
Size: UDim2.new 0.5, 20, 0.5, 20
|
|
Visible: false
|
|
|
|
ToggleConsole = Create"BindableFunction"
|
|
Name: "ToggleDevConsole"
|
|
Parent: gui
|
|
|
|
devConsoleInitialized = false
|
|
initializeDeveloperConsole = ->
|
|
return if devConsoleInitialized
|
|
devConsoleInitialized = true
|
|
|
|
---Dev-Console Variables
|
|
LOCAL_CONSOLE = 1
|
|
SERVER_CONSOLE = 2
|
|
|
|
MAX_LIST_SIZE = 1000
|
|
|
|
minimumSize = Vector2.new 245, 180
|
|
currentConsole = LOCAL_CONSOLE
|
|
|
|
localMessageList = {}
|
|
serverMessageList = {}
|
|
|
|
localOffset = 0
|
|
serverOffset = 0
|
|
|
|
errorToggleOn = true
|
|
warningToggleOn = true
|
|
infoToggleOn = true
|
|
outputToggleOn = true
|
|
wordWrapToggleOn = false
|
|
|
|
textHolderSize = 0
|
|
|
|
frameNumber = 0
|
|
|
|
--Create Dev-Console
|
|
|
|
Dev_Body = Create"Frame"
|
|
Name: "Body"
|
|
Parent: Dev_Container
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.5
|
|
Position: UDim2.new 0, 0, 0, 21
|
|
Size: UDim2.new 1, 0, 1, -25
|
|
|
|
Dev_OptionsHolder = Create"Frame"
|
|
Name: "OptionsHolder"
|
|
Parent: Dev_Body
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 220, 0, 0
|
|
Size: UDim2.new 1, -255, 0, 24
|
|
ClipsDescendants: true
|
|
|
|
Dev_OptionsBar = Create"Frame"
|
|
Name: "OptionsBar"
|
|
Parent: Dev_OptionsHolder
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, -250, 0, 4
|
|
Size: UDim2.new 0, 234, 0, 18
|
|
|
|
Dev_ErrorToggleFilter = Create"TextButton"
|
|
Name: "ErrorToggleButton"
|
|
Parent: Dev_OptionsBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BorderColor3: Color3.new 1, 0, 0
|
|
Position: UDim2.new 0, 115, 0, 0
|
|
Size: UDim2.new 0, 18, 0, 18
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: ""
|
|
TextColor3: Color3.new 1, 0, 0
|
|
|
|
Create"Frame"
|
|
Name: "CheckFrame"
|
|
Parent: Dev_ErrorToggleFilter
|
|
BackgroundColor3: Color3.new 1, 0, 0
|
|
BorderColor3: Color3.new 1, 0, 0
|
|
Position: UDim2.new 0, 4, 0, 4
|
|
Size: UDim2.new 0, 10, 0, 10
|
|
|
|
Dev_InfoToggleFilter = Create"TextButton"
|
|
Name: "InfoToggleButton"
|
|
Parent: Dev_OptionsBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BorderColor3: Color3.new 0.4, 0.5, 1.0
|
|
Position: UDim2.new 0, 65, 0, 0
|
|
Size: UDim2.new 0, 18, 0, 18
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: ""
|
|
TextColor3: Color3.new 0.4, 0.5, 1.0
|
|
|
|
Create"Frame"
|
|
Name: "CheckFrame"
|
|
Parent: Dev_InfoToggleFilter
|
|
BackgroundColor3: Color3.new 0.4, 0.5, 1.0
|
|
BorderColor3: Color3.new 0.4, 0.5, 1.0
|
|
Position: UDim2.new 0, 4, 0, 4
|
|
Size: UDim2.new 0, 10, 0, 10
|
|
|
|
Dev_OutputToggleFilter = Create"TextButton"
|
|
Name: "OutputToggleButton"
|
|
Parent: Dev_OptionsBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BorderColor3: Color3.new 1, 1, 1.0
|
|
Position: UDim2.new 0, 40, 0, 0
|
|
Size: UDim2.new 0, 18, 0, 18
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: ""
|
|
TextColor3: Color3.new 1, 1, 1.0
|
|
|
|
Create"Frame"
|
|
Name: "CheckFrame"
|
|
Parent: Dev_OutputToggleFilter
|
|
BackgroundColor3: Color3.new 1, 1, 1.0
|
|
BorderColor3: Color3.new 1, 1, 1.0
|
|
Position: UDim2.new 0, 4, 0, 4
|
|
Size: UDim2.new 0, 10, 0, 10
|
|
|
|
Dev_WarningToggleFilter = Create"TextButton"
|
|
Name: "WarningToggleButton"
|
|
Parent: Dev_OptionsBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BorderColor3: Color3.new 1, 0.6, 0.4
|
|
Position: UDim2.new 0, 90, 0, 0
|
|
Size: UDim2.new 0, 18, 0, 18
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: ""
|
|
TextColor3: Color3.new 1, 0.6, 0.4
|
|
|
|
Create"Frame"
|
|
Name: "CheckFrame"
|
|
Parent: Dev_WarningToggleFilter
|
|
BackgroundColor3: Color3.new 1, 0.6, 0.4
|
|
BorderColor3: Color3.new 1, 0.6, 0.4
|
|
Position: UDim2.new 0, 4, 0, 4
|
|
Size: UDim2.new 0, 10, 0, 10
|
|
|
|
Dev_WordWrapToggle = Create"TextButton"
|
|
Name: "WordWrapToggleButton"
|
|
Parent: Dev_OptionsBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BorderColor3: Color3.new 0.8, 0.8, 0.8
|
|
Position: UDim2.new 0, 215, 0, 0
|
|
Size: UDim2.new 0, 18, 0, 18
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: ""
|
|
TextColor3: Color3.new 0.8, 0.8, 0.8
|
|
|
|
Create"Frame"
|
|
Name: "CheckFrame"
|
|
Parent: Dev_WordWrapToggle
|
|
BackgroundColor3: Color3.new 0.8, 0.8, 0.8
|
|
BorderColor3: Color3.new 0.8, 0.8, 0.8
|
|
Position: UDim2.new 0, 4, 0, 4
|
|
Size: UDim2.new 0, 10, 0, 10
|
|
Visible: false
|
|
|
|
Create"TextLabel"
|
|
Name: "Filter"
|
|
Parent: Dev_OptionsBar
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 0, 0, 0
|
|
Size: UDim2.new 0, 40, 0, 18
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: "Filter"
|
|
TextColor3: Color3.new 1, 1, 1
|
|
|
|
Create"TextLabel"
|
|
Name: "WordWrap"
|
|
Parent: Dev_OptionsBar
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 150, 0, 0
|
|
Size: UDim2.new 0, 50, 0, 18
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: "Word Wrap"
|
|
TextColor3: Color3.new 1, 1, 1,
|
|
|
|
Dev_ScrollBar = Create"Frame"
|
|
Name: "ScrollBar"
|
|
Parent: Dev_Body
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.9
|
|
Position: UDim2.new 1, -20, 0, 26
|
|
Size: UDim2.new 0, 20, 1, -50
|
|
Visible: false
|
|
|
|
Dev_ScrollArea = Create"Frame"
|
|
Name: "ScrollArea"
|
|
Parent: Dev_ScrollBar
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 0, 0, 23
|
|
Size: UDim2.new 1, 0, 1, -46
|
|
|
|
Dev_Handle = Create"ImageButton"
|
|
Name: "Handle"
|
|
Parent: Dev_ScrollArea
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.5
|
|
Position: UDim2.new 0, 0, 0.2, 0
|
|
Size: UDim2.new 0, 20, 0, 40
|
|
|
|
Create"ImageLabel"
|
|
Name: "ImageLabel"
|
|
Parent: Dev_Handle
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 0, 0.5, -8
|
|
Rotation: 180
|
|
Size: UDim2.new 1, 0, 0, 16
|
|
Image: "http://www.roblox.com/Asset?id=151205881"
|
|
|
|
Dev_DownButton = Create"ImageButton"
|
|
Name: "Down"
|
|
Parent: Dev_ScrollBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.5
|
|
Position: UDim2.new 0, 0, 1, -20
|
|
Size: UDim2.new 0, 20, 0, 20
|
|
|
|
Create"ImageLabel"
|
|
Name: "ImageLabel"
|
|
Parent: Dev_DownButton
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 3, 0, 3
|
|
Size: UDim2.new 0, 14, 0, 14
|
|
Rotation: 180
|
|
Image: "http://www.roblox.com/Asset?id=151205813"
|
|
|
|
Dev_UpButton = Create"ImageButton"
|
|
Name: "Up"
|
|
Parent: Dev_ScrollBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.5
|
|
Position: UDim2.new 0, 0, 0, 0
|
|
Size: UDim2.new 0, 20, 0, 20
|
|
|
|
Create"ImageLabel"
|
|
Name: "ImageLabel"
|
|
Parent: Dev_UpButton
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 3, 0, 3
|
|
Size: UDim2.new 0, 14, 0, 14
|
|
Image: "http://www.roblox.com/Asset?id=151205813"
|
|
|
|
Dev_TextBox = Create"Frame"
|
|
Name: "TextBox"
|
|
Parent: Dev_Body
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.6
|
|
Position: UDim2.new 0, 2, 0, 26
|
|
Size: UDim2.new 1, -4, 1, -28
|
|
ClipsDescendants: true
|
|
|
|
Dev_TextHolder = Create"Frame"
|
|
Name: "TextHolder"
|
|
Parent: Dev_TextBox
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 0, 0, 0
|
|
Size: UDim2.new 1, 0, 1, 0
|
|
|
|
Dev_OptionsButton = Create"ImageButton"
|
|
Name: "OptionsButton"
|
|
Parent: Dev_Body
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 200, 0, 2
|
|
Size: UDim2.new 0, 20, 0, 20
|
|
|
|
Create"ImageLabel"
|
|
Name: "ImageLabel"
|
|
Parent: Dev_OptionsButton
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 0, 0, 0
|
|
Size: UDim2.new 1, 0, 1, 0
|
|
Rotation: 0
|
|
Image: "http://www.roblox.com/Asset?id=152093917"
|
|
|
|
Dev_ResizeButton = Create"ImageButton"
|
|
Name: "ResizeButton"
|
|
Parent: Dev_Body
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.5
|
|
Position: UDim2.new 1, -20, 1, -20
|
|
Size: UDim2.new 0, 20, 0, 20
|
|
|
|
Create"ImageLabel"
|
|
Name: "ImageLabel"
|
|
Parent: Dev_ResizeButton
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 6, 0, 6
|
|
Size: UDim2.new 0.8, 0, 0.8, 0
|
|
Rotation: 135
|
|
Image: "http://www.roblox.com/Asset?id=151205813"
|
|
|
|
Create"TextButton"
|
|
Name: "LocalConsole"
|
|
Parent: Dev_Body
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.6
|
|
Position: UDim2.new 0, 7, 0, 5
|
|
Size: UDim2.new 0, 90, 0, 20
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: "Local Console"
|
|
TextColor3: Color3.new 1, 1, 1
|
|
TextYAlignment: Enum.TextYAlignment.Center
|
|
|
|
Create"TextButton"
|
|
Name: "ServerConsole"
|
|
Parent: Dev_Body
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.8
|
|
Position: UDim2.new 0, 102, 0, 5
|
|
Size: UDim2.new 0, 90, 0, 17
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size14
|
|
Text: "Server Console"
|
|
TextColor3: Color3.new 1, 1, 1
|
|
TextYAlignment: Enum.TextYAlignment.Center
|
|
|
|
Dev_TitleBar = Create"Frame"
|
|
Name: "TitleBar"
|
|
Parent: Dev_Container
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.5
|
|
Position: UDim2.new 0, 0, 0, 0
|
|
Size: UDim2.new 1, 0, 0, 20
|
|
|
|
Dev_CloseButton = Create"ImageButton"
|
|
Name: "CloseButton"
|
|
Parent: Dev_TitleBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.5
|
|
Position: UDim2.new 1, -20, 0, 0
|
|
Size: UDim2.new 0, 20, 0, 20
|
|
|
|
Create"ImageLabel"
|
|
Parent: Dev_CloseButton
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 3, 0, 3
|
|
Size: UDim2.new 0, 14, 0, 14
|
|
Image: "http://www.roblox.com/Asset?id=151205852"
|
|
|
|
Create"TextButton"
|
|
Name: "TextButton"
|
|
Parent: Dev_TitleBar
|
|
BackgroundColor3: Color3.new 0, 0, 0
|
|
BackgroundTransparency: 0.5
|
|
Position: UDim2.new 0, 0, 0, 0
|
|
Size: UDim2.new 1, -23, 1, 0
|
|
Text: ""
|
|
|
|
Create"TextLabel"
|
|
Name: "TitleText"
|
|
Parent: Dev_TitleBar
|
|
BackgroundTransparency: 1
|
|
Position: UDim2.new 0, 0, 0, 0
|
|
Size: UDim2.new 0, 185, 0, 20
|
|
Font: "SourceSansBold"
|
|
FontSize: Enum.FontSize.Size18
|
|
-- Text: "Server Console"
|
|
TextColor3: Color3.new 1, 1, 1
|
|
Text: "Roblox Developer Console"
|
|
TextYAlignment: Enum.TextYAlignment.Top
|
|
|
|
---Saved Mouse Information
|
|
local previousMousePos
|
|
local pPos
|
|
|
|
local previousMousePosResize
|
|
local pSize
|
|
|
|
local previousMousePosScroll
|
|
|
|
-- local pScrollHandle
|
|
|
|
local pOffset
|
|
|
|
scrollUpIsDown = false
|
|
scrollDownIsDown = false
|
|
|
|
clean = ->
|
|
previousMousePos = pPos = previousMousePosResize = nil
|
|
pSize = previousMousePosScroll = pOffset = nil
|
|
-- pScrollHandle = nil
|
|
scrollUpIsDown = scrollDownIsDown = false
|
|
|
|
|
|
---Handle Dev-Console Position
|
|
refreshConsolePosition = (x, y) ->
|
|
return if not previousMousePos
|
|
|
|
delta = Vector2.new x, y - previousMousePos
|
|
Dev_Container.Position = UDim2.new 0, pPos.X + delta.X, 0, pPos.Y + delta.Y
|
|
|
|
|
|
Dev_TitleBar.TextButton.MouseButton1Down\connect (x, y) ->
|
|
previousMousePos = Vector2.new x, y
|
|
pPos = Dev_Container.AbsolutePosition
|
|
|
|
|
|
Dev_TitleBar.TextButton.MouseButton1Up\connect clean
|
|
|
|
|
|
---Handle Dev-Console Size
|
|
refreshConsoleSize = (x, y) ->
|
|
return if not previousMousePosResize
|
|
|
|
delta = Vector2.new x, y - previousMousePosResize
|
|
Dev_Container.Size = UDim2.new 0, math.max(pSize.X + delta.X, minimumSize.X), 0, math.max pSize.Y + delta.Y, minimumSize.Y
|
|
|
|
Dev_Container.Body.ResizeButton.MouseButton1Down\connect (x, y) ->
|
|
previousMousePosResize = Vector2.new x, y
|
|
pSize = Dev_Container.AbsoluteSize
|
|
|
|
|
|
Dev_Container.Body.ResizeButton.MouseButton1Up\connect clean
|
|
|
|
|
|
---Handle Dev-Console Close Button
|
|
Dev_TitleBar.CloseButton.MouseButton1Down\connect ->
|
|
Dev_Container.Visible = false
|
|
|
|
|
|
Dev_Container.TitleBar.CloseButton.MouseButton1Up\connect clean
|
|
|
|
|
|
optionsHidden = true
|
|
animating = false
|
|
--Options
|
|
startAnimation = ->
|
|
return if animating
|
|
animating = true
|
|
|
|
repeat
|
|
frameNumber += if optionsHidden
|
|
-1
|
|
else
|
|
1
|
|
|
|
|
|
x = frameNumber / 5
|
|
smoothStep = x * x * (3 - (2 * x))
|
|
Dev_OptionsButton.ImageLabel.Rotation = smoothStep * 5 * 9
|
|
Dev_OptionsBar.Position = UDim2.new(0, (smoothStep * 5 * 50) - 250, 0, 4)
|
|
|
|
wait!
|
|
if (frameNumber <= 0 and optionsHidden) or (frameNumber >= 5 and not optionsHidden)
|
|
animating = false
|
|
|
|
until not animating
|
|
|
|
|
|
Dev_OptionsButton.MouseButton1Down\connect ->
|
|
optionsHidden = not optionsHidden
|
|
startAnimation!
|
|
|
|
--Refresh Dev-Console Message Positions
|
|
repositionList = ->
|
|
if currentConsole == LOCAL_CONSOLE
|
|
localOffset = math.min math.max(localOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y
|
|
Dev_TextHolder.Size = UDim2.new 1, 0, 0, textHolderSize
|
|
elseif currentConsole == SERVER_CONSOLE
|
|
serverOffset = math.min math.max(serverOffset, 0), textHolderSize - Dev_Container.Body.TextBox.AbsoluteSize.Y
|
|
Dev_TextHolder.Size = UDim2.new 1, 0, 0, textHolderSize
|
|
|
|
|
|
ratio = Dev_Container.Body.TextBox.AbsoluteSize.Y / Dev_TextHolder.AbsoluteSize.Y
|
|
|
|
if ratio >= 1
|
|
Dev_Container.Body.ScrollBar.Visible = false
|
|
Dev_Container.Body.TextBox.Size = UDim2.new 1, -4, 1, -28
|
|
|
|
if currentConsole == LOCAL_CONSOLE or currentConsole == SERVER_CONSOLE
|
|
Dev_TextHolder.Position = UDim2.new 0, 0, 1, 0 - textHolderSize
|
|
|
|
else
|
|
Dev_Container.Body.ScrollBar.Visible = true
|
|
Dev_Container.Body.TextBox.Size = UDim2.new 1, -25, 1, -28
|
|
|
|
backRatio = 1 - ratio
|
|
local offsetRatio
|
|
|
|
if currentConsole == LOCAL_CONSOLE
|
|
offsetRatio = localOffset / Dev_TextHolder.AbsoluteSize.Y
|
|
elseif currentConsole == SERVER_CONSOLE
|
|
offsetRatio = serverOffset / Dev_TextHolder.AbsoluteSize.Y
|
|
|
|
|
|
topRatio = math.max 0, backRatio - offsetRatio
|
|
|
|
scrollHandleSize = math.max Dev_ScrollArea.AbsoluteSize.Y * ratio, 21
|
|
|
|
scrollRatio = scrollHandleSize / Dev_ScrollArea.AbsoluteSize.Y
|
|
ratioConversion = (1 - scrollRatio) / (1 - ratio)
|
|
|
|
topScrollRatio = topRatio * ratioConversion
|
|
|
|
sPos = math.min(
|
|
Dev_ScrollArea.AbsoluteSize.Y * topScrollRatio,
|
|
Dev_ScrollArea.AbsoluteSize.Y - scrollHandleSize
|
|
)
|
|
|
|
Dev_ScrollArea.Handle.Size = UDim2.new 1, 0, 0, scrollHandleSize
|
|
Dev_ScrollArea.Handle.Position = UDim2.new 0, 0, 0, sPos
|
|
|
|
Dev_TextHolder.Position = UDim2.new 0, 0, 1, 0 - textHolderSize + if currentConsole == LOCAL_CONSOLE
|
|
localOffset
|
|
elseif currentConsole == SERVER_CONSOLE
|
|
serverOffset
|
|
|
|
|
|
--Scroll Position
|
|
|
|
changeOffset = (value) ->
|
|
if currentConsole == LOCAL_CONSOLE
|
|
localOffset += value
|
|
elseif currentConsole == SERVER_CONSOLE
|
|
serverOffset += value
|
|
|
|
repositionList!
|
|
|
|
|
|
--Refresh Dev-Console Text
|
|
refreshTextHolderForReal = ->
|
|
childMessages = Dev_TextHolder\GetChildren!
|
|
|
|
local messageList
|
|
|
|
messageList = if currentConsole == LOCAL_CONSOLE
|
|
localMessageList
|
|
elseif currentConsole == SERVER_CONSOLE
|
|
serverMessageList
|
|
|
|
posOffset = 0
|
|
|
|
for i = 1, #childMessages
|
|
childMessages[i].Visible = false
|
|
|
|
for i = 1, #messageList
|
|
local message
|
|
|
|
movePosition = false
|
|
|
|
if i > #childMessages
|
|
message = Create"TextLabel"
|
|
Name: "Message"
|
|
Parent: Dev_TextHolder
|
|
BackgroundTransparency: 1
|
|
TextXAlignment: "Left"
|
|
Size: UDim2.new 1, 0, 0, 14
|
|
FontSize: "Size10"
|
|
ZIndex: 1
|
|
movePosition = true
|
|
else
|
|
message = childMessages[i]
|
|
|
|
|
|
if (outputToggleOn or messageList[i].Type ~= Enum.MessageType.MessageOutput) and
|
|
(infoToggleOn or messageList[i].Type ~= Enum.MessageType.MessageInfo) and
|
|
(warningToggleOn or messageList[i].Type ~= Enum.MessageType.MessageWarning) and
|
|
(errorToggleOn or messageList[i].Type ~= Enum.MessageType.MessageError)
|
|
|
|
with message
|
|
.TextWrapped = wordWrapToggleOn
|
|
.Size = UDim2.new 0.98, 0, 0, 2000
|
|
.Parent = Dev_Container
|
|
.Text = "#{messageList[i].Time} -- #{messageList[i].Message}"
|
|
.Size = UDim2.new 0.98, 0, 0, .TextBounds.Y
|
|
.Position = UDim2.new 0, 5, 0, posOffset
|
|
.Parent = Dev_TextHolder
|
|
posOffset += .TextBounds.Y
|
|
|
|
if movePosition
|
|
if (currentConsole == LOCAL_CONSOLE and localOffset > 0) or
|
|
(currentConsole == SERVER_CONSOLE and serverOffset > 0)
|
|
|
|
changeOffset message.TextBounds.Y
|
|
|
|
message.Visible = true
|
|
|
|
message.TextColor3 = Color3.new if messageList[i].Type == Enum.MessageType.MessageError
|
|
1, 0, 0
|
|
elseif messageList[i].Type == Enum.MessageType.MessageInfo
|
|
0.4, 0.5, 1
|
|
elseif messageList[i].Type == Enum.MessageType.MessageWarning
|
|
1, 0.6, 0.4
|
|
else
|
|
1, 1, 1
|
|
|
|
textHolderSize = posOffset
|
|
|
|
|
|
-- Refreshing the textholder every 0.1 (if needed) is good enough, surely fast enough
|
|
-- We don't want it to update 50x in a tick because there are 50 messages in that tick
|
|
-- (Whenever for one reason or another a lot of output comes in, it can lag
|
|
-- This will make it behave better in a situation of a lot of output comming in)
|
|
refreshQueued = false
|
|
refreshTextHolder = ->
|
|
return if refreshQueued
|
|
|
|
Delay 0.1, ->
|
|
refreshQueued = false
|
|
refreshTextHolderForReal!
|
|
|
|
refreshQueued = true
|
|
|
|
|
|
--Handle Dev-Console Scrollbar
|
|
|
|
inside = 0
|
|
holdingUpButton = ->
|
|
return if scrollUpIsDown
|
|
|
|
scrollUpIsDown = true
|
|
wait 0.6
|
|
inside += 1
|
|
while scrollUpIsDown and inside < 2
|
|
wait!
|
|
changeOffset 12
|
|
|
|
inside -= 1
|
|
|
|
|
|
holdingDownButton = ->
|
|
return if scrollDownIsDown
|
|
|
|
scrollDownIsDown = true
|
|
wait 0.6
|
|
inside += 1
|
|
while scrollDownIsDown and inside < 2
|
|
wait!
|
|
changeOffset -12
|
|
|
|
inside -= 1
|
|
|
|
|
|
Dev_Container.Body.ScrollBar.Up.MouseButton1Click\connect ->
|
|
changeOffset 10
|
|
|
|
Dev_Container.Body.ScrollBar.Up.MouseButton1Down\connect ->
|
|
changeOffset 10
|
|
holdingUpButton!
|
|
|
|
Dev_Container.Body.ScrollBar.Up.MouseButton1Up\connect clean
|
|
|
|
Dev_Container.Body.ScrollBar.Down.MouseButton1Down\connect ->
|
|
changeOffset -10
|
|
holdingDownButton!
|
|
|
|
Dev_Container.Body.ScrollBar.Down.MouseButton1Up\connect clean
|
|
|
|
handleScroll = (x, y) ->
|
|
return if not previousMousePosScroll
|
|
|
|
delta = (Vector2.new x, y - previousMousePosScroll).Y
|
|
|
|
backRatio = 1 - (Dev_Container.Body.TextBox.AbsoluteSize.Y / Dev_TextHolder.AbsoluteSize.Y)
|
|
|
|
movementSize = Dev_ScrollArea.AbsoluteSize.Y - Dev_ScrollArea.Handle.AbsoluteSize.Y
|
|
normalDelta = math.max(math.min(delta, movementSize), 0 - movementSize)
|
|
normalRatio = normalDelta / movementSize
|
|
|
|
textMovementSize = (backRatio * Dev_TextHolder.AbsoluteSize.Y)
|
|
offsetChange = textMovementSize * normalRatio
|
|
|
|
if currentConsole == LOCAL_CONSOLE
|
|
localOffset = pOffset - offsetChange
|
|
elseif currentConsole == SERVER_CONSOLE
|
|
serverOffset = pOffset - offsetChange
|
|
|
|
|
|
Dev_ScrollArea.Handle.MouseButton1Down\connect (x, y) ->
|
|
previousMousePosScroll = Vector2.new x, y
|
|
-- pScrollHandle = Dev_ScrollArea.Handle.AbsolutePosition
|
|
pOffset = if currentConsole == LOCAL_CONSOLE
|
|
localOffset
|
|
elseif currentConsole == SERVER_CONSOLE
|
|
serverOffset
|
|
|
|
|
|
Dev_ScrollArea.Handle.MouseButton1Up\connect clean
|
|
|
|
existsInsideContainer = (container, x, y) ->
|
|
pos = container.AbsolutePosition
|
|
size = container.AbsoluteSize
|
|
if x < pos.X or x > pos.X + size.X or y < pos.y or y > pos.y + size.y
|
|
return false
|
|
true
|
|
|
|
|
|
-- Easy, fast, and working nicely
|
|
numberWithZero = (num) ->
|
|
if num < 10
|
|
"0#{num}"
|
|
else
|
|
num
|
|
|
|
|
|
str = "%s:%s:%s"
|
|
|
|
ConvertTimeStamp = (timeStamp) ->
|
|
localTime = timeStamp - os.time! + math.floor tick!
|
|
dayTime = localTime % 86400
|
|
|
|
hour = math.floor dayTime / 3600
|
|
|
|
dayTime -= hour * 3600
|
|
minute = math.floor dayTime / 60
|
|
|
|
dayTime -= minute * 60
|
|
|
|
h = numberWithZero hour
|
|
m = numberWithZero minute
|
|
s = numberWithZero dayTime
|
|
|
|
str\format h, m, s
|
|
|
|
|
|
--Filter
|
|
|
|
Dev_OptionsBar.ErrorToggleButton.MouseButton1Down\connect ->
|
|
errorToggleOn = not errorToggleOn
|
|
Dev_OptionsBar.ErrorToggleButton.CheckFrame.Visible = errorToggleOn
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
|
|
Dev_OptionsBar.WarningToggleButton.MouseButton1Down\connect ->
|
|
warningToggleOn = not warningToggleOn
|
|
Dev_OptionsBar.WarningToggleButton.CheckFrame.Visible = warningToggleOn
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
|
|
Dev_OptionsBar.InfoToggleButton.MouseButton1Down\connect ->
|
|
infoToggleOn = not infoToggleOn
|
|
Dev_OptionsBar.InfoToggleButton.CheckFrame.Visible = infoToggleOn
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
|
|
Dev_OptionsBar.OutputToggleButton.MouseButton1Down\connect ->
|
|
outputToggleOn = not outputToggleOn
|
|
Dev_OptionsBar.OutputToggleButton.CheckFrame.Visible = outputToggleOn
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
|
|
Dev_OptionsBar.WordWrapToggleButton.MouseButton1Down\connect ->
|
|
wordWrapToggleOn = not wordWrapToggleOn
|
|
Dev_OptionsBar.WordWrapToggleButton.CheckFrame.Visible = wordWrapToggleOn
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
|
|
---Dev-Console Message Functionality
|
|
AddLocalMessage = (str, messageType, timeStamp) ->
|
|
localMessageList[] =
|
|
Message: str
|
|
Time: ConvertTimeStamp timeStamp
|
|
Type: messageType
|
|
|
|
while #localMessageList > MAX_LIST_SIZE
|
|
table.remove localMessageList, 1
|
|
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
AddServerMessage = (str, messageType, timeStamp) ->
|
|
serverMessageList[] =
|
|
Message: str
|
|
Time: ConvertTimeStamp timeStamp
|
|
Type: messageType
|
|
|
|
while #serverMessageList > MAX_LIST_SIZE
|
|
table.remove serverMessageList, 1
|
|
|
|
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
--Handle Dev-Console Local/Server Buttons
|
|
Dev_Container.Body.LocalConsole.MouseButton1Click\connect ->
|
|
if currentConsole == SERVER_CONSOLE
|
|
currentConsole = LOCAL_CONSOLE
|
|
localConsole = Dev_Container.Body.LocalConsole
|
|
serverConsole = Dev_Container.Body.ServerConsole
|
|
|
|
localConsole.Size = UDim2.new 0, 90, 0, 20
|
|
serverConsole.Size = UDim2.new 0, 90, 0, 17
|
|
localConsole.BackgroundTransparency = 0.6
|
|
serverConsole.BackgroundTransparency = 0.8
|
|
|
|
if game\FindFirstChild"Players" and game.Players["LocalPlayer"]
|
|
mouse = game.Players.LocalPlayer\GetMouse!
|
|
refreshConsolePosition mouse.X, mouse.Y
|
|
refreshConsoleSize mouse.X, mouse.Y
|
|
handleScroll mouse.X, mouse.Y
|
|
|
|
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
|
|
Dev_Container.Body.LocalConsole.MouseButton1Up\connect clean
|
|
|
|
|
|
serverHistoryRequested = false
|
|
|
|
Dev_Container.Body.ServerConsole.MouseButton1Click\connect ->
|
|
if not serverHistoryRequested
|
|
serverHistoryRequested = true
|
|
game\GetService"LogService"\RequestServerOutput!
|
|
|
|
|
|
if currentConsole == LOCAL_CONSOLE
|
|
currentConsole = SERVER_CONSOLE
|
|
localConsole = Dev_Container.Body.LocalConsole
|
|
serverConsole = Dev_Container.Body.ServerConsole
|
|
|
|
serverConsole.Size = UDim2.new 0, 90, 0, 20
|
|
localConsole.Size = UDim2.new 0, 90, 0, 17
|
|
serverConsole.BackgroundTransparency = 0.6
|
|
localConsole.BackgroundTransparency = 0.8
|
|
|
|
if game\FindFirstChild"Players" and game.Players["LocalPlayer"]
|
|
mouse = game.Players.LocalPlayer\GetMouse!
|
|
refreshConsolePosition mouse.X, mouse.Y
|
|
refreshConsoleSize mouse.X, mouse.Y
|
|
handleScroll mouse.X, mouse.Y
|
|
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
|
|
---Extra Mouse Handlers for Dev-Console
|
|
Dev_Container.Body.ServerConsole.MouseButton1Up\connect clean
|
|
|
|
|
|
if game\FindFirstChild"Players" and game.Players["LocalPlayer"]
|
|
LocalMouse = game.Players.LocalPlayer\GetMouse!
|
|
LocalMouse.Move\connect ->
|
|
return if not Dev_Container.Visible
|
|
|
|
mouse = game.Players.LocalPlayer\GetMouse!
|
|
refreshConsolePosition mouse.X, mouse.Y
|
|
refreshConsoleSize mouse.X, mouse.Y
|
|
handleScroll mouse.X, mouse.Y
|
|
|
|
refreshTextHolder!
|
|
repositionList!
|
|
|
|
LocalMouse.Button1Up\connect clean
|
|
|
|
LocalMouse.WheelForward\connect ->
|
|
return if not Dev_Container.Visible
|
|
if existsInsideContainer Dev_Container, LocalMouse.X, LocalMouse.Y
|
|
changeOffset 10
|
|
|
|
LocalMouse.WheelBackward\connect ->
|
|
return if not Dev_Container.Visible
|
|
if existsInsideContainer Dev_Container, LocalMouse.X, LocalMouse.Y
|
|
changeOffset -10
|
|
|
|
|
|
Dev_ScrollArea.Handle.MouseButton1Down\connect ->
|
|
repositionList!
|
|
|
|
|
|
---Populate Dev-Console with dummy messages
|
|
|
|
history = game\GetService"LogService"\GetLogHistory!
|
|
|
|
for i = 1, #history
|
|
AddLocalMessage history[i].message, history[i].messageType, history[i].timestamp
|
|
|
|
with game\GetService"LogService"
|
|
.MessageOut\connect (message, messageType) ->
|
|
AddLocalMessage message, messageType, os.time!
|
|
.ServerMessageOut\connect AddServerMessage
|
|
|
|
currentlyToggling = false
|
|
ToggleConsole.OnInvoke = ->
|
|
return if currentlyToggling
|
|
|
|
currentlyToggling = true
|
|
initializeDeveloperConsole!
|
|
Dev_Container.Visible = not Dev_Container.Visible
|
|
currentlyToggling = false
|