Port more corescripts to yuescript lmao

This commit is contained in:
Lewin Kelly 2023-04-15 23:08:26 +01:00
parent 1642c4c716
commit d665d3afdf
15 changed files with 995 additions and 307 deletions

245
yue/152908679.lua Normal file
View File

@ -0,0 +1,245 @@
local New
New = function(className, name, props)
if not (props ~= nil) then
props = name
name = nil
end
local obj = Instance.new(className)
if name then
obj.Name = name
end
local parent
for k, v in pairs(props) do
if type(k) == "string" then
if k == "Parent" then
parent = v
else
obj[k] = v
end
elseif type(k) == "number" and type(v) == "userdata" then
v.Parent = obj
end
end
obj.Parent = parent
return obj
end
local contextActionService = Game:GetService("ContextActionService")
local isTouchDevice = Game:GetService("UserInputService").TouchEnabled
local functionTable = { }
local buttonVector = { }
local buttonScreenGui
local buttonFrame
local ContextDownImage = "http://www.banland.xyz/asset/?id=97166756"
local ContextUpImage = "http://www.banland.xyz/asset/?id=97166444"
local oldTouches = { }
local buttonPositionTable = {
UDim2.new(0, 123, 0, 70),
UDim2.new(0, 30, 0, 60),
UDim2.new(0, 180, 0, 160),
UDim2.new(0, 85, 0, -25),
UDim2.new(0, 185, 0, -25),
UDim2.new(0, 185, 0, 260),
UDim2.new(0, 216, 0, 65)
}
local maxButtons = #buttonPositionTable
do
local _with_0 = Game:GetService("ContentProvider")
_with_0:Preload(ContextDownImage)
_with_0:Preload(ContextUpImage)
end
while not Game.Players do
wait()
end
while not Game.Players.LocalPlayer do
wait()
end
local createContextActionGui
createContextActionGui = function()
if not buttonScreenGui and isTouchDevice then
buttonScreenGui = New("ScreenGui", "ContextActionGui", {
New("Frame", "ContextButtonFrame", {
BackgroundTransparency = 1,
Size = UDim2.new(0.3, 0, 0.5, 0),
Position = UDim2.new(0.7, 0, 0.5, 0)
})
})
end
end
local contextButtonDown
contextButtonDown = function(button, inputObject, actionName)
if inputObject.UserInputType == Enum.UserInputType.Touch then
button.Image = ContextDownImage
return contextActionService:CallFunction(actionName, Enum.UserInputState.Begin)
end
end
local contextButtonMoved
contextButtonMoved = function(button, inputObject, actionName)
if inputObject.UserInputType == Enum.UserInputType.Touch then
button.Image = ContextDownImage
return contextActionService:CallFunction(actionName, Enum.UserInputState.Change)
end
end
local contextButtonUp
contextButtonUp = function(button, inputObject, actionName)
button.Image = ContextUpImage
if inputObject.UserInputType == Enum.UserInputType.Touch and inputObject.UserInputState == Enum.UserInputState.End then
return contextActionService:CallFunction(actionName, Enum.UserInputState.End, inputObject)
end
end
local isSmallScreenDevice
isSmallScreenDevice = function()
return Game:GetService("GuiService"):GetScreenResolution().y <= 320
end
local createNewButton
createNewButton = function(actionName, functionInfoTable)
local contextButton = New("ImageButton", "ContextActionButton", {
BackgroundTransparency = 1,
Size = UDim2.new((function()
if isSmallScreenDevice() then
return 0, 90, 0, 90
else
return 0, 70, 0, 70
end
end)()),
Active = true,
Image = ContextUpImage,
Parent = buttonFrame
})
local currentButtonTouch
Game:GetService("UserInputService").InputEnded:connect(function(inputObject)
oldTouches[inputObject] = nil
end)
contextButton.InputBegan:connect(function(inputObject)
if oldTouches[inputObject] then
return
end
if inputObject.UserInputState == Enum.UserInputState.Begin and not (currentButtonTouch ~= nil) then
currentButtonTouch = inputObject
return contextButtonDown(contextButton, inputObject, actionName)
end
end)
contextButton.InputChanged:connect(function(inputObject)
if oldTouches[inputObject] or currentButtonTouch ~= inputObject then
return
end
return contextButtonMoved(contextButton, inputObject, actionName)
end)
contextButton.InputEnded:connect(function(inputObject)
if oldTouches[inputObject] or currentButtonTouch ~= inputObject then
return
end
currentButtonTouch = nil
oldTouches[inputObject] = true
return contextButtonUp(contextButton, inputObject, actionName)
end)
local actionIcon = New("ImageLabel", "ActionIcon", {
Position = UDim2.new(0.175, 0, 0.175, 0),
Size = UDim2.new(0.65, 0, 0.65, 0),
BackgroundTransparency = 1
})
if functionInfoTable["image"] and type(functionInfoTable["image"]) == "string" then
actionIcon.Image = functionInfoTable["image"]
end
actionIcon.Parent = contextButton
local actionTitle = New("TextLabel", "ActionTitle", {
Size = UDim2.new(1, 0, 1, 0),
BackgroundTransparency = 1,
Font = Enum.Font.SourceSansBold,
TextColor3 = Color3.new(1, 1, 1),
TextStrokeTransparency = 0,
FontSize = Enum.FontSize.Size18,
TextWrapped = true,
Text = ""
})
if functionInfoTable["title"] and type(functionInfoTable["title"]) == "string" then
actionTitle.Text = functionInfoTable["title"]
end
actionTitle.Parent = contextButton
return contextButton
end
local createButton
createButton = function(actionName, functionInfoTable)
local button = createNewButton(actionName, functionInfoTable)
local position
for i = 1, #buttonVector do
if buttonVector[i] == "empty" then
position = i
break
end
end
if not position then
position = #buttonVector + 1
end
if position > maxButtons then
return
end
buttonVector[position] = button
functionTable[actionName]["button"] = button
button.Position = buttonPositionTable[position]
button.Parent = buttonFrame
if buttonScreenGui and not (buttonScreenGui.Parent ~= nil) then
buttonScreenGui.Parent = Game.Players.LocalPlayer.PlayerGui
end
end
local removeAction
removeAction = function(actionName)
if not functionTable[actionName] then
return
end
local actionButton = functionTable[actionName]["button"]
if actionButton then
actionButton.Parent = nil
for i = 1, #buttonVector do
if buttonVector[i] == actionButton then
buttonVector[i] = "empty"
break
end
end
actionButton:Destroy()
end
functionTable[actionName] = nil
end
local addAction
addAction = function(actionName, createTouchButton, functionInfoTable)
if functionTable[actionName] then
removeAction(actionName)
end
functionTable[actionName] = {
functionInfoTable
}
if createTouchButton and isTouchDevice then
createContextActionGui()
return createButton(actionName, functionInfoTable)
end
end
contextActionService.BoundActionChanged:connect(function(actionName, changeName, changeTable)
if functionTable[actionName] and changeTable then
do
local button = functionTable[actionName]["button"]
if button then
if changeName == "image" then
button.ActionIcon.Image = changeTable[changeName]
elseif changeName == "title" then
button.ActionTitle.Text = changeTable[changeName]
elseif changeName == "position" then
button.Position = changeTable[changeName]
end
end
end
end
end)
contextActionService.BoundActionAdded:connect(function(actionName, createTouchButton, functionInfoTable)
return addAction(actionName, createTouchButton, functionInfoTable)
end)
contextActionService.BoundActionRemoved:connect(function(actionName, _)
return removeAction(actionName)
end)
contextActionService.GetActionButtonEvent:connect(function(actionName)
if functionTable[actionName] then
return contextActionService:FireActionButtonFoundSignal(actionName, functionTable[actionName]["button"])
end
end)
local boundActions = contextActionService:GetAllBoundActionInfo()
for actionName, actionData in pairs(boundActions) do
addAction(actionName, actionData["createTouchButton"], actionData)
end

View File

@ -0,0 +1,244 @@
-- ContextActionTouch.lua
-- Created by Ben Tkacheff
-- this script controls ui and firing of lua functions that are bound in ContextActionService for touch inputs
-- Essentially a user can bind a lua function to a key code, input type (mousebutton1 etc.) and this
-- Heliodex's basic New function (basically a simplified version of melt)
New = (className, name, props) ->
if not props? -- no name was provided
props = name
name = nil
obj = Instance.new className
obj.Name = name if name
local parent
for k, v in pairs props
if type(k) == "string"
if k == "Parent"
parent = v
else
obj[k] = v
elseif type(k) == "number" and type(v) == "userdata"
v.Parent = obj
obj.Parent = parent
obj
--
-- Variables
contextActionService = Game\GetService "ContextActionService"
isTouchDevice = Game\GetService("UserInputService").TouchEnabled
functionTable = {}
buttonVector = {}
local buttonScreenGui
local buttonFrame
ContextDownImage = "http://www.banland.xyz/asset/?id=97166756"
ContextUpImage = "http://www.banland.xyz/asset/?id=97166444"
oldTouches = {}
buttonPositionTable =
* UDim2.new 0, 123, 0, 70
* UDim2.new 0, 30, 0, 60
* UDim2.new 0, 180, 0, 160
* UDim2.new 0, 85, 0, -25
* UDim2.new 0, 185, 0, -25
* UDim2.new 0, 185, 0, 260
* UDim2.new 0, 216, 0, 65
maxButtons = #buttonPositionTable
-- Preload images
with Game\GetService"ContentProvider"
\Preload ContextDownImage
\Preload ContextUpImage
wait! until Game.Players
wait! until Game.Players.LocalPlayer
createContextActionGui = ->
if not buttonScreenGui and isTouchDevice
buttonScreenGui = New "ScreenGui", "ContextActionGui"
* New "Frame", "ContextButtonFrame"
BackgroundTransparency: 1
Size: UDim2.new 0.3, 0, 0.5, 0
Position: UDim2.new 0.7, 0, 0.5, 0
-- functions
-- setButtonSizeAndPosition = (object) ->
-- buttonSize = 55
-- xOffset = 10
-- yOffset = 95
-- -- todo: better way to determine mobile sized screens
-- onSmallScreen = game.CoreGui.RobloxGui.AbsoluteSize.X < 600
-- if not onSmallScreen
-- buttonSize = 85
-- xOffset = 40
-- object.Size = UDim2.new 0, buttonSize, 0, buttonSize
contextButtonDown = (button, inputObject, actionName) ->
if inputObject.UserInputType == Enum.UserInputType.Touch
button.Image = ContextDownImage
contextActionService\CallFunction actionName, Enum.UserInputState.Begin
contextButtonMoved = (button, inputObject, actionName) ->
if inputObject.UserInputType == Enum.UserInputType.Touch
button.Image = ContextDownImage
contextActionService\CallFunction actionName, Enum.UserInputState.Change
contextButtonUp = (button, inputObject, actionName) ->
button.Image = ContextUpImage
if inputObject.UserInputType == Enum.UserInputType.Touch and
inputObject.UserInputState == Enum.UserInputState.End
contextActionService\CallFunction actionName, Enum.UserInputState.End, inputObject
isSmallScreenDevice = ->
Game\GetService("GuiService")\GetScreenResolution!.y <= 320
createNewButton = (actionName, functionInfoTable) ->
contextButton = New "ImageButton", "ContextActionButton"
BackgroundTransparency: 1
Size: UDim2.new if isSmallScreenDevice!
0, 90, 0, 90
else
0, 70, 0, 70
Active: true
Image: ContextUpImage
Parent: buttonFrame
local currentButtonTouch
Game\GetService("UserInputService").InputEnded\connect (inputObject) ->
oldTouches[inputObject] = nil
contextButton.InputBegan\connect (inputObject) ->
return if oldTouches[inputObject]
if inputObject.UserInputState == Enum.UserInputState.Begin and not currentButtonTouch?
currentButtonTouch = inputObject
contextButtonDown(contextButton, inputObject, actionName)
contextButton.InputChanged\connect (inputObject) ->
return if oldTouches[inputObject] or
currentButtonTouch ~= inputObject
contextButtonMoved(contextButton, inputObject, actionName)
contextButton.InputEnded\connect (inputObject) ->
return if oldTouches[inputObject] or
currentButtonTouch ~= inputObject
currentButtonTouch = nil
oldTouches[inputObject] = true
contextButtonUp(contextButton, inputObject, actionName)
actionIcon = New "ImageLabel", "ActionIcon"
Position: UDim2.new 0.175, 0, 0.175, 0
Size: UDim2.new 0.65, 0, 0.65, 0
BackgroundTransparency: 1
if functionInfoTable["image"] and type(functionInfoTable["image"]) == "string"
actionIcon.Image = functionInfoTable["image"]
actionIcon.Parent = contextButton
actionTitle = New "TextLabel", "ActionTitle"
Size: UDim2.new 1, 0, 1, 0
BackgroundTransparency: 1
Font: Enum.Font.SourceSansBold
TextColor3: Color3.new 1, 1, 1
TextStrokeTransparency: 0
FontSize: Enum.FontSize.Size18
TextWrapped: true
Text: ""
if functionInfoTable["title"] and type(functionInfoTable["title"]) == "string"
actionTitle.Text = functionInfoTable["title"]
actionTitle.Parent = contextButton
contextButton
createButton = (actionName, functionInfoTable) ->
button = createNewButton(actionName, functionInfoTable)
local position
for i = 1, #buttonVector do
if buttonVector[i] == "empty" then
position = i
break
if not position
position = #buttonVector + 1
-- todo: let user know we have too many buttons already?
return if position > maxButtons
buttonVector[position] = button
functionTable[actionName]["button"] = button
button.Position = buttonPositionTable[position]
button.Parent = buttonFrame
if buttonScreenGui and not buttonScreenGui.Parent? then
buttonScreenGui.Parent = Game.Players.LocalPlayer.PlayerGui
removeAction = (actionName) ->
return if not functionTable[actionName]
actionButton = functionTable[actionName]["button"]
if actionButton
actionButton.Parent = nil
for i = 1, #buttonVector
if buttonVector[i] == actionButton
buttonVector[i] = "empty"
break
actionButton\Destroy!
functionTable[actionName] = nil
addAction = (actionName, createTouchButton, functionInfoTable) ->
if functionTable[actionName]
removeAction actionName
functionTable[actionName] = { functionInfoTable }
if createTouchButton and isTouchDevice
createContextActionGui!
createButton actionName, functionInfoTable
-- Connections
contextActionService.BoundActionChanged\connect (actionName, changeName, changeTable) ->
if functionTable[actionName] and changeTable
if button = functionTable[actionName]["button"]
if changeName == "image"
button.ActionIcon.Image = changeTable[changeName]
elseif changeName == "title"
button.ActionTitle.Text = changeTable[changeName]
-- elseif changeName == "description"
-- -- todo: add description to menu
elseif changeName == "position"
button.Position = changeTable[changeName]
contextActionService.BoundActionAdded\connect (actionName, createTouchButton, functionInfoTable) ->
addAction actionName, createTouchButton, functionInfoTable
contextActionService.BoundActionRemoved\connect (actionName, _) ->
removeAction actionName
contextActionService.GetActionButtonEvent\connect (actionName) ->
if functionTable[actionName]
contextActionService\FireActionButtonFoundSignal actionName, functionTable[actionName]["button"]
-- make sure any bound data before we setup connections is handled
boundActions = contextActionService\GetAllBoundActionInfo!
for actionName, actionData in pairs boundActions
addAction actionName, actionData["createTouchButton"], actionData

View File

@ -12,11 +12,11 @@ try
scriptContext\AddCoreScript 60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration"
waitForChild = (instance, name) ->
while not instance\FindFirstChild name
until instance\FindFirstChild name
instance.ChildAdded\wait!
-- waitForProperty = (instance, property) ->
-- while not instance[property]
-- until instance[property]
-- instance.Changed\wait!
-- Responsible for tracking logging items

View File

@ -47,16 +47,16 @@ inCharTag.Name = "InCharTag"
local hider = Instance.new("BoolValue")
hider.Name = "RobloxBuildTool"
if not (config ~= nil) then
config = Instance.new("Configuration")
config.Parent = Figure
config.Name = "PlayerStats"
config = New("Configuration", "PlayerStats", {
Parent = Figure
})
end
local myHealth = config:FindFirstChild("MaxHealth")
if not (myHealth ~= nil) then
myHealth = Instance.new("NumberValue")
myHealth.Parent = config
myHealth.Value = 100
myHealth.Name = "MaxHealth"
myHealth = New("NumberValue", "MaxHealth", {
Value = 100,
Parent = config
})
end
Humanoid.MaxHealth = myHealth.Value
Humanoid.Health = myHealth.Value

View File

@ -49,16 +49,14 @@ hider = Instance.new "BoolValue"
hider.Name = "RobloxBuildTool"
if not config?
config = Instance.new "Configuration"
config.Parent = Figure
config.Name = "PlayerStats"
config = New "Configuration", "PlayerStats"
Parent: Figure
myHealth = config\FindFirstChild "MaxHealth"
if not myHealth?
myHealth = Instance.new "NumberValue"
myHealth.Parent = config
myHealth.Value = 100
myHealth.Name = "MaxHealth"
myHealth = New "NumberValue", "MaxHealth"
Value: 100
Parent: config
Humanoid.MaxHealth = myHealth.Value
Humanoid.Health = myHealth.Value
@ -136,42 +134,42 @@ while true
ice = config\FindFirstChild "Ice"
fire = config\FindFirstChild "Fire"
stun = config\FindFirstChild "Stun"
if regen
delta = delta + regen.Value.X
if regen.Value.Y >= 0
regen.Value = Vector3.new regen.Value.X + regen.Value.Z, regen.Value.Y - s, regen.Value.Z -- maybe have 3rd parameter be an increaser/decreaser?
elseif regen.Value.Y == -1
regen.Value = Vector3.new regen.Value.X + regen.Value.Z, -1, regen.Value.Z
else
regen\remove!
-- infinity is -1
with regen do if regen
delta += .Value.X
if .Value.Y >= 0
.Value = Vector3.new .Value.X + .Value.Z, .Value.Y - s, .Value.Z -- maybe have 3rd parameter be an increaser/decreaser?
elseif .Value.Y == -1
.Value = Vector3.new .Value.X + .Value.Z, -1, .Value.Z
else
\remove!
-- infinity is -1
if poison
delta = delta - poison.Value.X
if poison.Value.Y >= 0
poison.Value = Vector3.new poison.Value.X + poison.Value.Z, poison.Value.Y - s, poison.Value.Z
elseif poison.Value.Y == -1
poison.Value = Vector3.new poison.Value.X + poison.Value.Z, -1, poison.Value.Z
else
poison\remove!
-- infinity is -1
with poison do if poison
delta -= .Value.X
if .Value.Y >= 0
.Value = Vector3.new .Value.X + .Value.Z, .Value.Y - s, .Value.Z
elseif .Value.Y == -1
.Value = Vector3.new .Value.X + .Value.Z, -1, .Value.Z
else
\remove!
-- infinity is -1
if ice
with ice do if ice
--print "IN ICE"
delta = delta - ice.Value.X
if ice.Value.Y >= 0
ice.Value = Vector3.new ice.Value.X, ice.Value.Y - s, ice.Value.Z
delta -= .Value.X
if .Value.Y >= 0
.Value = Vector3.new .Value.X, .Value.Y - s, .Value.Z
else
ice\remove!
\remove!
if fire
with fire do if fire
fireEffect.Enabled = true
fireEffect.Parent = Figure.Torso
delta = delta - fire.Value.X
if fire.Value.Y >= 0
fire.Value = Vector3.new fire.Value.X, fire.Value.Y - s, fire.Value.Z
delta -= .Value.X
if .Value.Y >= 0
.Value = Vector3.new .Value.X, .Value.Y - s, .Value.Z
else
fire\remove!
\remove!
fireEffect.Enabled = false
fireEffect.Parent = nil
@ -184,8 +182,8 @@ while true
for i = 1, #currentChildren
if currentChildren[i].className == "Tool"
inCharTag\Clone!.Parent = currentChildren[i]
print(backpackTools)
table.insert(backpackTools, currentChildren[i])
print backpackTools
table.insert backpackTools, currentChildren[i]
for i = 1, #backpackTools
if not backpackTools[i]\FindFirstChild("RobloxBuildTool")?
@ -218,7 +216,7 @@ while true
stun\Remove!
if delta ~= 0
coroutine.resume(coroutine.create(billboardHealthChange), delta)
coroutine.resume coroutine.create(billboardHealthChange), delta
--delta *= .01
--health += delta * s * Humanoid.MaxHealth

View File

@ -162,19 +162,18 @@ setChatNotificationTone = function(gui, purpose, tone)
end
local createMessageDialog
createMessageDialog = function()
messageDialog = Instance.new("Frame")
messageDialog.Name = "DialogScriptMessage"
messageDialog.Style = Enum.FrameStyle.RobloxRound
messageDialog.Visible = false
local text = Instance.new("TextLabel")
text.Name = "Text"
text.Position = UDim2.new(0, 0, 0, -1)
text.Size = UDim2.new(1, 0, 1, 0)
text.FontSize = Enum.FontSize.Size14
text.BackgroundTransparency = 1
text.TextColor3 = Color3.new(1, 1, 1)
text.RobloxLocked = true
text.Parent = messageDialog
messageDialog = New("Frame", "DialogScriptMessage", {
Style = Enum.FrameStyle.RobloxRound,
Visible = false,
New("TextLabel", "Text", {
Position = UDim2.new(0, 0, 0, -1),
Size = UDim2.new(1, 0, 1, 0),
FontSize = Enum.FontSize.Size14,
BackgroundTransparency = 1,
TextColor3 = Color3.new(1, 1, 1),
RobloxLocked = true
})
})
end
local showMessage
showMessage = function(msg, size)
@ -184,6 +183,7 @@ showMessage = function(msg, size)
messageDialog.Visible = true
wait(2)
messageDialog.Visible = false
return messageDialog
end
local variableDelay
variableDelay = function(str)
@ -261,6 +261,7 @@ renewKillswitch = function(dialog)
currentAbortDialogScript.archivable = false
currentAbortDialogScript.Disabled = false
currentAbortDialogScript.Parent = dialog
return currentAbortDialogScript
end
local presentDialogChoices
presentDialogChoices = function(talkingPart, dialogChoices)
@ -326,11 +327,35 @@ selectChoice = function(choice)
end
local newChoice
newChoice = function(numberText)
local frame = Instance.new("TextButton")
frame.BackgroundColor3 = Color3.new(0, 0, 179 / 255)
frame.AutoButtonColor = false
frame.BorderSizePixel = 0
frame.Text = ""
local frame = New("TextButton", {
BackgroundColor3 = Color3.new(0, 0, 179 / 255),
AutoButtonColor = false,
BorderSizePixel = 0,
Text = "",
RobloxLocked = true,
New("TextLabel", "Number", {
TextColor3 = Color3.new(127 / 255, 212 / 255, 255 / 255),
Text = numberText,
FontSize = Enum.FontSize.Size14,
BackgroundTransparency = 1,
Position = UDim2.new(0, 4, 0, 2),
Size = UDim2.new(0, 20, 0, 24),
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
RobloxLocked = true
}),
New("TextLabel", "UserPrompt", {
BackgroundTransparency = 1,
TextColor3 = Color3.new(1, 1, 1),
FontSize = Enum.FontSize.Size14,
Position = UDim2.new(0, 28, 0, 2),
Size = UDim2.new(1, -32, 1, -4),
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
TextWrap = true,
RobloxLocked = true
})
})
frame.MouseEnter:connect(function()
return highlightColor(frame, currentTone())
end)
@ -340,31 +365,6 @@ newChoice = function(numberText)
frame.MouseButton1Click:connect(function()
return selectChoice(frame)
end)
frame.RobloxLocked = true
local number = Instance.new("TextLabel")
number.Name = "Number"
number.TextColor3 = Color3.new(127 / 255, 212 / 255, 255 / 255)
number.Text = numberText
number.FontSize = Enum.FontSize.Size14
number.BackgroundTransparency = 1
number.Position = UDim2.new(0, 4, 0, 2)
number.Size = UDim2.new(0, 20, 0, 24)
number.TextXAlignment = Enum.TextXAlignment.Left
number.TextYAlignment = Enum.TextYAlignment.Top
number.RobloxLocked = true
number.Parent = frame
local prompt = Instance.new("TextLabel")
prompt.Name = "UserPrompt"
prompt.BackgroundTransparency = 1
prompt.TextColor3 = Color3.new(1, 1, 1)
prompt.FontSize = Enum.FontSize.Size14
prompt.Position = UDim2.new(0, 28, 0, 2)
prompt.Size = UDim2.new(1, -32, 1, -4)
prompt.TextXAlignment = Enum.TextXAlignment.Left
prompt.TextYAlignment = Enum.TextYAlignment.Top
prompt.TextWrap = true
prompt.RobloxLocked = true
prompt.Parent = frame
return frame
end
local initialize
@ -376,19 +376,18 @@ initialize = function(parent)
lastChoice = newChoice("5)")
lastChoice.UserPrompt.Text = "Goodbye!"
lastChoice.Size = UDim2.new(1, 0, 0, 28)
mainFrame = Instance.new("Frame")
mainFrame.Name = "UserDialogArea"
mainFrame.Size = UDim2.new(0, 350, 0, 200)
mainFrame.Style = Enum.FrameStyle.ChatBlue
mainFrame.Visible = false
local imageLabel = Instance.new("ImageLabel")
imageLabel.Name = "Tail"
imageLabel.Size = UDim2.new(0, 62, 0, 53)
imageLabel.Position = UDim2.new(1, 8, 0.25)
imageLabel.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
imageLabel.BackgroundTransparency = 1
imageLabel.RobloxLocked = true
imageLabel.Parent = mainFrame
mainFrame = New("Frame", "UserDialogArea", {
Size = UDim2.new(0, 350, 0, 200),
Style = Enum.FrameStyle.ChatBlue,
Visible = false,
New("ImageLabel", "Tail", {
Size = UDim2.new(0, 62, 0, 53),
Position = UDim2.new(1, 8, 0.25),
Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png",
BackgroundTransparency = 1,
RobloxLocked = true
})
})
for _, obj in pairs(choices) do
obj.RobloxLocked = true
obj.Parent = mainFrame
@ -515,13 +514,13 @@ onLoad = function()
messageDialog.RobloxLocked = true
messageDialog.Parent = gui
waitForChild(gui, "BottomLeftControl")
local frame = Instance.new("Frame")
frame.Name = "DialogFrame"
frame.Position = UDim2.new(0, 0, 0, 0)
frame.Size = UDim2.new(0, 0, 0, 0)
frame.BackgroundTransparency = 1
frame.RobloxLocked = true
frame.Parent = gui.BottomLeftControl
local frame = New("Frame", "DialogFrame", {
Position = UDim2.new(0, 0, 0, 0),
Size = UDim2.new(0, 0, 0, 0),
BackgroundTransparency = 1,
RobloxLocked = true,
Parent = gui.BottomLeftControl
})
initialize(frame)
game.CollectionService.ItemAdded:connect(function(obj)
if obj:IsA("Dialog") then

View File

@ -23,11 +23,11 @@ New = (className, name, props) ->
--
waitForProperty = (instance, name) ->
while not instance[name]
until instance[name]
instance.Changed\wait!
waitForChild = (instance, name) ->
while not instance\FindFirstChild name
until instance\FindFirstChild name
instance.ChildAdded\wait!
local mainFrame
@ -132,43 +132,41 @@ styleMainFrame = (tone) ->
styleChoices tone
setChatNotificationTone = (gui, purpose, tone) ->
if tone == Enum.DialogTone.Neutral
gui.Image.Image = "rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
gui.Image.Image = if tone == Enum.DialogTone.Neutral
"rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
elseif tone == Enum.DialogTone.Friendly
gui.Image.Image = "rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
"rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
elseif tone == Enum.DialogTone.Enemy
gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png"
"rbxasset://textures/chatBubble_botRed_notify_bkg.png"
if purpose == Enum.DialogPurpose.Quest
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_bang.png"
gui.Image.Button.Image = if purpose == Enum.DialogPurpose.Quest
"rbxasset://textures/chatBubble_bot_notify_bang.png"
elseif purpose == Enum.DialogPurpose.Help
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_question.png"
"rbxasset://textures/chatBubble_bot_notify_question.png"
elseif purpose == Enum.DialogPurpose.Shop
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_money.png"
"rbxasset://textures/chatBubble_bot_notify_money.png"
createMessageDialog = ->
messageDialog = Instance.new "Frame"
messageDialog.Name = "DialogScriptMessage"
messageDialog.Style = Enum.FrameStyle.RobloxRound
messageDialog.Visible = false
messageDialog = New "Frame", "DialogScriptMessage"
Style: Enum.FrameStyle.RobloxRound
Visible: false
text = Instance.new "TextLabel"
text.Name = "Text"
text.Position = UDim2.new 0, 0, 0, -1
text.Size = UDim2.new 1, 0, 1, 0
text.FontSize = Enum.FontSize.Size14
text.BackgroundTransparency = 1
text.TextColor3 = Color3.new 1, 1, 1
text.RobloxLocked = true
text.Parent = messageDialog
* New "TextLabel", "Text"
Position: UDim2.new 0, 0, 0, -1
Size: UDim2.new 1, 0, 1, 0
FontSize: Enum.FontSize.Size14
BackgroundTransparency: 1
TextColor3: Color3.new 1, 1, 1
RobloxLocked: true
showMessage = (msg, size) ->
messageDialog.Text.Text = msg
messageDialog.Size = UDim2.new 0, size, 0, 40
messageDialog.Position = UDim2.new 0.5, -size / 2, 0.5, -40
messageDialog.Visible = true
wait 2
messageDialog.Visible = false
with messageDialog
.Text.Text = msg
.Size = UDim2.new 0, size, 0, 40
.Position = UDim2.new 0.5, -size / 2, 0.5, -40
.Visible = true
wait 2
.Visible = false
variableDelay = (str) ->
length = math.min string.len(str), 100
@ -226,14 +224,15 @@ sanitizeMessage = (msg) ->
msg
renewKillswitch = (dialog) ->
if currentAbortDialogScript
currentAbortDialogScript\Remove!
currentAbortDialogScript = nil
with currentAbortDialogScript
if currentAbortDialogScript
\Remove!
currentAbortDialogScript = nil
currentAbortDialogScript = timeoutScript\Clone!
currentAbortDialogScript.archivable = false
currentAbortDialogScript.Disabled = false
currentAbortDialogScript.Parent = dialog
currentAbortDialogScript = timeoutScript\Clone!
.archivable = false
.Disabled = false
.Parent = dialog
presentDialogChoices = (talkingPart, dialogChoices) ->
return if not currentConversationDialog
@ -269,8 +268,8 @@ presentDialogChoices = (talkingPart, dialogChoices) ->
choiceMap[choices[pos]] = obj
yPosition = yPosition + height
pos = pos + 1
yPosition += height
pos += 1
lastChoice.Position = UDim2.new 0, 0, 0, yPosition
lastChoice.Number.Text = pos .. ")"
@ -310,44 +309,41 @@ selectChoice = (choice) ->
presentDialogChoices currentConversationPartner, dialogChoice\GetChildren!
newChoice = (numberText) ->
frame = Instance.new "TextButton"
frame.BackgroundColor3 = Color3.new 0, 0, 179 / 255
frame.AutoButtonColor = false
frame.BorderSizePixel = 0
frame.Text = ""
frame = New "TextButton"
BackgroundColor3: Color3.new 0, 0, 179 / 255
AutoButtonColor: false
BorderSizePixel: 0
Text: ""
RobloxLocked: true
* New "TextLabel", "Number"
TextColor3: Color3.new 127 / 255, 212 / 255, 255 / 255
Text: numberText
FontSize: Enum.FontSize.Size14
BackgroundTransparency: 1
Position: UDim2.new 0, 4, 0, 2
Size: UDim2.new 0, 20, 0, 24
TextXAlignment: Enum.TextXAlignment.Left
TextYAlignment: Enum.TextYAlignment.Top
RobloxLocked: true
* New "TextLabel", "UserPrompt"
BackgroundTransparency: 1
TextColor3: Color3.new 1, 1, 1
FontSize: Enum.FontSize.Size14
Position: UDim2.new 0, 28, 0, 2
Size: UDim2.new 1, -32, 1, -4
TextXAlignment: Enum.TextXAlignment.Left
TextYAlignment: Enum.TextYAlignment.Top
TextWrap: true
RobloxLocked: true
frame.MouseEnter\connect ->
highlightColor frame, currentTone!
frame.MouseLeave\connect ->
resetColor frame, currentTone!
frame.MouseButton1Click\connect ->
selectChoice frame
frame.RobloxLocked = true
number = Instance.new "TextLabel"
number.Name = "Number"
number.TextColor3 = Color3.new 127 / 255, 212 / 255, 255 / 255
number.Text = numberText
number.FontSize = Enum.FontSize.Size14
number.BackgroundTransparency = 1
number.Position = UDim2.new 0, 4, 0, 2
number.Size = UDim2.new 0, 20, 0, 24
number.TextXAlignment = Enum.TextXAlignment.Left
number.TextYAlignment = Enum.TextYAlignment.Top
number.RobloxLocked = true
number.Parent = frame
prompt = Instance.new "TextLabel"
prompt.Name = "UserPrompt"
prompt.BackgroundTransparency = 1
prompt.TextColor3 = Color3.new 1, 1, 1
prompt.FontSize = Enum.FontSize.Size14
prompt.Position = UDim2.new 0, 28, 0, 2
prompt.Size = UDim2.new 1, -32, 1, -4
prompt.TextXAlignment = Enum.TextXAlignment.Left
prompt.TextYAlignment = Enum.TextYAlignment.Top
prompt.TextWrap = true
prompt.RobloxLocked = true
prompt.Parent = frame
frame
@ -361,20 +357,17 @@ initialize = (parent) ->
lastChoice.UserPrompt.Text = "Goodbye!"
lastChoice.Size = UDim2.new 1, 0, 0, 28
mainFrame = Instance.new "Frame"
mainFrame.Name = "UserDialogArea"
mainFrame.Size = UDim2.new 0, 350, 0, 200
mainFrame.Style = Enum.FrameStyle.ChatBlue
mainFrame.Visible = false
mainFrame = New "Frame", "UserDialogArea"
Size: UDim2.new 0, 350, 0, 200
Style: Enum.FrameStyle.ChatBlue
Visible: false
imageLabel = Instance.new "ImageLabel"
imageLabel.Name = "Tail"
imageLabel.Size = UDim2.new 0, 62, 0, 53
imageLabel.Position = UDim2.new 1, 8, 0.25
imageLabel.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
imageLabel.BackgroundTransparency = 1
imageLabel.RobloxLocked = true
imageLabel.Parent = mainFrame
* New "ImageLabel", "Tail"
Size: UDim2.new 0, 62, 0, 53
Position: UDim2.new 1, 8, 0.25
Image: "rbxasset://textures/chatBubble_botBlue_tailRight.png"
BackgroundTransparency: 1
RobloxLocked: true
for _, obj in pairs choices
obj.RobloxLocked = true
@ -386,7 +379,7 @@ initialize = (parent) ->
mainFrame.Parent = parent
doDialog = (dialog) ->
while not Instance.Lock dialog, player
until Instance.Lock dialog, player
wait!
if dialog.InUse
@ -438,12 +431,13 @@ addDialog = (dialog) ->
if dialog.Parent
if dialog.Parent\IsA "BasePart"
chatGui = chatNotificationGui\clone!
chatGui.Enabled = not dialog.InUse
chatGui.Adornee = dialog.Parent
chatGui.RobloxLocked = true
chatGui.Parent = game.CoreGui
chatGui.Image.Button.MouseButton1Click\connect ->
startDialog dialog
with chatGui
.Enabled = not dialog.InUse
.Adornee = dialog.Parent
.RobloxLocked = true
.Parent = game.CoreGui
.Image.Button.MouseButton1Click\connect ->
startDialog dialog
setChatNotificationTone chatGui, dialog.Purpose, dialog.Tone
@ -501,13 +495,13 @@ onLoad = ->
waitForChild gui, "BottomLeftControl"
--print "Initializing Frame"
frame = Instance.new "Frame"
frame.Name = "DialogFrame"
frame.Position = UDim2.new 0, 0, 0, 0
frame.Size = UDim2.new 0, 0, 0, 0
frame.BackgroundTransparency = 1
frame.RobloxLocked = true
frame.Parent = gui.BottomLeftControl
frame = New "Frame", "DialogFrame"
Position: UDim2.new 0, 0, 0, 0
Size: UDim2.new 0, 0, 0, 0
BackgroundTransparency: 1
RobloxLocked: true
Parent: gui.BottomLeftControl
initialize frame
--print "Adding Dialogs"

View File

@ -818,27 +818,29 @@ t.CreateTrueScrollingFrame = function()
end
end)
local scrollDownButton = scrollUpButton:clone()
scrollDownButton.Name = "ScrollDownButton"
scrollDownButton.Position = UDim2.new(0, 0, 1, -18)
local downChildren = scrollDownButton:GetChildren()
for i = 1, #downChildren do
downChildren[i].Position = UDim2.new(0, 3 + (i - 1), 0.5, -2 + (i - 1))
do
scrollDownButton.Name = "ScrollDownButton"
scrollDownButton.Position = UDim2.new(0, 0, 1, -18)
local downChildren = scrollDownButton:GetChildren()
for i = 1, #downChildren do
downChildren[i].Position = UDim2.new(0, 3 + (i - 1), 0.5, -2 + (i - 1))
end
scrollDownButton.MouseEnter:connect(function()
scrollDownButton.BackgroundTransparency = 0.1
downChildren = scrollDownButton:GetChildren()
for i = 1, #downChildren do
downChildren[i].BackgroundTransparency = 0.1
end
end)
scrollDownButton.MouseLeave:connect(function()
scrollDownButton.BackgroundTransparency = 0.5
downChildren = scrollDownButton:GetChildren()
for i = 1, #downChildren do
downChildren[i].BackgroundTransparency = 0.5
end
end)
scrollDownButton.Parent = controlFrame
end
scrollDownButton.MouseEnter:connect(function()
scrollDownButton.BackgroundTransparency = 0.1
downChildren = scrollDownButton:GetChildren()
for i = 1, #downChildren do
downChildren[i].BackgroundTransparency = 0.1
end
end)
scrollDownButton.MouseLeave:connect(function()
scrollDownButton.BackgroundTransparency = 0.5
downChildren = scrollDownButton:GetChildren()
for i = 1, #downChildren do
downChildren[i].BackgroundTransparency = 0.5
end
end)
scrollDownButton.Parent = controlFrame
local newNub = scrollNub:clone()
newNub.Position = UDim2.new(0.5, -5, 0.5, -2)
newNub.Parent = scrollbar

View File

@ -114,7 +114,7 @@ setSliderPos = (newAbsPosX, slider, sliderPosition, bar, steps) ->
relativePosX = math.min 1, math.max 0, (newAbsPosX - bar.AbsolutePosition.X) / bar.AbsoluteSize.X
wholeNum, remainder = math.modf relativePosX * newStep
if remainder > 0.5
wholeNum = wholeNum + 1
wholeNum += 1
relativePosX = wholeNum / newStep
@ -350,7 +350,7 @@ t.CreateDropDownMenu = (items, onSelect, forRoblox) ->
obj.TextColor3 = Color3.new 1, 1, 1
obj.BackgroundTransparency = 1
childNum = childNum + 1
childNum += 1
toggleVisibility = ->
dropDownSelected = not dropDownSelected
@ -381,7 +381,7 @@ t.CreateDropDownMenu = (items, onSelect, forRoblox) ->
else
obj.Font = Enum.Font.Arial
childNum = childNum + 1
childNum += 1
if not text
dropDownMenu.Text = "Choose One"
@ -397,7 +397,7 @@ t.CreateDropDownMenu = (items, onSelect, forRoblox) ->
scrollDown = ->
if scrollBarPosition + dropDownItemCount <= itemCount
scrollBarPosition = scrollBarPosition + 1
scrollBarPosition += 1
updateScroll!
return true
@ -405,7 +405,7 @@ t.CreateDropDownMenu = (items, onSelect, forRoblox) ->
scrollUp = ->
if scrollBarPosition > 1
scrollBarPosition = scrollBarPosition - 1
scrollBarPosition -= 1
updateScroll!
return true
@ -578,7 +578,7 @@ layoutGuiObjectsHelper = (frame, guiObjects, settingsTable) ->
child.TextBounds.Y + settingsTable[settingsTableIndex]
)
while not child.TextFits
until child.TextFits
child.Size = UDim2.new child.Size.X.Scale, child.Size.X.Offset, 0, child.AbsoluteSize.Y + 1
pixelsRemaining -= child.AbsoluteSize.Y
@ -820,25 +820,27 @@ t.CreateTrueScrollingFrame = ->
upChildren[i].BackgroundTransparency = 0.5
scrollDownButton = scrollUpButton\clone!
scrollDownButton.Name = "ScrollDownButton"
scrollDownButton.Position = UDim2.new 0, 0, 1, -18
downChildren = scrollDownButton\GetChildren!
for i = 1, #downChildren
downChildren[i].Position = UDim2.new 0, 3 + (i - 1), 0.5, -2 + (i - 1)
scrollDownButton.MouseEnter\connect ->
scrollDownButton.BackgroundTransparency = 0.1
downChildren = scrollDownButton\GetChildren!
with scrollDownButton
.Name = "ScrollDownButton"
.Position = UDim2.new 0, 0, 1, -18
downChildren = \GetChildren!
for i = 1, #downChildren
downChildren[i].BackgroundTransparency = 0.1
downChildren[i].Position = UDim2.new 0, 3 + (i - 1), 0.5, -2 + (i - 1)
scrollDownButton.MouseLeave\connect ->
scrollDownButton.BackgroundTransparency = 0.5
downChildren = scrollDownButton\GetChildren!
for i = 1, #downChildren
downChildren[i].BackgroundTransparency = 0.5
.MouseEnter\connect ->
.BackgroundTransparency = 0.1
downChildren = \GetChildren!
for i = 1, #downChildren
downChildren[i].BackgroundTransparency = 0.1
scrollDownButton.Parent = controlFrame
.MouseLeave\connect ->
.BackgroundTransparency = 0.5
downChildren = \GetChildren!
for i = 1, #downChildren
downChildren[i].BackgroundTransparency = 0.5
.Parent = controlFrame
newNub = scrollNub\clone!
newNub.Position = UDim2.new 0.5, -5, 0.5, -2
@ -1072,10 +1074,10 @@ t.CreateTrueScrollingFrame = ->
break if mouseYPos and mouseYPos < (scrollbar.AbsolutePosition.y + scrollbar.AbsoluteSize.x)
break if not scrollDownButton.Active
if tick! - t > 5
w = 0
w = if tick! - t > 5
0
elseif tick! - t > 2
w = 0.06
0.06
wait w
@ -1242,7 +1244,7 @@ t.CreateTrueScrollingFrame = ->
button.Parent = frame
buttonObjs[buttonNum] = button
buttonNum = buttonNum + 1
buttonNum += 1
numButtons = buttonNum - 1
if numButtons == 1
@ -1263,7 +1265,7 @@ t.CreateTrueScrollingFrame = ->
buttonObjs[buttonNum].Position =
UDim2.new(spacing * buttonNum + (buttonNum - 1) * buttonSize, 0, yPos.Scale, yPos.Offset)
buttonObjs[buttonNum].Size = UDim2.new(buttonSize, 0, ySize.Scale, ySize.Offset)
buttonNum = buttonNum + 1
buttonNum += 1
end
@ -1272,7 +1274,7 @@ t.CreateTrueScrollingFrame = ->
relativePosX = math.min(1, math.max(0, (newAbsPosX - bar.AbsolutePosition.X) / bar.AbsoluteSize.X))
local wholeNum, remainder = math.modf(relativePosX * newStep)
if remainder > 0.5
wholeNum = wholeNum + 1
wholeNum += 1
relativePosX = wholeNum / newStep
result = math.ceil(relativePosX * newStep)
@ -1522,7 +1524,7 @@ t.CreateTrueScrollingFrame = ->
obj.TextColor3 = Color3.new 1, 1, 1
obj.BackgroundTransparency = 1
childNum = childNum + 1
childNum += 1
toggleVisibility = function()
@ -1555,7 +1557,7 @@ t.CreateTrueScrollingFrame = ->
else
obj.Font = Enum.Font.Arial
childNum = childNum + 1
childNum += 1
@ -1576,14 +1578,14 @@ t.CreateTrueScrollingFrame = ->
scrollDown = !
if scrollBarPosition + dropDownItemCount <= itemCount
scrollBarPosition = scrollBarPosition + 1
scrollBarPosition += 1
updateScroll!
return true
return false
scrollUp = !
if scrollBarPosition > 1
scrollBarPosition = scrollBarPosition - 1
scrollBarPosition -= 1
updateScroll!
return true
@ -1599,7 +1601,7 @@ t.CreateTrueScrollingFrame = ->
scrollUpButton.Position = UDim2.new(1, -11, (1 * 0.8) / ((dropDownItemCount + 1) * 0.8), 0)
scrollUpButton.MouseButton1Click\connect ->
scrollMouseCount += 1
)
scrollUpButton.MouseLeave\connect ->
scrollMouseCount += 1
)
@ -1813,7 +1815,7 @@ t.CreateTrueScrollingFrame = ->
)
while not child.TextFits
until child.TextFits
child.Size = UDim2.new(child.Size.X.Scale, child.Size.X.Offset, 0, child.AbsoluteSize.Y + 1)
pixelsRemaining -= child.AbsoluteSize.Y
@ -2607,20 +2609,20 @@ t.CreateTrueScrollingFrame = ->
pos = scrollPosition
--count up from current scroll position to fill out grid
while pos <= #guiObjects and pixelsBelowScrollbar < totalPixelsY
xCounter = xCounter + guiObjects[pos].AbsoluteSize.X
xCounter += guiObjects[pos].AbsoluteSize.X
--previous pos was the end of a row
if xCounter >= totalPixelsX
pixelsBelowScrollbar = pixelsBelowScrollbar + currentRowY
pixelsBelowScrollbar += currentRowY
currentRowY = 0
xCounter = guiObjects[pos].AbsoluteSize.X
if guiObjects[pos].AbsoluteSize.Y > currentRowY
currentRowY = guiObjects[pos].AbsoluteSize.Y
pos = pos + 1
pos += 1
--Count wherever current row left off
pixelsBelowScrollbar = pixelsBelowScrollbar + currentRowY
pixelsBelowScrollbar += currentRowY
currentRowY = 0
pos = scrollPosition - 1
@ -2631,20 +2633,20 @@ t.CreateTrueScrollingFrame = ->
--count backwards from current scrollPosition to see if we can add more rows
while pixelsBelowScrollbar + currentRowY < totalPixelsY and pos >= 1
xCounter = xCounter + guiObjects[pos].AbsoluteSize.X
rowSizeCounter = rowSizeCounter + 1
xCounter += guiObjects[pos].AbsoluteSize.X
rowSizeCounter += 1
if xCounter >= totalPixelsX
rowSize = rowSizeCounter - 1
rowSizeCounter = 0
xCounter = guiObjects[pos].AbsoluteSize.X
if pixelsBelowScrollbar + currentRowY <= totalPixelsY
--It fits, so back up our scroll position
pixelsBelowScrollbar = pixelsBelowScrollbar + currentRowY
pixelsBelowScrollbar += currentRowY
if scrollPosition <= rowSize
scrollPosition = 1
break
else
scrollPosition = scrollPosition - rowSize
scrollPosition -= rowSize
currentRowY = 0
else
@ -2656,7 +2658,7 @@ t.CreateTrueScrollingFrame = ->
currentRowY = guiObjects[pos].AbsoluteSize.Y
pos = pos - 1
pos -= 1
--Do check last time if pos = 0
@ -2688,7 +2690,7 @@ t.CreateTrueScrollingFrame = ->
--print("Laying out " .. child.Name)
--GuiObject
if setRowSize
rowSizeCounter = rowSizeCounter + 1
rowSizeCounter += 1
if xCounter + child.AbsoluteSize.X >= totalPixelsX
if setRowSize
@ -2696,7 +2698,7 @@ t.CreateTrueScrollingFrame = ->
setRowSize = false
xCounter = 0
pixelsRemainingY = pixelsRemainingY - child.AbsoluteSize.Y
pixelsRemainingY -= child.AbsoluteSize.Y
child.Position = UDim2.new(
child.Position.X.Scale,
@ -2704,10 +2706,10 @@ t.CreateTrueScrollingFrame = ->
0,
totalPixelsY - pixelsRemainingY + yOffset
)
xCounter = xCounter + child.AbsoluteSize.X
xCounter += child.AbsoluteSize.X
child.Visible = ((pixelsRemainingY - child.AbsoluteSize.Y) >= 0)
if child.Visible
howManyDisplayed = howManyDisplayed + 1
howManyDisplayed += 1
lastChildSize = child.AbsoluteSize
@ -2762,23 +2764,23 @@ t.CreateTrueScrollingFrame = ->
pos = #guiObjects
while pixelsBelowScrollbar < totalPixels and pos >= 1
if pos >= scrollPosition
pixelsBelowScrollbar = pixelsBelowScrollbar + guiObjects[pos].AbsoluteSize.Y
pixelsBelowScrollbar += guiObjects[pos].AbsoluteSize.Y
else
if pixelsBelowScrollbar + guiObjects[pos].AbsoluteSize.Y <= totalPixels
--It fits, so back up our scroll position
pixelsBelowScrollbar = pixelsBelowScrollbar + guiObjects[pos].AbsoluteSize.Y
pixelsBelowScrollbar += guiObjects[pos].AbsoluteSize.Y
if scrollPosition <= 1
scrollPosition = 1
break
else
--local ("Backing up ScrollPosition from -- " ..scrollPosition)
scrollPosition = scrollPosition - 1
scrollPosition -= 1
else
break
pos = pos - 1
pos -= 1
pos = scrollPosition
@ -2798,7 +2800,7 @@ t.CreateTrueScrollingFrame = ->
pixelsRemaining -= child.AbsoluteSize.Y
if pixelsRemaining >= 0
child.Visible = true
howManyDisplayed = howManyDisplayed + 1
howManyDisplayed += 1
else
child.Visible = false
@ -2816,7 +2818,7 @@ t.CreateTrueScrollingFrame = ->
if children
for _, child in ipairs(children)
if child\IsA "GuiObject"
guiObjects = guiObjects + 1
guiObjects += 1
@ -2871,14 +2873,14 @@ t.CreateTrueScrollingFrame = ->
reentrancyGuard = false
doScrollUp = function()
scrollPosition = scrollPosition - rowSize
scrollPosition -= rowSize
if scrollPosition < 1
scrollPosition = 1
recalculate(nil)
doScrollDown = function()
scrollPosition = scrollPosition + rowSize
scrollPosition += rowSize
recalculate(nil)
scrollUp = function(mouseYPos)
@ -2958,19 +2960,16 @@ t.CreateTrueScrollingFrame = ->
dragAbsSize = scrollDrag.AbsoluteSize.y
barAbsOne = barAbsPos + barAbsSize - dragAbsSize
y = y - mouseOffset
y -= mouseOffset
y = y < barAbsPos and barAbsPos or y > barAbsOne and barAbsOne or y
y = y - barAbsPos
y -= barAbsPos
guiObjects = 0
children = frame\GetChildren!
if children
for _, child in ipairs(children)
if child\IsA "GuiObject"
guiObjects = guiObjects + 1
guiObjects += 1
doublePercent = y / (barAbsSize - dragAbsSize)
rowDiff = rowSize
@ -2979,11 +2978,9 @@ t.CreateTrueScrollingFrame = ->
if newScrollPosition < scrollPosition
rowDiff = -rowDiff
if newScrollPosition < 1
newScrollPosition = 1
scrollPosition = newScrollPosition
recalculate(nil)
)
@ -3495,7 +3492,7 @@ t.CreateTrueScrollingFrame = ->
imageLabel.Position = UDim2.new 0.5 - (x / y) / 2, 0, 0, 0)
size = size + 50
size += 50
frame.Size = UDim2.new 0, size, 0, size)
frame.Position = UDim2.new 0.5, -size / 2, 0.5, -size / 2)
@ -3868,7 +3865,7 @@ t.CreateTrueScrollingFrame = ->
numSkipped = 0
for i = 1, #sets
if not showAdminCategories and sets[i].Name == "Beta"
numSkipped = numSkipped + 1
numSkipped += 1
else
setButtons[i - numSkipped] =
buildSetButton(sets[i].Name, sets[i].CategoryId, sets[i].ImageAssetId, i - numSkipped, #sets)
@ -4068,10 +4065,10 @@ t.CreateTrueScrollingFrame = ->
y = 0
for i = 1, #insertButtons
insertButtons[i].Position = UDim2.new 0, buttonWidth * x, 0, buttonHeight * y)
x = x + 1
x += 1
if x >= columns
x = 0
y = y + 1
y += 1
@ -4125,7 +4122,7 @@ t.CreateTrueScrollingFrame = ->
insertButtons[arrayPosition], buttonCon = buildInsertButton()
table.insert(insertButtonCons, buttonCon)
insertButtons[arrayPosition].Parent = setGui.SetPanel.ItemsFrame
arrayPosition = arrayPosition + 1
arrayPosition += 1
realignButtonGrid(columns)
@ -4277,7 +4274,7 @@ t.CreateTrueScrollingFrame = ->
selectSet(button, button.Text, userCategoryButtons[i].SetId.Value, 0)
)
currRow = currRow + 1
currRow += 1
buttons = setGui.SetPanel.Sets.SetsLists\GetChildren!
@ -4988,7 +4985,7 @@ t.CreateTrueScrollingFrame = ->
widgetContainer.Size = UDim2.new 0, dragBar.AbsoluteSize.X, 0, 400)
if position
widgetContainer.Position = position + UDim2.new 0, 0, 0, 20)
widgetContainer.Position += UDim2.new 0, 0, 0, 20)
local frame, control, verticalDragger = nil
if scrollable

15
yue/45374389.lua Normal file
View File

@ -0,0 +1,15 @@
local t = { }
t.Foo = function()
return print("foo")
end
t.Bar = function()
return print("bar")
end
t.Help = function(funcNameOrFunc)
if funcNameOrFunc == "Foo" or funcNameOrFunc == t.Foo then
return "Function Foo. Arguments: None. Side effect: prints foo"
elseif funcNameOrFunc == "Bar" or funcNameOrFunc == t.Bar then
return "Function Bar. Arguments: None. Side effect: prints bar"
end
end
return t

View File

@ -0,0 +1,16 @@
t = {}
t.Foo = ->
print "foo"
t.Bar = ->
print "bar"
t.Help = (funcNameOrFunc) ->
--input argument can be a string or a function. Should return a description (of arguments and expected side effects)
if funcNameOrFunc == "Foo" or funcNameOrFunc == t.Foo
return "Function Foo. Arguments: None. Side effect: prints foo"
elseif funcNameOrFunc == "Bar" or funcNameOrFunc == t.Bar
return "Function Bar. Arguments: None. Side effect: prints bar"
t

90
yue/48488451.lua Normal file
View File

@ -0,0 +1,90 @@
local New
New = function(className, name, props)
if not (props ~= nil) then
props = name
name = nil
end
local obj = New(className)
if name then
obj.Name = name
end
local parent
for k, v in pairs(props) do
if type(k) == "string" then
if k == "Parent" then
parent = v
else
obj[k] = v
end
elseif type(k) == "number" and type(v) == "userdata" then
v.Parent = obj
end
end
obj.Parent = parent
return obj
end
local popupFrame = New("Frame", "Popup", {
Position = UDim2.new(0.5, -165, 0.5, -175),
Size = UDim2.new(0, 330, 0, 350),
Style = Enum.FrameStyle.RobloxRound,
ZIndex = 4,
Visible = false,
Parent = script.Parent,
New("TextLabel", "PopupText", {
Size = UDim2.new(1, 0, 0.8, 0),
Font = Enum.Font.ArialBold,
FontSize = Enum.FontSize.Size36,
BackgroundTransparency = 1,
Text = "Hello I'm a popup",
TextColor3 = Color3.new(248 / 255, 248 / 255, 248 / 255),
TextWrap = true,
ZIndex = 5
}),
New("TextButton", "AcceptButton", {
Position = UDim2.new(0, 20, 0, 270),
Size = UDim2.new(0, 100, 0, 50),
Font = Enum.Font.ArialBold,
FontSize = Enum.FontSize.Size24,
Style = Enum.ButtonStyle.RobloxButton,
TextColor3 = Color3.new(248 / 255, 248 / 255, 248 / 255),
Text = "Yes",
ZIndex = 5
}),
New("ImageLabel", "PopupImage", {
BackgroundTransparency = 1,
Position = UDim2.new(0.5, -140, 0, 0),
Size = UDim2.new(0, 280, 0, 280),
ZIndex = 3,
New("ImageLabel", "Backing", {
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
Image = "http://www.roblox.com/asset/?id=47574181",
ZIndex = 2
})
})
})
local AcceptButton = popupFrame.AcceptButton
do
local _with_0 = popupFrame:clone()
_with_0.Name = "Darken"
_with_0.Size = UDim2.new(1, 16, 1, 16)
_with_0.Position = UDim2.new(0, -8, 0, -8)
_with_0.ZIndex = 1
_with_0.Parent = popupFrame
end
do
local _with_0 = AcceptButton:clone()
_with_0.Name = "DeclineButton"
_with_0.Position = UDim2.new(1, -120, 0, 270)
_with_0.Text = "No"
_with_0.Parent = popupFrame
end
do
local _with_0 = AcceptButton:clone()
_with_0.Name = "OKButton"
_with_0.Text = "OK"
_with_0.Position = UDim2.new(0.5, -50, 0, 270)
_with_0.Visible = false
_with_0.Parent = popupFrame
end
return script:remove()

View File

@ -0,0 +1,87 @@
-- Heliodex's basic New function (basically a simplified version of melt)
New = (className, name, props) ->
if not props? -- no name was provided
props = name
name = nil
obj = New className
obj.Name = name if name
local parent
for k, v in pairs props
if type(k) == "string"
if k == "Parent"
parent = v
else
obj[k] = v
elseif type(k) == "number" and type(v) == "userdata"
v.Parent = obj
obj.Parent = parent
obj
--
popupFrame = New "Frame", "Popup"
Position: UDim2.new 0.5, -165, 0.5, -175
Size: UDim2.new 0, 330, 0, 350
Style: Enum.FrameStyle.RobloxRound
ZIndex: 4
Visible: false
Parent: script.Parent
* New "TextLabel", "PopupText"
Size: UDim2.new 1, 0, 0.8, 0
Font: Enum.Font.ArialBold
FontSize: Enum.FontSize.Size36
BackgroundTransparency: 1
Text: "Hello I'm a popup"
TextColor3: Color3.new 248 / 255, 248 / 255, 248 / 255
TextWrap: true
ZIndex: 5
* New "TextButton", "AcceptButton"
Position: UDim2.new 0, 20, 0, 270
Size: UDim2.new 0, 100, 0, 50
Font: Enum.Font.ArialBold
FontSize: Enum.FontSize.Size24
Style: Enum.ButtonStyle.RobloxButton
TextColor3: Color3.new 248 / 255, 248 / 255, 248 / 255
Text: "Yes"
ZIndex: 5
* New "ImageLabel", "PopupImage"
BackgroundTransparency: 1
Position: UDim2.new 0.5, -140, 0, 0
Size: UDim2.new 0, 280, 0, 280
ZIndex: 3
* New "ImageLabel", "Backing"
BackgroundTransparency: 1
Size: UDim2.new 1, 0, 1, 0
Image: "http://www.roblox.com/asset/?id=47574181"
ZIndex: 2
:AcceptButton = popupFrame
with popupFrame\clone!
.Name = "Darken"
.Size = UDim2.new 1, 16, 1, 16
.Position = UDim2.new 0, -8, 0, -8
.ZIndex = 1
.Parent = popupFrame
with AcceptButton\clone!
.Name = "DeclineButton"
.Position = UDim2.new 1, -120, 0, 270
.Text = "No"
.Parent = popupFrame
with AcceptButton\clone!
.Name = "OKButton"
.Text = "OK"
.Position = UDim2.new 0.5, -50, 0, 270
.Visible = false
.Parent = popupFrame
script\remove!

View File

@ -1,7 +1,7 @@
local deepakTestingPlace = 3569749
local sc = game:GetService("ScriptContext")
local tries = 0
while not sc and tries < 3 do
while not (sc or tries > 2) do
tries = tries + 1
sc = game:GetService("ScriptContext")
wait(0.2)
@ -14,7 +14,8 @@ if sc then
end
sc:RegisterLibrary("Libraries/RbxUtility", "60595411")
sc:RegisterLibrary("Libraries/RbxStamper", "73157242")
return sc:LibraryRegistrationComplete()
sc:LibraryRegistrationComplete()
else
return print("failed to find script context, libraries did not load")
print("failed to find script context, libraries did not load")
end
return sc

View File

@ -6,21 +6,21 @@ deepakTestingPlace = 3569749
sc = game\GetService "ScriptContext"
tries = 0
while not sc and tries < 3
until sc or tries > 2
tries += 1
sc = game\GetService "ScriptContext"
wait 0.2
if sc
sc\RegisterLibrary "Libraries/RbxGui", "45284430"
sc\RegisterLibrary "Libraries/RbxGear", "45374389"
with sc do if sc
\RegisterLibrary "Libraries/RbxGui", "45284430"
\RegisterLibrary "Libraries/RbxGear", "45374389"
if game.PlaceId == deepakTestingPlace
sc\RegisterLibrary "Libraries/RbxStatus", "52177566"
\RegisterLibrary "Libraries/RbxStatus", "52177566"
sc\RegisterLibrary "Libraries/RbxUtility", "60595411"
sc\RegisterLibrary "Libraries/RbxStamper", "73157242"
sc\LibraryRegistrationComplete!
\RegisterLibrary "Libraries/RbxUtility", "60595411"
\RegisterLibrary "Libraries/RbxStamper", "73157242"
\LibraryRegistrationComplete!
else
print "failed to find script context, libraries did not load"