GAH
This commit is contained in:
parent
21e3164e3a
commit
8aa3b2e921
|
|
@ -1,15 +1,22 @@
|
||||||
|
1.3 Snapshot v22.8341.26380.2
|
||||||
|
Fixes:
|
||||||
|
- Fixed 2011M not being able to load.
|
||||||
|
- Fixed Dialogs not working in 2011E-2012M clients in multiplayer games.
|
||||||
|
----------------------------------------------------------------------------
|
||||||
1.3 Snapshot v22.8341.26380.1
|
1.3 Snapshot v22.8341.26380.1
|
||||||
Enhancements:
|
Enhancements:
|
||||||
- Upgraded to .NET Framework 4.8!
|
- Upgraded to .NET Framework 4.8!
|
||||||
- Note that .NET Framework 4.0 binaries will be provided upon release.
|
- Note that .NET Framework 4.0 binaries will be provided upon release.
|
||||||
- Re-added 2012M.
|
- Re-added 2012M.
|
||||||
- Fixed an issue where Dialogs didn't work in 2012M.
|
|
||||||
- Fixed an issue where Backpacks get wiped upon respawn in 2012M.
|
|
||||||
- Dialogs are now visible in Studio in 2011E-2012M!
|
- Dialogs are now visible in Studio in 2011E-2012M!
|
||||||
- "Dialogs will load, but are unusable. I'm assuming you're running Studio. If you're not, you may have to reinstall Novetus." - The Wise Novetus Studio Console Output.
|
- "Dialogs will load, but are unusable. I'm assuming you're running Studio. If you're not, you may have to reinstall Novetus." - The Wise Novetus Studio Console Output.
|
||||||
- Novetus now has support for compressed BZip2 files for maps!
|
- Novetus now has support for compressed BZip2 files for maps!
|
||||||
- All maps have been compressed.
|
- All maps have been compressed.
|
||||||
- Novetus' console now prints out the outcome for Asset Fixer and Asset Downloader downloads.
|
- Novetus' console now prints out the outcome for Asset Fixer and Asset Downloader downloads.
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
- Fixed an issue where Dialogs didn't work in 2012M.
|
||||||
|
- Fixed an issue where Backpacks get wiped upon respawn in 2012M.
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
1.3 Snapshot v22.8337.30163.1
|
1.3 Snapshot v22.8337.30163.1
|
||||||
Enhancements:
|
Enhancements:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
dofile("rbxasset://scripts\\cores\\StarterScript.lua")
|
|
||||||
|
|
||||||
showServerNotifications = true
|
showServerNotifications = true
|
||||||
|
|
||||||
pcall(function() settings().Diagnostics:LegacyScriptMode() end)
|
pcall(function() settings().Diagnostics:LegacyScriptMode() end)
|
||||||
|
|
@ -586,6 +584,7 @@ print("ROBLOX Client version '" .. rbxversion .. "' loaded.")
|
||||||
function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Notifications,ValidatedScripts)
|
function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Notifications,ValidatedScripts)
|
||||||
pcall(function() dofile("rbxasset://..//..//..//addons//core//AddonLoader.lua") end)
|
pcall(function() dofile("rbxasset://..//..//..//addons//core//AddonLoader.lua") end)
|
||||||
pcall(function() _G.CSScript_PreInit("Server", "2011E") end)
|
pcall(function() _G.CSScript_PreInit("Server", "2011E") end)
|
||||||
|
dofile("rbxasset://scripts\\cores\\StarterScriptServer.lua")
|
||||||
assert((type(Port)~="number" or tonumber(Port)~=nil or Port==nil),"CSRun Error: Port must be nil or a number.")
|
assert((type(Port)~="number" or tonumber(Port)~=nil or Port==nil),"CSRun Error: Port must be nil or a number.")
|
||||||
local NetworkServer=game:GetService("NetworkServer")
|
local NetworkServer=game:GetService("NetworkServer")
|
||||||
local RunService = game:GetService("RunService")
|
local RunService = game:GetService("RunService")
|
||||||
|
|
@ -682,6 +681,7 @@ end
|
||||||
|
|
||||||
function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Tripcode,ValidatedScripts,Ticket)
|
function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Tripcode,ValidatedScripts,Ticket)
|
||||||
pcall(function() game:SetPlaceID(-1, false) end)
|
pcall(function() game:SetPlaceID(-1, false) end)
|
||||||
|
dofile("rbxasset://scripts\\cores\\StarterScript.lua")
|
||||||
pcall(function() game:GetService("Players"):SetChatStyle(Enum.ChatStyle.ClassicAndBubble) end)
|
pcall(function() game:GetService("Players"):SetChatStyle(Enum.ChatStyle.ClassicAndBubble) end)
|
||||||
|
|
||||||
pcall(function()
|
pcall(function()
|
||||||
|
|
@ -797,6 +797,7 @@ end
|
||||||
function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID)
|
function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID)
|
||||||
pcall(function() dofile("rbxasset://..//..//..//addons//core//AddonLoader.lua") end)
|
pcall(function() dofile("rbxasset://..//..//..//addons//core//AddonLoader.lua") end)
|
||||||
pcall(function() _G.CSScript_PreInit("Solo", "2011E") end)
|
pcall(function() _G.CSScript_PreInit("Solo", "2011E") end)
|
||||||
|
dofile("rbxasset://scripts\\cores\\StarterScript.lua")
|
||||||
game:GetService("RunService"):Run()
|
game:GetService("RunService"):Run()
|
||||||
local plr = game.Players:CreateLocalPlayer(UserID)
|
local plr = game.Players:CreateLocalPlayer(UserID)
|
||||||
plr.Name = PlayerName
|
plr.Name = PlayerName
|
||||||
|
|
@ -844,6 +845,7 @@ end
|
||||||
function CSStudio()
|
function CSStudio()
|
||||||
pcall(function() dofile("rbxasset://..//..//..//addons//core//AddonLoader.lua") end)
|
pcall(function() dofile("rbxasset://..//..//..//addons//core//AddonLoader.lua") end)
|
||||||
pcall(function() _G.CSScript_PreInit("Studio", "2011E") end)
|
pcall(function() _G.CSScript_PreInit("Studio", "2011E") end)
|
||||||
|
dofile("rbxasset://scripts\\cores\\StarterScriptStudio.lua")
|
||||||
pcall(function() _G.CSScript_PostInit() end)
|
pcall(function() _G.CSScript_PostInit() end)
|
||||||
coroutine.resume(coroutine.create(function()
|
coroutine.resume(coroutine.create(function()
|
||||||
while true do
|
while true do
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ local characterWanderedOffSize = 350
|
||||||
local conversationTimedOut = "Chat ended because you didn't reply"
|
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||||
local conversationTimedOutSize = 350
|
local conversationTimedOutSize = 350
|
||||||
|
|
||||||
local isInStudio = false
|
|
||||||
local player
|
local player
|
||||||
local screenGui
|
local screenGui
|
||||||
local chatNotificationGui
|
local chatNotificationGui
|
||||||
|
|
@ -426,11 +425,6 @@ function checkForLeaveArea()
|
||||||
end
|
end
|
||||||
|
|
||||||
function startDialog(dialog)
|
function startDialog(dialog)
|
||||||
if isInStudio then
|
|
||||||
delay(1, checkForLeaveArea)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||||
|
|
@ -513,20 +507,12 @@ function fetchScripts()
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
Script = game.Lighting:FindFirstChild("ScriptLoaded")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
if Script == nil then
|
player = game.Players.LocalPlayer
|
||||||
isInStudio = true
|
waitForProperty(player, "Character")
|
||||||
print("Dialogs will load, but are unusable. I'm assuming you're running Studio. If you're not, you may have to reinstall Novetus.")
|
|
||||||
end
|
|
||||||
|
|
||||||
if isInStudio == false then
|
--print("Fetching Scripts")
|
||||||
waitForProperty(game.Players, "LocalPlayer")
|
fetchScripts()
|
||||||
player = game.Players.LocalPlayer
|
|
||||||
waitForProperty(player, "Character")
|
|
||||||
|
|
||||||
--print("Fetching Scripts")
|
|
||||||
fetchScripts()
|
|
||||||
end
|
|
||||||
|
|
||||||
--print("Creating Guis")
|
--print("Creating Guis")
|
||||||
createChatNotificationGui()
|
createChatNotificationGui()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,530 @@
|
||||||
|
delay(0, function()
|
||||||
|
|
||||||
|
function waitForProperty(instance, name)
|
||||||
|
while not instance[name] do
|
||||||
|
instance.Changed:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function waitForChild(instance, name)
|
||||||
|
while not instance:FindFirstChild(name) do
|
||||||
|
instance.ChildAdded:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local mainFrame
|
||||||
|
local choices = {}
|
||||||
|
local lastChoice
|
||||||
|
local choiceMap = {}
|
||||||
|
local currentConversationDialog
|
||||||
|
local currentConversationPartner
|
||||||
|
local currentAbortDialogScript
|
||||||
|
|
||||||
|
local tooFarAwayMessage = "You are too far away to chat!"
|
||||||
|
local tooFarAwaySize = 300
|
||||||
|
local characterWanderedOffMessage = "Chat ended because you walked away"
|
||||||
|
local characterWanderedOffSize = 350
|
||||||
|
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||||
|
local conversationTimedOutSize = 350
|
||||||
|
|
||||||
|
local player
|
||||||
|
local screenGui
|
||||||
|
local chatNotificationGui
|
||||||
|
local messageDialog
|
||||||
|
local timeoutScript
|
||||||
|
local reenableDialogScript
|
||||||
|
local dialogMap = {}
|
||||||
|
local dialogConnections = {}
|
||||||
|
|
||||||
|
function currentTone()
|
||||||
|
if currentConversationDialog then
|
||||||
|
return currentConversationDialog.Tone
|
||||||
|
else
|
||||||
|
return Enum.DialogTone.Neutral
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function createChatNotificationGui()
|
||||||
|
chatNotificationGui = Instance.new("BillboardGui")
|
||||||
|
chatNotificationGui.Name = "ChatNotificationGui"
|
||||||
|
chatNotificationGui.ExtentsOffset = Vector3.new(0,1,0)
|
||||||
|
chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0)
|
||||||
|
chatNotificationGui.SizeOffset = Vector2.new(0,0)
|
||||||
|
chatNotificationGui.StudsOffset = Vector3.new(0.4, 4.3, 0)
|
||||||
|
chatNotificationGui.Enabled = true
|
||||||
|
chatNotificationGui.RobloxLocked = true
|
||||||
|
chatNotificationGui.Active = true
|
||||||
|
|
||||||
|
local image = Instance.new("ImageLabel")
|
||||||
|
image.Name = "Image"
|
||||||
|
image.Active = false
|
||||||
|
image.BackgroundTransparency = 1
|
||||||
|
image.Position = UDim2.new(0,0,0,0)
|
||||||
|
image.Size = UDim2.new(1.0,0,1.0,0)
|
||||||
|
image.Image = ""
|
||||||
|
image.RobloxLocked = true
|
||||||
|
image.Parent = chatNotificationGui
|
||||||
|
|
||||||
|
|
||||||
|
local button = Instance.new("ImageButton")
|
||||||
|
button.Name = "Button"
|
||||||
|
button.AutoButtonColor = false
|
||||||
|
button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0)
|
||||||
|
button.Size = UDim2.new(0.829999983, 0, 0.460000008, 0)
|
||||||
|
button.Image = ""
|
||||||
|
button.BackgroundTransparency = 1
|
||||||
|
button.RobloxLocked = true
|
||||||
|
button.Parent = image
|
||||||
|
end
|
||||||
|
|
||||||
|
function getChatColor(tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
return Enum.ChatColor.Blue
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
return Enum.ChatColor.Green
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
return Enum.ChatColor.Red
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function styleChoices(tone)
|
||||||
|
for i, obj in pairs(choices) do
|
||||||
|
resetColor(obj, tone)
|
||||||
|
end
|
||||||
|
resetColor(lastChoice, tone)
|
||||||
|
end
|
||||||
|
|
||||||
|
function styleMainFrame(tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatGreen
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botGreen_tailRight.png"
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatRed
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botRed_tailRight.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
styleChoices(tone)
|
||||||
|
end
|
||||||
|
function setChatNotificationTone(gui, purpose, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png"
|
||||||
|
end
|
||||||
|
if purpose == Enum.DialogPurpose.Quest then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_bang.png"
|
||||||
|
elseif purpose == Enum.DialogPurpose.Help then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_question.png"
|
||||||
|
elseif purpose == Enum.DialogPurpose.Shop then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_money.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function createMessageDialog()
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
function 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
|
||||||
|
end
|
||||||
|
|
||||||
|
function variableDelay(str)
|
||||||
|
local length = math.min(string.len(str), 100)
|
||||||
|
wait(0.75 + ((length/75) * 1.5))
|
||||||
|
end
|
||||||
|
|
||||||
|
function resetColor(frame, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(45/255, 142/255, 245/255)
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 77/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(0/255, 190/255, 0/255)
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
frame.BackgroundColor3 = Color3.new(140/255, 0/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(255/255,88/255, 79/255)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function highlightColor(frame, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
frame.BackgroundColor3 = Color3.new(2/255, 108/255, 255/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 128/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
frame.BackgroundColor3 = Color3.new(204/255, 0/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function wanderDialog()
|
||||||
|
print("Wander")
|
||||||
|
mainFrame.Visible = false
|
||||||
|
endDialog()
|
||||||
|
showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
||||||
|
end
|
||||||
|
|
||||||
|
function timeoutDialog()
|
||||||
|
print("Timeout")
|
||||||
|
mainFrame.Visible = false
|
||||||
|
endDialog()
|
||||||
|
showMessage(conversationTimedOut, conversationTimedOutSize)
|
||||||
|
end
|
||||||
|
function normalEndDialog()
|
||||||
|
print("Done")
|
||||||
|
endDialog()
|
||||||
|
end
|
||||||
|
|
||||||
|
function endDialog()
|
||||||
|
if currentAbortDialogScript then
|
||||||
|
currentAbortDialogScript:Remove()
|
||||||
|
currentAbortDialogScript = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local dialog = currentConversationDialog
|
||||||
|
currentConversationDialog = nil
|
||||||
|
if dialog and dialog.InUse then
|
||||||
|
local reenableScript = reenableDialogScript:Clone()
|
||||||
|
reenableScript.archivable = false
|
||||||
|
reenableScript.Disabled = false
|
||||||
|
reenableScript.Parent = dialog
|
||||||
|
end
|
||||||
|
|
||||||
|
for dialog, gui in pairs(dialogMap) do
|
||||||
|
if dialog and gui then
|
||||||
|
gui.Enabled = not dialog.InUse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationPartner = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function sanitizeMessage(msg)
|
||||||
|
if string.len(msg) == 0 then
|
||||||
|
return "..."
|
||||||
|
else
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function selectChoice(choice)
|
||||||
|
renewKillswitch(currentConversationDialog)
|
||||||
|
|
||||||
|
--First hide the Gui
|
||||||
|
mainFrame.Visible = false
|
||||||
|
if choice == lastChoice then
|
||||||
|
game.Chat:Chat(game.Players.LocalPlayer.Character, "Goodbye!", getChatColor(currentTone()))
|
||||||
|
|
||||||
|
normalEndDialog()
|
||||||
|
else
|
||||||
|
local dialogChoice = choiceMap[choice]
|
||||||
|
|
||||||
|
game.Chat:Chat(game.Players.LocalPlayer.Character, sanitizeMessage(dialogChoice.UserDialog), getChatColor(currentTone()))
|
||||||
|
wait(1)
|
||||||
|
currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice)
|
||||||
|
game.Chat:Chat(currentConversationPartner, sanitizeMessage(dialogChoice.ResponseDialog), getChatColor(currentTone()))
|
||||||
|
|
||||||
|
variableDelay(dialogChoice.ResponseDialog)
|
||||||
|
presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function newChoice(numberText)
|
||||||
|
local frame = Instance.new("TextButton")
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255)
|
||||||
|
frame.AutoButtonColor = false
|
||||||
|
frame.BorderSizePixel = 0
|
||||||
|
frame.Text = ""
|
||||||
|
frame.MouseEnter:connect(function() highlightColor(frame, currentTone()) end)
|
||||||
|
frame.MouseLeave:connect(function() resetColor(frame, currentTone()) end)
|
||||||
|
frame.MouseButton1Click:connect(function() 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
|
||||||
|
function initialize(parent)
|
||||||
|
choices[1] = newChoice("1)")
|
||||||
|
choices[2] = newChoice("2)")
|
||||||
|
choices[3] = newChoice("3)")
|
||||||
|
choices[4] = newChoice("4)")
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
for n, obj in pairs(choices) do
|
||||||
|
obj.RobloxLocked = true
|
||||||
|
obj.Parent = mainFrame
|
||||||
|
end
|
||||||
|
lastChoice.RobloxLocked = true
|
||||||
|
lastChoice.Parent = mainFrame
|
||||||
|
|
||||||
|
mainFrame.RobloxLocked = true
|
||||||
|
mainFrame.Parent = parent
|
||||||
|
end
|
||||||
|
|
||||||
|
function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
|
if not currentConversationDialog then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationPartner = talkingPart
|
||||||
|
sortedDialogChoices = {}
|
||||||
|
for n, obj in pairs(dialogChoices) do
|
||||||
|
if obj:IsA("DialogChoice") then
|
||||||
|
table.insert(sortedDialogChoices, obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(sortedDialogChoices, function(a,b) return a.Name < b.Name end)
|
||||||
|
|
||||||
|
if #sortedDialogChoices == 0 then
|
||||||
|
normalEndDialog()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = 1
|
||||||
|
local yPosition = 0
|
||||||
|
choiceMap = {}
|
||||||
|
for n, obj in pairs(choices) do
|
||||||
|
obj.Visible = false
|
||||||
|
end
|
||||||
|
|
||||||
|
for n, obj in pairs(sortedDialogChoices) do
|
||||||
|
if pos <= #choices then
|
||||||
|
--3 lines is the maximum, set it to that temporarily
|
||||||
|
choices[pos].Size = UDim2.new(1, 0, 0, 24*3)
|
||||||
|
choices[pos].UserPrompt.Text = obj.UserDialog
|
||||||
|
local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y/24)*24
|
||||||
|
|
||||||
|
choices[pos].Position = UDim2.new(0, 0, 0, yPosition)
|
||||||
|
choices[pos].Size = UDim2.new(1, 0, 0, height)
|
||||||
|
choices[pos].Visible = true
|
||||||
|
|
||||||
|
choiceMap[choices[pos]] = obj
|
||||||
|
|
||||||
|
yPosition = yPosition + height
|
||||||
|
pos = pos + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
lastChoice.Position = UDim2.new(0,0,0,yPosition)
|
||||||
|
lastChoice.Number.Text = pos .. ")"
|
||||||
|
|
||||||
|
mainFrame.Size = UDim2.new(0, 350, 0, yPosition+24+32)
|
||||||
|
mainFrame.Position = UDim2.new(0,20,0.0, -mainFrame.Size.Y.Offset-20)
|
||||||
|
styleMainFrame(currentTone())
|
||||||
|
mainFrame.Visible = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function doDialog(dialog)
|
||||||
|
while not Instance.Lock(dialog, player) do
|
||||||
|
wait()
|
||||||
|
end
|
||||||
|
|
||||||
|
if dialog.InUse then
|
||||||
|
Instance.Unlock(dialog)
|
||||||
|
return
|
||||||
|
else
|
||||||
|
dialog.InUse = true
|
||||||
|
Instance.Unlock(dialog)
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationDialog = dialog
|
||||||
|
game.Chat:Chat(dialog.Parent, dialog.InitialPrompt, getChatColor(dialog.Tone))
|
||||||
|
variableDelay(dialog.InitialPrompt)
|
||||||
|
|
||||||
|
presentDialogChoices(dialog.Parent, dialog:GetChildren())
|
||||||
|
end
|
||||||
|
|
||||||
|
function renewKillswitch(dialog)
|
||||||
|
if currentAbortDialogScript then
|
||||||
|
currentAbortDialogScript:Remove()
|
||||||
|
currentAbortDialogScript = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
currentAbortDialogScript = timeoutScript:Clone()
|
||||||
|
currentAbortDialogScript.archivable = false
|
||||||
|
currentAbortDialogScript.Disabled = false
|
||||||
|
currentAbortDialogScript.Parent = dialog
|
||||||
|
end
|
||||||
|
|
||||||
|
function checkForLeaveArea()
|
||||||
|
while currentConversationDialog do
|
||||||
|
if player:DistanceFromCharacter(currentConversationDialog.Parent.Position) >= currentConversationDialog.ConversationDistance then
|
||||||
|
wanderDialog()
|
||||||
|
end
|
||||||
|
wait(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function startDialog(dialog)
|
||||||
|
delay(1, checkForLeaveArea)
|
||||||
|
end
|
||||||
|
|
||||||
|
function removeDialog(dialog)
|
||||||
|
if dialogMap[dialog] then
|
||||||
|
dialogMap[dialog]:Remove()
|
||||||
|
dialogMap[dialog] = nil
|
||||||
|
end
|
||||||
|
if dialogConnections[dialog] then
|
||||||
|
dialogConnections[dialog]:disconnect()
|
||||||
|
dialogConnections[dialog] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function addDialog(dialog)
|
||||||
|
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||||
|
local chatGui = chatNotificationGui:clone()
|
||||||
|
chatGui.Enabled = not dialog.InUse
|
||||||
|
chatGui.Adornee = dialog.Parent
|
||||||
|
chatGui.RobloxLocked = true
|
||||||
|
chatGui.Parent = game.CoreGui
|
||||||
|
chatGui.Image.Button.MouseButton1Click:connect(function() startDialog(dialog) end)
|
||||||
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
|
|
||||||
|
dialogMap[dialog] = chatGui
|
||||||
|
|
||||||
|
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
||||||
|
if prop == "Parent" and dialog.Parent then
|
||||||
|
--This handles the reparenting case, seperate from removal case
|
||||||
|
removeDialog(dialog)
|
||||||
|
addDialog(dialog)
|
||||||
|
elseif prop == "InUse" then
|
||||||
|
chatGui.Enabled = not currentConversationDialog and not dialog.InUse
|
||||||
|
if dialog == currentConversationDialog then
|
||||||
|
timeoutDialog()
|
||||||
|
end
|
||||||
|
elseif prop == "Tone" or prop == "Purpose" then
|
||||||
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function fetchScripts()
|
||||||
|
--[[--print("InsertService")
|
||||||
|
local model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
|
--print(model)
|
||||||
|
while type(model) == "string" do
|
||||||
|
--print("Trying again to fetch Scripts")
|
||||||
|
model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
|
end
|
||||||
|
timeoutScript = model.TimeoutScript
|
||||||
|
reenableDialogScript = model.ReenableDialogScript]]--
|
||||||
|
|
||||||
|
--if not game.Lighting:FindFirstChild("CoreDialogScripts") then
|
||||||
|
--game.Workspace:InsertContent("rbxasset://scripts\\cores\\MainBotSupport.rbxm")
|
||||||
|
--end
|
||||||
|
waitForChild(game.Lighting,"CoreDialogScripts")
|
||||||
|
local model = game.Lighting.CoreDialogScripts
|
||||||
|
waitForChild(model,"TimeoutScript")
|
||||||
|
timeoutScript = model.TimeoutScript:Clone()
|
||||||
|
waitForChild(model,"ReenableDialogScript")
|
||||||
|
reenableDialogScript = model.ReenableDialogScript:Clone()
|
||||||
|
end
|
||||||
|
|
||||||
|
function onLoad()
|
||||||
|
--print("Creating Guis")
|
||||||
|
createChatNotificationGui()
|
||||||
|
|
||||||
|
--print("Waiting for RobloxGui")
|
||||||
|
waitForChild(game.CoreGui, "RobloxGui")
|
||||||
|
|
||||||
|
--print("Creating MessageDialog")
|
||||||
|
createMessageDialog()
|
||||||
|
messageDialog.RobloxLocked = true
|
||||||
|
messageDialog.Parent = game.CoreGui.RobloxGui
|
||||||
|
|
||||||
|
--print("Waiting for BottomLeftControl")
|
||||||
|
waitForChild(game.CoreGui.RobloxGui, "BottomLeftControl")
|
||||||
|
|
||||||
|
--print("Initializing Frame")
|
||||||
|
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 = game.CoreGui.RobloxGui.BottomLeftControl
|
||||||
|
initialize(frame)
|
||||||
|
|
||||||
|
--print("Adding Dialogs")
|
||||||
|
game.CollectionService.ItemAdded:connect(function(obj) if obj:IsA("Dialog") then addDialog(obj) end end)
|
||||||
|
game.CollectionService.ItemRemoved:connect(function(obj) if obj:IsA("Dialog") then removeDialog(obj) end end)
|
||||||
|
for i, obj in pairs(game.CollectionService:GetCollection("Dialog")) do
|
||||||
|
if obj:IsA("Dialog") then
|
||||||
|
addDialog(obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
onLoad()
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
||||||
|
-- Created by Ben T. 10/29/10
|
||||||
|
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
||||||
|
|
||||||
|
delay(0, function()
|
||||||
|
|
||||||
|
local function waitForChild(instance, name)
|
||||||
|
while not instance:FindFirstChild(name) do
|
||||||
|
instance.ChildAdded:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function waitForProperty(instance, property)
|
||||||
|
while not instance[property] do
|
||||||
|
instance.Changed:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
waitForChild(game:GetService("CoreGui"),"RobloxGui")
|
||||||
|
local screenGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
||||||
|
|
||||||
|
local scriptContext = game:GetService("ScriptContext")
|
||||||
|
|
||||||
|
-- Resizer (dynamically resizes gui)
|
||||||
|
dofile("rbxasset://scripts\\cores\\Resizer.lua")
|
||||||
|
|
||||||
|
-- SubMenuBuilder (builds out the material,surface and color panels)
|
||||||
|
dofile("rbxasset://scripts\\cores\\SubMenuBuilder.lua")
|
||||||
|
|
||||||
|
-- ToolTipper (creates tool tips for gui)
|
||||||
|
dofile("rbxasset://scripts\\cores\\ToolTipper.lua")
|
||||||
|
|
||||||
|
--[[-- (controls the movement and selection of sub panels)
|
||||||
|
-- PaintMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040464,screenGui.BuildTools.Frame.PropertyTools.PaintTool,"PaintMenuMover")
|
||||||
|
-- MaterialMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040495,screenGui.BuildTools.Frame.PropertyTools.MaterialSelector,"MaterialMenuMover")
|
||||||
|
-- InputMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040483,screenGui.BuildTools.Frame.PropertyTools.InputSelector,"InputMenuMover")]]--
|
||||||
|
|
||||||
|
-- SettingsScript
|
||||||
|
dofile("rbxasset://scripts\\cores\\SettingsScript.lua")
|
||||||
|
|
||||||
|
-- MainChatScript
|
||||||
|
dofile("rbxasset://scripts\\cores\\MainBotChatScriptStudio.lua")
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
||||||
|
-- Created by Ben T. 10/29/10
|
||||||
|
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
||||||
|
|
||||||
|
delay(0, function()
|
||||||
|
|
||||||
|
local function waitForChild(instance, name)
|
||||||
|
while not instance:FindFirstChild(name) do
|
||||||
|
instance.ChildAdded:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function waitForProperty(instance, property)
|
||||||
|
while not instance[property] do
|
||||||
|
instance.Changed:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
waitForChild(game:GetService("CoreGui"),"RobloxGui")
|
||||||
|
local screenGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
||||||
|
|
||||||
|
local scriptContext = game:GetService("ScriptContext")
|
||||||
|
|
||||||
|
-- Resizer (dynamically resizes gui)
|
||||||
|
dofile("rbxasset://scripts\\cores\\Resizer.lua")
|
||||||
|
|
||||||
|
-- SubMenuBuilder (builds out the material,surface and color panels)
|
||||||
|
dofile("rbxasset://scripts\\cores\\SubMenuBuilder.lua")
|
||||||
|
|
||||||
|
-- ToolTipper (creates tool tips for gui)
|
||||||
|
dofile("rbxasset://scripts\\cores\\ToolTipper.lua")
|
||||||
|
|
||||||
|
--[[-- (controls the movement and selection of sub panels)
|
||||||
|
-- PaintMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040464,screenGui.BuildTools.Frame.PropertyTools.PaintTool,"PaintMenuMover")
|
||||||
|
-- MaterialMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040495,screenGui.BuildTools.Frame.PropertyTools.MaterialSelector,"MaterialMenuMover")
|
||||||
|
-- InputMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040483,screenGui.BuildTools.Frame.PropertyTools.InputSelector,"InputMenuMover")]]--
|
||||||
|
|
||||||
|
-- SettingsScript
|
||||||
|
dofile("rbxasset://scripts\\cores\\SettingsScript.lua")
|
||||||
|
|
||||||
|
-- MainChatScript
|
||||||
|
dofile("rbxasset://scripts\\cores\\MainBotChatScriptStudio.lua")
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
@ -864,7 +864,7 @@ function CSStudio(NewGUI)
|
||||||
end
|
end
|
||||||
game:SetPlaceID(id, false)
|
game:SetPlaceID(id, false)
|
||||||
end)
|
end)
|
||||||
dofile("rbxasset://scripts\\cores\\StarterScript.lua")
|
dofile("rbxasset://scripts\\cores\\StarterScriptStudio.lua")
|
||||||
pcall(function() _G.CSScript_PostInit() end)
|
pcall(function() _G.CSScript_PostInit() end)
|
||||||
coroutine.resume(coroutine.create(function()
|
coroutine.resume(coroutine.create(function()
|
||||||
while true do
|
while true do
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ local characterWanderedOffSize = 350
|
||||||
local conversationTimedOut = "Chat ended because you didn't reply"
|
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||||
local conversationTimedOutSize = 350
|
local conversationTimedOutSize = 350
|
||||||
|
|
||||||
local isInStudio = false
|
|
||||||
local player
|
local player
|
||||||
local screenGui
|
local screenGui
|
||||||
local chatNotificationGui
|
local chatNotificationGui
|
||||||
|
|
@ -436,11 +435,6 @@ function checkForLeaveArea()
|
||||||
end
|
end
|
||||||
|
|
||||||
function startDialog(dialog)
|
function startDialog(dialog)
|
||||||
if isInStudio then
|
|
||||||
delay(1, checkForLeaveArea)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||||
|
|
@ -526,20 +520,12 @@ function fetchScripts()
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
Script = game.Lighting:FindFirstChild("ScriptLoaded")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
if Script == nil then
|
player = game.Players.LocalPlayer
|
||||||
isInStudio = true
|
waitForProperty(player, "Character")
|
||||||
print("Dialogs will load, but are unusable. I'm assuming you're running Studio. If you're not, you may have to reinstall Novetus.")
|
|
||||||
end
|
|
||||||
|
|
||||||
if isInStudio == false then
|
--print("Fetching Scripts")
|
||||||
waitForProperty(game.Players, "LocalPlayer")
|
fetchScripts()
|
||||||
player = game.Players.LocalPlayer
|
|
||||||
waitForProperty(player, "Character")
|
|
||||||
|
|
||||||
--print("Fetching Scripts")
|
|
||||||
fetchScripts()
|
|
||||||
end
|
|
||||||
|
|
||||||
--print("Creating Guis")
|
--print("Creating Guis")
|
||||||
createChatNotificationGui()
|
createChatNotificationGui()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,540 @@
|
||||||
|
delay(0, function()
|
||||||
|
|
||||||
|
function waitForProperty(instance, name)
|
||||||
|
while not instance[name] do
|
||||||
|
instance.Changed:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function waitForChild(instance, name)
|
||||||
|
while not instance:FindFirstChild(name) do
|
||||||
|
instance.ChildAdded:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local mainFrame
|
||||||
|
local choices = {}
|
||||||
|
local lastChoice
|
||||||
|
local choiceMap = {}
|
||||||
|
local currentConversationDialog
|
||||||
|
local currentConversationPartner
|
||||||
|
local currentAbortDialogScript
|
||||||
|
|
||||||
|
local tooFarAwayMessage = "You are too far away to chat!"
|
||||||
|
local tooFarAwaySize = 300
|
||||||
|
local characterWanderedOffMessage = "Chat ended because you walked away"
|
||||||
|
local characterWanderedOffSize = 350
|
||||||
|
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||||
|
local conversationTimedOutSize = 350
|
||||||
|
|
||||||
|
local player
|
||||||
|
local screenGui
|
||||||
|
local chatNotificationGui
|
||||||
|
local messageDialog
|
||||||
|
local timeoutScript
|
||||||
|
local reenableDialogScript
|
||||||
|
local dialogMap = {}
|
||||||
|
local dialogConnections = {}
|
||||||
|
|
||||||
|
local gui = nil
|
||||||
|
waitForChild(game,"CoreGui")
|
||||||
|
waitForChild(game.CoreGui,"RobloxGui")
|
||||||
|
if game.CoreGui.RobloxGui:FindFirstChild("ControlFrame") then
|
||||||
|
gui = game.CoreGui.RobloxGui.ControlFrame
|
||||||
|
else
|
||||||
|
gui = game.CoreGui.RobloxGui
|
||||||
|
end
|
||||||
|
|
||||||
|
function currentTone()
|
||||||
|
if currentConversationDialog then
|
||||||
|
return currentConversationDialog.Tone
|
||||||
|
else
|
||||||
|
return Enum.DialogTone.Neutral
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function createChatNotificationGui()
|
||||||
|
chatNotificationGui = Instance.new("BillboardGui")
|
||||||
|
chatNotificationGui.Name = "ChatNotificationGui"
|
||||||
|
chatNotificationGui.ExtentsOffset = Vector3.new(0,1,0)
|
||||||
|
chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0)
|
||||||
|
chatNotificationGui.SizeOffset = Vector2.new(0,0)
|
||||||
|
chatNotificationGui.StudsOffset = Vector3.new(0.4, 4.3, 0)
|
||||||
|
chatNotificationGui.Enabled = true
|
||||||
|
chatNotificationGui.RobloxLocked = true
|
||||||
|
chatNotificationGui.Active = true
|
||||||
|
|
||||||
|
local image = Instance.new("ImageLabel")
|
||||||
|
image.Name = "Image"
|
||||||
|
image.Active = false
|
||||||
|
image.BackgroundTransparency = 1
|
||||||
|
image.Position = UDim2.new(0,0,0,0)
|
||||||
|
image.Size = UDim2.new(1.0,0,1.0,0)
|
||||||
|
image.Image = ""
|
||||||
|
image.RobloxLocked = true
|
||||||
|
image.Parent = chatNotificationGui
|
||||||
|
|
||||||
|
|
||||||
|
local button = Instance.new("ImageButton")
|
||||||
|
button.Name = "Button"
|
||||||
|
button.AutoButtonColor = false
|
||||||
|
button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0)
|
||||||
|
button.Size = UDim2.new(0.829999983, 0, 0.460000008, 0)
|
||||||
|
button.Image = ""
|
||||||
|
button.BackgroundTransparency = 1
|
||||||
|
button.RobloxLocked = true
|
||||||
|
button.Parent = image
|
||||||
|
end
|
||||||
|
|
||||||
|
function getChatColor(tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
return Enum.ChatColor.Blue
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
return Enum.ChatColor.Green
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
return Enum.ChatColor.Red
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function styleChoices(tone)
|
||||||
|
for i, obj in pairs(choices) do
|
||||||
|
resetColor(obj, tone)
|
||||||
|
end
|
||||||
|
resetColor(lastChoice, tone)
|
||||||
|
end
|
||||||
|
|
||||||
|
function styleMainFrame(tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatGreen
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botGreen_tailRight.png"
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatRed
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botRed_tailRight.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
styleChoices(tone)
|
||||||
|
end
|
||||||
|
function setChatNotificationTone(gui, purpose, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png"
|
||||||
|
end
|
||||||
|
if purpose == Enum.DialogPurpose.Quest then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_bang.png"
|
||||||
|
elseif purpose == Enum.DialogPurpose.Help then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_question.png"
|
||||||
|
elseif purpose == Enum.DialogPurpose.Shop then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_money.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function createMessageDialog()
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
function 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
|
||||||
|
end
|
||||||
|
|
||||||
|
function variableDelay(str)
|
||||||
|
local length = math.min(string.len(str), 100)
|
||||||
|
wait(0.75 + ((length/75) * 1.5))
|
||||||
|
end
|
||||||
|
|
||||||
|
function resetColor(frame, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(45/255, 142/255, 245/255)
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 77/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(0/255, 190/255, 0/255)
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
frame.BackgroundColor3 = Color3.new(140/255, 0/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(255/255,88/255, 79/255)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function highlightColor(frame, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
frame.BackgroundColor3 = Color3.new(2/255, 108/255, 255/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 128/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
frame.BackgroundColor3 = Color3.new(204/255, 0/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function wanderDialog()
|
||||||
|
print("Wander")
|
||||||
|
mainFrame.Visible = false
|
||||||
|
endDialog()
|
||||||
|
showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
||||||
|
end
|
||||||
|
|
||||||
|
function timeoutDialog()
|
||||||
|
print("Timeout")
|
||||||
|
mainFrame.Visible = false
|
||||||
|
endDialog()
|
||||||
|
showMessage(conversationTimedOut, conversationTimedOutSize)
|
||||||
|
end
|
||||||
|
function normalEndDialog()
|
||||||
|
print("Done")
|
||||||
|
endDialog()
|
||||||
|
end
|
||||||
|
|
||||||
|
function endDialog()
|
||||||
|
if currentAbortDialogScript then
|
||||||
|
currentAbortDialogScript:Remove()
|
||||||
|
currentAbortDialogScript = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local dialog = currentConversationDialog
|
||||||
|
currentConversationDialog = nil
|
||||||
|
if dialog and dialog.InUse then
|
||||||
|
local reenableScript = reenableDialogScript:Clone()
|
||||||
|
reenableScript.archivable = false
|
||||||
|
reenableScript.Disabled = false
|
||||||
|
reenableScript.Parent = dialog
|
||||||
|
end
|
||||||
|
|
||||||
|
for dialog, gui in pairs(dialogMap) do
|
||||||
|
if dialog and gui then
|
||||||
|
gui.Enabled = not dialog.InUse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationPartner = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function sanitizeMessage(msg)
|
||||||
|
if string.len(msg) == 0 then
|
||||||
|
return "..."
|
||||||
|
else
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function selectChoice(choice)
|
||||||
|
renewKillswitch(currentConversationDialog)
|
||||||
|
|
||||||
|
--First hide the Gui
|
||||||
|
mainFrame.Visible = false
|
||||||
|
if choice == lastChoice then
|
||||||
|
game.Chat:Chat(game.Players.LocalPlayer.Character, "Goodbye!", getChatColor(currentTone()))
|
||||||
|
|
||||||
|
normalEndDialog()
|
||||||
|
else
|
||||||
|
local dialogChoice = choiceMap[choice]
|
||||||
|
|
||||||
|
game.Chat:Chat(game.Players.LocalPlayer.Character, sanitizeMessage(dialogChoice.UserDialog), getChatColor(currentTone()))
|
||||||
|
wait(1)
|
||||||
|
currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice)
|
||||||
|
game.Chat:Chat(currentConversationPartner, sanitizeMessage(dialogChoice.ResponseDialog), getChatColor(currentTone()))
|
||||||
|
|
||||||
|
variableDelay(dialogChoice.ResponseDialog)
|
||||||
|
presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function newChoice(numberText)
|
||||||
|
local frame = Instance.new("TextButton")
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255)
|
||||||
|
frame.AutoButtonColor = false
|
||||||
|
frame.BorderSizePixel = 0
|
||||||
|
frame.Text = ""
|
||||||
|
frame.MouseEnter:connect(function() highlightColor(frame, currentTone()) end)
|
||||||
|
frame.MouseLeave:connect(function() resetColor(frame, currentTone()) end)
|
||||||
|
frame.MouseButton1Click:connect(function() 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
|
||||||
|
function initialize(parent)
|
||||||
|
choices[1] = newChoice("1)")
|
||||||
|
choices[2] = newChoice("2)")
|
||||||
|
choices[3] = newChoice("3)")
|
||||||
|
choices[4] = newChoice("4)")
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
for n, obj in pairs(choices) do
|
||||||
|
obj.RobloxLocked = true
|
||||||
|
obj.Parent = mainFrame
|
||||||
|
end
|
||||||
|
lastChoice.RobloxLocked = true
|
||||||
|
lastChoice.Parent = mainFrame
|
||||||
|
|
||||||
|
mainFrame.RobloxLocked = true
|
||||||
|
mainFrame.Parent = parent
|
||||||
|
end
|
||||||
|
|
||||||
|
function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
|
if not currentConversationDialog then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationPartner = talkingPart
|
||||||
|
sortedDialogChoices = {}
|
||||||
|
for n, obj in pairs(dialogChoices) do
|
||||||
|
if obj:IsA("DialogChoice") then
|
||||||
|
table.insert(sortedDialogChoices, obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(sortedDialogChoices, function(a,b) return a.Name < b.Name end)
|
||||||
|
|
||||||
|
if #sortedDialogChoices == 0 then
|
||||||
|
normalEndDialog()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = 1
|
||||||
|
local yPosition = 0
|
||||||
|
choiceMap = {}
|
||||||
|
for n, obj in pairs(choices) do
|
||||||
|
obj.Visible = false
|
||||||
|
end
|
||||||
|
|
||||||
|
for n, obj in pairs(sortedDialogChoices) do
|
||||||
|
if pos <= #choices then
|
||||||
|
--3 lines is the maximum, set it to that temporarily
|
||||||
|
choices[pos].Size = UDim2.new(1, 0, 0, 24*3)
|
||||||
|
choices[pos].UserPrompt.Text = obj.UserDialog
|
||||||
|
local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y/24)*24
|
||||||
|
|
||||||
|
choices[pos].Position = UDim2.new(0, 0, 0, yPosition)
|
||||||
|
choices[pos].Size = UDim2.new(1, 0, 0, height)
|
||||||
|
choices[pos].Visible = true
|
||||||
|
|
||||||
|
choiceMap[choices[pos]] = obj
|
||||||
|
|
||||||
|
yPosition = yPosition + height
|
||||||
|
pos = pos + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
lastChoice.Position = UDim2.new(0,0,0,yPosition)
|
||||||
|
lastChoice.Number.Text = pos .. ")"
|
||||||
|
|
||||||
|
mainFrame.Size = UDim2.new(0, 350, 0, yPosition+24+32)
|
||||||
|
mainFrame.Position = UDim2.new(0,20,0.0, -mainFrame.Size.Y.Offset-20)
|
||||||
|
styleMainFrame(currentTone())
|
||||||
|
mainFrame.Visible = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function doDialog(dialog)
|
||||||
|
while not Instance.Lock(dialog, player) do
|
||||||
|
wait()
|
||||||
|
end
|
||||||
|
|
||||||
|
if dialog.InUse then
|
||||||
|
Instance.Unlock(dialog)
|
||||||
|
return
|
||||||
|
else
|
||||||
|
dialog.InUse = true
|
||||||
|
Instance.Unlock(dialog)
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationDialog = dialog
|
||||||
|
game.Chat:Chat(dialog.Parent, dialog.InitialPrompt, getChatColor(dialog.Tone))
|
||||||
|
variableDelay(dialog.InitialPrompt)
|
||||||
|
|
||||||
|
presentDialogChoices(dialog.Parent, dialog:GetChildren())
|
||||||
|
end
|
||||||
|
|
||||||
|
function renewKillswitch(dialog)
|
||||||
|
if currentAbortDialogScript then
|
||||||
|
currentAbortDialogScript:Remove()
|
||||||
|
currentAbortDialogScript = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
currentAbortDialogScript = timeoutScript:Clone()
|
||||||
|
currentAbortDialogScript.archivable = false
|
||||||
|
currentAbortDialogScript.Disabled = false
|
||||||
|
currentAbortDialogScript.Parent = dialog
|
||||||
|
end
|
||||||
|
|
||||||
|
function checkForLeaveArea()
|
||||||
|
while currentConversationDialog do
|
||||||
|
if currentConversationDialog.Parent and (player:DistanceFromCharacter(currentConversationDialog.Parent.Position) >= currentConversationDialog.ConversationDistance) then
|
||||||
|
wanderDialog()
|
||||||
|
end
|
||||||
|
wait(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function startDialog(dialog)
|
||||||
|
delay(1, checkForLeaveArea)
|
||||||
|
end
|
||||||
|
|
||||||
|
function removeDialog(dialog)
|
||||||
|
if dialogMap[dialog] then
|
||||||
|
dialogMap[dialog]:Remove()
|
||||||
|
dialogMap[dialog] = nil
|
||||||
|
end
|
||||||
|
if dialogConnections[dialog] then
|
||||||
|
dialogConnections[dialog]:disconnect()
|
||||||
|
dialogConnections[dialog] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function addDialog(dialog)
|
||||||
|
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||||
|
local chatGui = chatNotificationGui:clone()
|
||||||
|
chatGui.Enabled = not dialog.InUse
|
||||||
|
chatGui.Adornee = dialog.Parent
|
||||||
|
chatGui.RobloxLocked = true
|
||||||
|
chatGui.Parent = game.CoreGui
|
||||||
|
chatGui.Image.Button.MouseButton1Click:connect(function() startDialog(dialog) end)
|
||||||
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
|
|
||||||
|
dialogMap[dialog] = chatGui
|
||||||
|
|
||||||
|
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
||||||
|
if prop == "Parent" and dialog.Parent then
|
||||||
|
--This handles the reparenting case, seperate from removal case
|
||||||
|
removeDialog(dialog)
|
||||||
|
addDialog(dialog)
|
||||||
|
elseif prop == "InUse" then
|
||||||
|
chatGui.Enabled = not currentConversationDialog and not dialog.InUse
|
||||||
|
if dialog == currentConversationDialog then
|
||||||
|
timeoutDialog()
|
||||||
|
end
|
||||||
|
elseif prop == "Tone" or prop == "Purpose" then
|
||||||
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function fetchScripts()
|
||||||
|
--[[local model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
|
if type(model) == "string" then -- load failed, lets try again
|
||||||
|
wait(0.1)
|
||||||
|
model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
|
end
|
||||||
|
if type(model) == "string" then -- not going to work, lets bail
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
waitForChild(model,"TimeoutScript")
|
||||||
|
timeoutScript = model.TimeoutScript
|
||||||
|
waitForChild(model,"ReenableDialogScript")
|
||||||
|
reenableDialogScript = model.ReenableDialogScript]]
|
||||||
|
--if not game.Lighting:FindFirstChild("CoreDialogScripts") then
|
||||||
|
--game.Workspace:InsertContent("rbxasset://scripts\\cores\\MainBotSupport.rbxm")
|
||||||
|
--end
|
||||||
|
waitForChild(game.Lighting,"CoreDialogScripts")
|
||||||
|
local model = game.Lighting.CoreDialogScripts
|
||||||
|
waitForChild(model,"TimeoutScript")
|
||||||
|
timeoutScript = model.TimeoutScript:Clone()
|
||||||
|
waitForChild(model,"ReenableDialogScript")
|
||||||
|
reenableDialogScript = model.ReenableDialogScript:Clone()
|
||||||
|
end
|
||||||
|
|
||||||
|
function onLoad()
|
||||||
|
--print("Creating Guis")
|
||||||
|
createChatNotificationGui()
|
||||||
|
|
||||||
|
--print("Creating MessageDialog")
|
||||||
|
createMessageDialog()
|
||||||
|
messageDialog.RobloxLocked = true
|
||||||
|
messageDialog.Parent = gui
|
||||||
|
|
||||||
|
--print("Waiting for BottomLeftControl")
|
||||||
|
waitForChild(gui, "BottomLeftControl")
|
||||||
|
|
||||||
|
--print("Initializing Frame")
|
||||||
|
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
|
||||||
|
initialize(frame)
|
||||||
|
|
||||||
|
--print("Adding Dialogs")
|
||||||
|
game.CollectionService.ItemAdded:connect(function(obj) if obj:IsA("Dialog") then addDialog(obj) end end)
|
||||||
|
game.CollectionService.ItemRemoved:connect(function(obj) if obj:IsA("Dialog") then removeDialog(obj) end end)
|
||||||
|
for i, obj in pairs(game.CollectionService:GetCollection("Dialog")) do
|
||||||
|
if obj:IsA("Dialog") then
|
||||||
|
addDialog(obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
onLoad()
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
@ -46,5 +46,5 @@ end]]
|
||||||
dofile("rbxasset://scripts\\cores\\SettingsScript.lua")
|
dofile("rbxasset://scripts\\cores\\SettingsScript.lua")
|
||||||
|
|
||||||
-- MainBotChatScript
|
-- MainBotChatScript
|
||||||
dofile("rbxasset://scripts\\cores\\MainBotChatScript.lua")
|
dofile("rbxasset://scripts\\cores\\MainBotChatScriptStudio.lua")
|
||||||
end)
|
end)
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
||||||
|
-- Created by Ben T. 10/29/10
|
||||||
|
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
||||||
|
|
||||||
|
delay(0, function()
|
||||||
|
|
||||||
|
print("Accurate CS by Matt Brown.")
|
||||||
|
|
||||||
|
local function waitForChild(instance, name)
|
||||||
|
while not instance:FindFirstChild(name) do
|
||||||
|
instance.ChildAdded:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function waitForProperty(instance, property)
|
||||||
|
while not instance[property] do
|
||||||
|
instance.Changed:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local backpackTestPlaces = {41324860,87241143,1818,65033,25415,14403,33913,21783593,17467963,3271,16184658}
|
||||||
|
|
||||||
|
waitForChild(game:GetService("CoreGui"),"RobloxGui")
|
||||||
|
local screenGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
||||||
|
|
||||||
|
local scriptContext = game:GetService("ScriptContext")
|
||||||
|
|
||||||
|
-- Resizer (dynamically resizes gui)
|
||||||
|
dofile("rbxasset://scripts\\cores\\Resizer.lua")
|
||||||
|
|
||||||
|
-- SubMenuBuilder (builds out the material,surface and color panels)
|
||||||
|
dofile("rbxasset://scripts\\cores\\SubMenuBuilder.lua")
|
||||||
|
|
||||||
|
-- ToolTipper (creates tool tips for gui)
|
||||||
|
dofile("rbxasset://scripts\\cores\\ToolTipper.lua")
|
||||||
|
|
||||||
|
--[[if game.CoreGui.Version < 2 then
|
||||||
|
-- (controls the movement and selection of sub panels)
|
||||||
|
-- PaintMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040464,screenGui.BuildTools.Frame.PropertyTools.PaintTool,"PaintMenuMover")
|
||||||
|
-- MaterialMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040495,screenGui.BuildTools.Frame.PropertyTools.MaterialSelector,"MaterialMenuMover")
|
||||||
|
-- InputMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040483,screenGui.BuildTools.Frame.PropertyTools.InputSelector,"InputMenuMover")
|
||||||
|
end]]
|
||||||
|
|
||||||
|
-- SettingsScript
|
||||||
|
dofile("rbxasset://scripts\\cores\\SettingsScript.lua")
|
||||||
|
|
||||||
|
-- MainBotChatScript
|
||||||
|
dofile("rbxasset://scripts\\cores\\MainBotChatScriptStudio.lua")
|
||||||
|
|
||||||
|
if game.CoreGui.Version >= 2 then
|
||||||
|
-- New Player List
|
||||||
|
dofile("rbxasset://scripts\\cores\\PlayerlistScript.lua")
|
||||||
|
-- Popup Script
|
||||||
|
dofile("rbxasset://scripts\\cores\\PopupScript.lua")
|
||||||
|
-- Friend Notification Script (probably can use this script to expand out to other notifications)
|
||||||
|
dofile("rbxasset://scripts\\cores\\NotificationScript.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
if game.CoreGui.Version >= 3 then
|
||||||
|
waitForProperty(game,"PlaceId")
|
||||||
|
local inRightPlace = false
|
||||||
|
for i,v in ipairs(backpackTestPlaces) do
|
||||||
|
if v == game.PlaceId then
|
||||||
|
inRightPlace = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
waitForChild(game,"Players")
|
||||||
|
waitForProperty(game.Players,"LocalPlayer")
|
||||||
|
if game.Players.LocalPlayer.userId == 7210880 or game.Players.LocalPlayer.userId == 0 then inRightPlace = true end
|
||||||
|
|
||||||
|
--if not inRightPlace then return end -- restricting availability of backpack
|
||||||
|
|
||||||
|
-- Backpack Builder
|
||||||
|
dofile("rbxasset://scripts\\cores\\BackpackBuilder.lua")
|
||||||
|
waitForChild(screenGui,"CurrentLoadout")
|
||||||
|
waitForChild(screenGui.CurrentLoadout,"TempSlot")
|
||||||
|
waitForChild(screenGui.CurrentLoadout.TempSlot,"SlotNumber")
|
||||||
|
-- Backpack Script
|
||||||
|
dofile("rbxasset://scripts\\cores\\BackpackScript.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
@ -842,7 +842,7 @@ function CSStudio(NewGUI)
|
||||||
pcall(function() dofile("rbxasset://..//..//..//addons//core//AddonLoader.lua") end)
|
pcall(function() dofile("rbxasset://..//..//..//addons//core//AddonLoader.lua") end)
|
||||||
pcall(function() _G.CSScript_PreInit("Studio", "2012M") end)
|
pcall(function() _G.CSScript_PreInit("Studio", "2012M") end)
|
||||||
pcall(function() game:SetPlaceID(-1, false) end)
|
pcall(function() game:SetPlaceID(-1, false) end)
|
||||||
dofile("rbxasset://scripts\\cores\\StarterScript.lua")
|
dofile("rbxasset://scripts\\cores\\StarterScriptStudio.lua")
|
||||||
pcall(function() _G.CSScript_PostInit() end)
|
pcall(function() _G.CSScript_PostInit() end)
|
||||||
coroutine.resume(coroutine.create(function()
|
coroutine.resume(coroutine.create(function()
|
||||||
while true do
|
while true do
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ local characterWanderedOffSize = 350
|
||||||
local conversationTimedOut = "Chat ended because you didn't reply"
|
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||||
local conversationTimedOutSize = 350
|
local conversationTimedOutSize = 350
|
||||||
|
|
||||||
local isInStudio = false
|
|
||||||
local player
|
local player
|
||||||
local screenGui
|
local screenGui
|
||||||
local chatNotificationGui
|
local chatNotificationGui
|
||||||
|
|
@ -437,11 +436,6 @@ function checkForLeaveArea()
|
||||||
end
|
end
|
||||||
|
|
||||||
function startDialog(dialog)
|
function startDialog(dialog)
|
||||||
if isInStudio then
|
|
||||||
delay(1, checkForLeaveArea)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||||
|
|
@ -527,20 +521,12 @@ function fetchScripts()
|
||||||
end
|
end
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
Script = game.Lighting:FindFirstChild("ScriptLoaded")
|
waitForProperty(game.Players, "LocalPlayer")
|
||||||
if Script == nil then
|
player = game.Players.LocalPlayer
|
||||||
isInStudio = true
|
waitForProperty(player, "Character")
|
||||||
print("Dialogs will load, but are unusable. I'm assuming you're running Studio. If you're not, you may have to reinstall Novetus.")
|
|
||||||
end
|
|
||||||
|
|
||||||
if isInStudio == false then
|
--print("Fetching Scripts")
|
||||||
waitForProperty(game.Players, "LocalPlayer")
|
fetchScripts()
|
||||||
player = game.Players.LocalPlayer
|
|
||||||
waitForProperty(player, "Character")
|
|
||||||
|
|
||||||
--print("Fetching Scripts")
|
|
||||||
fetchScripts()
|
|
||||||
end
|
|
||||||
|
|
||||||
--print("Creating Guis")
|
--print("Creating Guis")
|
||||||
createChatNotificationGui()
|
createChatNotificationGui()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,540 @@
|
||||||
|
delay(0, function()
|
||||||
|
|
||||||
|
function waitForProperty(instance, name)
|
||||||
|
while not instance[name] do
|
||||||
|
instance.Changed:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function waitForChild(instance, name)
|
||||||
|
while not instance:FindFirstChild(name) do
|
||||||
|
instance.ChildAdded:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local mainFrame
|
||||||
|
local choices = {}
|
||||||
|
local lastChoice
|
||||||
|
local choiceMap = {}
|
||||||
|
local currentConversationDialog
|
||||||
|
local currentConversationPartner
|
||||||
|
local currentAbortDialogScript
|
||||||
|
|
||||||
|
local tooFarAwayMessage = "You are too far away to chat!"
|
||||||
|
local tooFarAwaySize = 300
|
||||||
|
local characterWanderedOffMessage = "Chat ended because you walked away"
|
||||||
|
local characterWanderedOffSize = 350
|
||||||
|
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||||
|
local conversationTimedOutSize = 350
|
||||||
|
|
||||||
|
local player
|
||||||
|
local screenGui
|
||||||
|
local chatNotificationGui
|
||||||
|
local messageDialog
|
||||||
|
local timeoutScript
|
||||||
|
local reenableDialogScript
|
||||||
|
local dialogMap = {}
|
||||||
|
local dialogConnections = {}
|
||||||
|
|
||||||
|
local gui = nil
|
||||||
|
waitForChild(game,"CoreGui")
|
||||||
|
waitForChild(game.CoreGui,"RobloxGui")
|
||||||
|
if game.CoreGui.RobloxGui:FindFirstChild("ControlFrame") then
|
||||||
|
gui = game.CoreGui.RobloxGui.ControlFrame
|
||||||
|
else
|
||||||
|
gui = game.CoreGui.RobloxGui
|
||||||
|
end
|
||||||
|
|
||||||
|
function currentTone()
|
||||||
|
if currentConversationDialog then
|
||||||
|
return currentConversationDialog.Tone
|
||||||
|
else
|
||||||
|
return Enum.DialogTone.Neutral
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function createChatNotificationGui()
|
||||||
|
chatNotificationGui = Instance.new("BillboardGui")
|
||||||
|
chatNotificationGui.Name = "ChatNotificationGui"
|
||||||
|
chatNotificationGui.ExtentsOffset = Vector3.new(0,1,0)
|
||||||
|
chatNotificationGui.Size = UDim2.new(4, 0, 5.42857122, 0)
|
||||||
|
chatNotificationGui.SizeOffset = Vector2.new(0,0)
|
||||||
|
chatNotificationGui.StudsOffset = Vector3.new(0.4, 4.3, 0)
|
||||||
|
chatNotificationGui.Enabled = true
|
||||||
|
chatNotificationGui.RobloxLocked = true
|
||||||
|
chatNotificationGui.Active = true
|
||||||
|
|
||||||
|
local image = Instance.new("ImageLabel")
|
||||||
|
image.Name = "Image"
|
||||||
|
image.Active = false
|
||||||
|
image.BackgroundTransparency = 1
|
||||||
|
image.Position = UDim2.new(0,0,0,0)
|
||||||
|
image.Size = UDim2.new(1.0,0,1.0,0)
|
||||||
|
image.Image = ""
|
||||||
|
image.RobloxLocked = true
|
||||||
|
image.Parent = chatNotificationGui
|
||||||
|
|
||||||
|
|
||||||
|
local button = Instance.new("ImageButton")
|
||||||
|
button.Name = "Button"
|
||||||
|
button.AutoButtonColor = false
|
||||||
|
button.Position = UDim2.new(0.0879999995, 0, 0.0529999994, 0)
|
||||||
|
button.Size = UDim2.new(0.829999983, 0, 0.460000008, 0)
|
||||||
|
button.Image = ""
|
||||||
|
button.BackgroundTransparency = 1
|
||||||
|
button.RobloxLocked = true
|
||||||
|
button.Parent = image
|
||||||
|
end
|
||||||
|
|
||||||
|
function getChatColor(tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
return Enum.ChatColor.Blue
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
return Enum.ChatColor.Green
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
return Enum.ChatColor.Red
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function styleChoices(tone)
|
||||||
|
for i, obj in pairs(choices) do
|
||||||
|
resetColor(obj, tone)
|
||||||
|
end
|
||||||
|
resetColor(lastChoice, tone)
|
||||||
|
end
|
||||||
|
|
||||||
|
function styleMainFrame(tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatGreen
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botGreen_tailRight.png"
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
mainFrame.Style = Enum.FrameStyle.ChatRed
|
||||||
|
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botRed_tailRight.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
styleChoices(tone)
|
||||||
|
end
|
||||||
|
function setChatNotificationTone(gui, purpose, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png"
|
||||||
|
end
|
||||||
|
if purpose == Enum.DialogPurpose.Quest then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_bang.png"
|
||||||
|
elseif purpose == Enum.DialogPurpose.Help then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_question.png"
|
||||||
|
elseif purpose == Enum.DialogPurpose.Shop then
|
||||||
|
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_money.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function createMessageDialog()
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
function 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
|
||||||
|
end
|
||||||
|
|
||||||
|
function variableDelay(str)
|
||||||
|
local length = math.min(string.len(str), 100)
|
||||||
|
wait(0.75 + ((length/75) * 1.5))
|
||||||
|
end
|
||||||
|
|
||||||
|
function resetColor(frame, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(45/255, 142/255, 245/255)
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 77/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(0/255, 190/255, 0/255)
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
frame.BackgroundColor3 = Color3.new(140/255, 0/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(255/255,88/255, 79/255)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function highlightColor(frame, tone)
|
||||||
|
if tone == Enum.DialogTone.Neutral then
|
||||||
|
frame.BackgroundColor3 = Color3.new(2/255, 108/255, 255/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
elseif tone == Enum.DialogTone.Friendly then
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 128/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
elseif tone == Enum.DialogTone.Enemy then
|
||||||
|
frame.BackgroundColor3 = Color3.new(204/255, 0/255, 0/255)
|
||||||
|
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function wanderDialog()
|
||||||
|
print("Wander")
|
||||||
|
mainFrame.Visible = false
|
||||||
|
endDialog()
|
||||||
|
showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
||||||
|
end
|
||||||
|
|
||||||
|
function timeoutDialog()
|
||||||
|
print("Timeout")
|
||||||
|
mainFrame.Visible = false
|
||||||
|
endDialog()
|
||||||
|
showMessage(conversationTimedOut, conversationTimedOutSize)
|
||||||
|
end
|
||||||
|
function normalEndDialog()
|
||||||
|
print("Done")
|
||||||
|
endDialog()
|
||||||
|
end
|
||||||
|
|
||||||
|
function endDialog()
|
||||||
|
if currentAbortDialogScript then
|
||||||
|
currentAbortDialogScript:Remove()
|
||||||
|
currentAbortDialogScript = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local dialog = currentConversationDialog
|
||||||
|
currentConversationDialog = nil
|
||||||
|
if dialog and dialog.InUse then
|
||||||
|
local reenableScript = reenableDialogScript:Clone()
|
||||||
|
reenableScript.archivable = false
|
||||||
|
reenableScript.Disabled = false
|
||||||
|
reenableScript.Parent = dialog
|
||||||
|
end
|
||||||
|
|
||||||
|
for dialog, gui in pairs(dialogMap) do
|
||||||
|
if dialog and gui then
|
||||||
|
gui.Enabled = not dialog.InUse
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationPartner = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function sanitizeMessage(msg)
|
||||||
|
if string.len(msg) == 0 then
|
||||||
|
return "..."
|
||||||
|
else
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function selectChoice(choice)
|
||||||
|
renewKillswitch(currentConversationDialog)
|
||||||
|
|
||||||
|
--First hide the Gui
|
||||||
|
mainFrame.Visible = false
|
||||||
|
if choice == lastChoice then
|
||||||
|
game.Chat:Chat(game.Players.LocalPlayer.Character, "Goodbye!", getChatColor(currentTone()))
|
||||||
|
|
||||||
|
normalEndDialog()
|
||||||
|
else
|
||||||
|
local dialogChoice = choiceMap[choice]
|
||||||
|
|
||||||
|
game.Chat:Chat(game.Players.LocalPlayer.Character, sanitizeMessage(dialogChoice.UserDialog), getChatColor(currentTone()))
|
||||||
|
wait(1)
|
||||||
|
currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice)
|
||||||
|
game.Chat:Chat(currentConversationPartner, sanitizeMessage(dialogChoice.ResponseDialog), getChatColor(currentTone()))
|
||||||
|
|
||||||
|
variableDelay(dialogChoice.ResponseDialog)
|
||||||
|
presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function newChoice(numberText)
|
||||||
|
local frame = Instance.new("TextButton")
|
||||||
|
frame.BackgroundColor3 = Color3.new(0/255, 0/255, 179/255)
|
||||||
|
frame.AutoButtonColor = false
|
||||||
|
frame.BorderSizePixel = 0
|
||||||
|
frame.Text = ""
|
||||||
|
frame.MouseEnter:connect(function() highlightColor(frame, currentTone()) end)
|
||||||
|
frame.MouseLeave:connect(function() resetColor(frame, currentTone()) end)
|
||||||
|
frame.MouseButton1Click:connect(function() 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
|
||||||
|
function initialize(parent)
|
||||||
|
choices[1] = newChoice("1)")
|
||||||
|
choices[2] = newChoice("2)")
|
||||||
|
choices[3] = newChoice("3)")
|
||||||
|
choices[4] = newChoice("4)")
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
for n, obj in pairs(choices) do
|
||||||
|
obj.RobloxLocked = true
|
||||||
|
obj.Parent = mainFrame
|
||||||
|
end
|
||||||
|
lastChoice.RobloxLocked = true
|
||||||
|
lastChoice.Parent = mainFrame
|
||||||
|
|
||||||
|
mainFrame.RobloxLocked = true
|
||||||
|
mainFrame.Parent = parent
|
||||||
|
end
|
||||||
|
|
||||||
|
function presentDialogChoices(talkingPart, dialogChoices)
|
||||||
|
if not currentConversationDialog then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationPartner = talkingPart
|
||||||
|
sortedDialogChoices = {}
|
||||||
|
for n, obj in pairs(dialogChoices) do
|
||||||
|
if obj:IsA("DialogChoice") then
|
||||||
|
table.insert(sortedDialogChoices, obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(sortedDialogChoices, function(a,b) return a.Name < b.Name end)
|
||||||
|
|
||||||
|
if #sortedDialogChoices == 0 then
|
||||||
|
normalEndDialog()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = 1
|
||||||
|
local yPosition = 0
|
||||||
|
choiceMap = {}
|
||||||
|
for n, obj in pairs(choices) do
|
||||||
|
obj.Visible = false
|
||||||
|
end
|
||||||
|
|
||||||
|
for n, obj in pairs(sortedDialogChoices) do
|
||||||
|
if pos <= #choices then
|
||||||
|
--3 lines is the maximum, set it to that temporarily
|
||||||
|
choices[pos].Size = UDim2.new(1, 0, 0, 24*3)
|
||||||
|
choices[pos].UserPrompt.Text = obj.UserDialog
|
||||||
|
local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y/24)*24
|
||||||
|
|
||||||
|
choices[pos].Position = UDim2.new(0, 0, 0, yPosition)
|
||||||
|
choices[pos].Size = UDim2.new(1, 0, 0, height)
|
||||||
|
choices[pos].Visible = true
|
||||||
|
|
||||||
|
choiceMap[choices[pos]] = obj
|
||||||
|
|
||||||
|
yPosition = yPosition + height
|
||||||
|
pos = pos + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
lastChoice.Position = UDim2.new(0,0,0,yPosition)
|
||||||
|
lastChoice.Number.Text = pos .. ")"
|
||||||
|
|
||||||
|
mainFrame.Size = UDim2.new(0, 350, 0, yPosition+24+32)
|
||||||
|
mainFrame.Position = UDim2.new(0,20,0.0, -mainFrame.Size.Y.Offset-20)
|
||||||
|
styleMainFrame(currentTone())
|
||||||
|
mainFrame.Visible = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function doDialog(dialog)
|
||||||
|
while not Instance.Lock(dialog, player) do
|
||||||
|
wait()
|
||||||
|
end
|
||||||
|
|
||||||
|
if dialog.InUse then
|
||||||
|
Instance.Unlock(dialog)
|
||||||
|
return
|
||||||
|
else
|
||||||
|
dialog.InUse = true
|
||||||
|
Instance.Unlock(dialog)
|
||||||
|
end
|
||||||
|
|
||||||
|
currentConversationDialog = dialog
|
||||||
|
game.Chat:Chat(dialog.Parent, dialog.InitialPrompt, getChatColor(dialog.Tone))
|
||||||
|
variableDelay(dialog.InitialPrompt)
|
||||||
|
|
||||||
|
presentDialogChoices(dialog.Parent, dialog:GetChildren())
|
||||||
|
end
|
||||||
|
|
||||||
|
function renewKillswitch(dialog)
|
||||||
|
if currentAbortDialogScript then
|
||||||
|
currentAbortDialogScript:Remove()
|
||||||
|
currentAbortDialogScript = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
currentAbortDialogScript = timeoutScript:Clone()
|
||||||
|
currentAbortDialogScript.archivable = false
|
||||||
|
currentAbortDialogScript.Disabled = false
|
||||||
|
currentAbortDialogScript.Parent = dialog
|
||||||
|
end
|
||||||
|
|
||||||
|
function checkForLeaveArea()
|
||||||
|
while currentConversationDialog do
|
||||||
|
if currentConversationDialog.Parent and (player:DistanceFromCharacter(currentConversationDialog.Parent.Position) >= currentConversationDialog.ConversationDistance) then
|
||||||
|
wanderDialog()
|
||||||
|
end
|
||||||
|
wait(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function startDialog(dialog)
|
||||||
|
delay(1, checkForLeaveArea)
|
||||||
|
end
|
||||||
|
|
||||||
|
function removeDialog(dialog)
|
||||||
|
if dialogMap[dialog] then
|
||||||
|
dialogMap[dialog]:Remove()
|
||||||
|
dialogMap[dialog] = nil
|
||||||
|
end
|
||||||
|
if dialogConnections[dialog] then
|
||||||
|
dialogConnections[dialog]:disconnect()
|
||||||
|
dialogConnections[dialog] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function addDialog(dialog)
|
||||||
|
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||||
|
local chatGui = chatNotificationGui:clone()
|
||||||
|
chatGui.Enabled = not dialog.InUse
|
||||||
|
chatGui.Adornee = dialog.Parent
|
||||||
|
chatGui.RobloxLocked = true
|
||||||
|
chatGui.Parent = game.CoreGui
|
||||||
|
chatGui.Image.Button.MouseButton1Click:connect(function() startDialog(dialog) end)
|
||||||
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
|
|
||||||
|
dialogMap[dialog] = chatGui
|
||||||
|
|
||||||
|
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
||||||
|
if prop == "Parent" and dialog.Parent then
|
||||||
|
--This handles the reparenting case, seperate from removal case
|
||||||
|
removeDialog(dialog)
|
||||||
|
addDialog(dialog)
|
||||||
|
elseif prop == "InUse" then
|
||||||
|
chatGui.Enabled = not currentConversationDialog and not dialog.InUse
|
||||||
|
if dialog == currentConversationDialog then
|
||||||
|
timeoutDialog()
|
||||||
|
end
|
||||||
|
elseif prop == "Tone" or prop == "Purpose" then
|
||||||
|
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function fetchScripts()
|
||||||
|
--[[local model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
|
if type(model) == "string" then -- load failed, lets try again
|
||||||
|
wait(0.1)
|
||||||
|
model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||||
|
end
|
||||||
|
if type(model) == "string" then -- not going to work, lets bail
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
waitForChild(model,"TimeoutScript")
|
||||||
|
timeoutScript = model.TimeoutScript
|
||||||
|
waitForChild(model,"ReenableDialogScript")
|
||||||
|
reenableDialogScript = model.ReenableDialogScript]]
|
||||||
|
--if not game.Lighting:FindFirstChild("CoreDialogScripts") then
|
||||||
|
--game.Workspace:InsertContent("rbxasset://scripts\\cores\\MainBotSupport.rbxm")
|
||||||
|
--end
|
||||||
|
waitForChild(game.Lighting,"CoreDialogScripts")
|
||||||
|
local model = game.Lighting.CoreDialogScripts
|
||||||
|
waitForChild(model,"TimeoutScript")
|
||||||
|
timeoutScript = model.TimeoutScript:Clone()
|
||||||
|
waitForChild(model,"ReenableDialogScript")
|
||||||
|
reenableDialogScript = model.ReenableDialogScript:Clone()
|
||||||
|
end
|
||||||
|
|
||||||
|
function onLoad()
|
||||||
|
--print("Creating Guis")
|
||||||
|
createChatNotificationGui()
|
||||||
|
|
||||||
|
--print("Creating MessageDialog")
|
||||||
|
createMessageDialog()
|
||||||
|
messageDialog.RobloxLocked = true
|
||||||
|
messageDialog.Parent = gui
|
||||||
|
|
||||||
|
--print("Waiting for BottomLeftControl")
|
||||||
|
waitForChild(gui, "BottomLeftControl")
|
||||||
|
|
||||||
|
--print("Initializing Frame")
|
||||||
|
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
|
||||||
|
initialize(frame)
|
||||||
|
|
||||||
|
--print("Adding Dialogs")
|
||||||
|
game.CollectionService.ItemAdded:connect(function(obj) if obj:IsA("Dialog") then addDialog(obj) end end)
|
||||||
|
game.CollectionService.ItemRemoved:connect(function(obj) if obj:IsA("Dialog") then removeDialog(obj) end end)
|
||||||
|
for i, obj in pairs(game.CollectionService:GetCollection("Dialog")) do
|
||||||
|
if obj:IsA("Dialog") then
|
||||||
|
addDialog(obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
onLoad()
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
@ -46,5 +46,5 @@ end]]
|
||||||
dofile("rbxasset://scripts\\cores\\SettingsScript.lua")
|
dofile("rbxasset://scripts\\cores\\SettingsScript.lua")
|
||||||
|
|
||||||
-- MainBotChatScript
|
-- MainBotChatScript
|
||||||
dofile("rbxasset://scripts\\cores\\MainBotChatScript.lua")
|
dofile("rbxasset://scripts\\cores\\MainBotChatScriptStudio.lua")
|
||||||
end)
|
end)
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
|
||||||
|
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
|
||||||
|
-- Created by Ben T. 10/29/10
|
||||||
|
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
|
||||||
|
|
||||||
|
delay(0, function()
|
||||||
|
|
||||||
|
print("Accurate CS by Matt Brown.")
|
||||||
|
|
||||||
|
local function waitForChild(instance, name)
|
||||||
|
while not instance:FindFirstChild(name) do
|
||||||
|
instance.ChildAdded:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function waitForProperty(instance, property)
|
||||||
|
while not instance[property] do
|
||||||
|
instance.Changed:wait()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local backpackTestPlaces = {41324860,87241143,1818,65033,25415,14403,33913,21783593,17467963,3271,16184658}
|
||||||
|
|
||||||
|
waitForChild(game:GetService("CoreGui"),"RobloxGui")
|
||||||
|
local screenGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
||||||
|
|
||||||
|
local scriptContext = game:GetService("ScriptContext")
|
||||||
|
|
||||||
|
-- Resizer (dynamically resizes gui)
|
||||||
|
dofile("rbxasset://scripts\\cores\\Resizer.lua")
|
||||||
|
|
||||||
|
-- SubMenuBuilder (builds out the material,surface and color panels)
|
||||||
|
dofile("rbxasset://scripts\\cores\\SubMenuBuilder.lua")
|
||||||
|
|
||||||
|
-- ToolTipper (creates tool tips for gui)
|
||||||
|
dofile("rbxasset://scripts\\cores\\ToolTipper.lua")
|
||||||
|
|
||||||
|
--[[if game.CoreGui.Version < 2 then
|
||||||
|
-- (controls the movement and selection of sub panels)
|
||||||
|
-- PaintMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040464,screenGui.BuildTools.Frame.PropertyTools.PaintTool,"PaintMenuMover")
|
||||||
|
-- MaterialMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040495,screenGui.BuildTools.Frame.PropertyTools.MaterialSelector,"MaterialMenuMover")
|
||||||
|
-- InputMenuMover
|
||||||
|
scriptContext:AddCoreScript(36040483,screenGui.BuildTools.Frame.PropertyTools.InputSelector,"InputMenuMover")
|
||||||
|
end]]
|
||||||
|
|
||||||
|
-- SettingsScript
|
||||||
|
dofile("rbxasset://scripts\\cores\\SettingsScript.lua")
|
||||||
|
|
||||||
|
-- MainBotChatScript
|
||||||
|
dofile("rbxasset://scripts\\cores\\MainBotChatScriptStudio.lua")
|
||||||
|
|
||||||
|
if game.CoreGui.Version >= 2 then
|
||||||
|
-- New Player List
|
||||||
|
dofile("rbxasset://scripts\\cores\\PlayerlistScript.lua")
|
||||||
|
-- Popup Script
|
||||||
|
dofile("rbxasset://scripts\\cores\\PopupScript.lua")
|
||||||
|
-- Friend Notification Script (probably can use this script to expand out to other notifications)
|
||||||
|
dofile("rbxasset://scripts\\cores\\NotificationScript.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
if game.CoreGui.Version >= 3 then
|
||||||
|
waitForProperty(game,"PlaceId")
|
||||||
|
local inRightPlace = false
|
||||||
|
for i,v in ipairs(backpackTestPlaces) do
|
||||||
|
if v == game.PlaceId then
|
||||||
|
inRightPlace = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
waitForChild(game,"Players")
|
||||||
|
waitForProperty(game.Players,"LocalPlayer")
|
||||||
|
if game.Players.LocalPlayer.userId == 7210880 or game.Players.LocalPlayer.userId == 0 then inRightPlace = true end
|
||||||
|
|
||||||
|
--if not inRightPlace then return end -- restricting availability of backpack
|
||||||
|
|
||||||
|
-- Backpack Builder
|
||||||
|
dofile("rbxasset://scripts\\cores\\BackpackBuilder.lua")
|
||||||
|
waitForChild(screenGui,"CurrentLoadout")
|
||||||
|
waitForChild(screenGui.CurrentLoadout,"TempSlot")
|
||||||
|
waitForChild(screenGui.CurrentLoadout.TempSlot,"SlotNumber")
|
||||||
|
-- Backpack Script
|
||||||
|
dofile("rbxasset://scripts\\cores\\BackpackScript.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
@ -8,6 +8,6 @@ ExtendedVersionNumber=True
|
||||||
ExtendedVersionEditChangelog=True
|
ExtendedVersionEditChangelog=True
|
||||||
//ExtendedVersionTemplate=%version% v11.2022.%extended-revision%%lite%
|
//ExtendedVersionTemplate=%version% v11.2022.%extended-revision%%lite%
|
||||||
ExtendedVersionTemplate=%version% Snapshot v22.%build%.%revision%.%extended-revision%
|
ExtendedVersionTemplate=%version% Snapshot v22.%build%.%revision%.%extended-revision%
|
||||||
ExtendedVersionRevision=1
|
ExtendedVersionRevision=2
|
||||||
InitialBootup=False
|
InitialBootup=False
|
||||||
IsLite=False
|
IsLite=False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue