mirror of
https://github.com/Novetus/Novetus_src.git
synced 2025-01-31 09:41:33 +02:00
better checks for opened game. add corescripts to 2011 clients.
This commit is contained in:
parent
1de430d04a
commit
ca96aa32a4
@ -174,7 +174,6 @@ namespace NovetusCMD
|
||||
|
||||
static void ProgramClose(object sender, EventArgs e)
|
||||
{
|
||||
//add check for open server
|
||||
if (GlobalVars.ProcessID != 0)
|
||||
{
|
||||
if (LocalFuncs.ProcessExists(GlobalVars.ProcessID))
|
||||
@ -318,7 +317,7 @@ namespace NovetusCMD
|
||||
|
||||
static void ServerExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.IsServerOpen = false;
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalFuncs.PingMasterServer(0, "The server has removed itself from the master server list.");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
@ -1072,8 +1072,6 @@ public class GlobalFuncs
|
||||
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
|
||||
#if LAUNCHER
|
||||
GlobalVars.UserConfiguration.LauncherStyle = style;
|
||||
#else
|
||||
GlobalVars.UserConfiguration.LauncherStyle = Settings.Style.Stylish;
|
||||
#endif
|
||||
GeneratePlayerID();
|
||||
GenerateTripcode();
|
||||
@ -1811,35 +1809,60 @@ public class GlobalFuncs
|
||||
public static void LaunchRBXClient(string ClientName, ScriptType type, bool no3d, bool nomap, EventHandler e)
|
||||
#endif
|
||||
{
|
||||
|
||||
if (type.Equals(ScriptType.Server))
|
||||
switch (type)
|
||||
{
|
||||
if (GlobalVars.IsServerOpen)
|
||||
{
|
||||
#if LAUNCHER
|
||||
if (box != null)
|
||||
case ScriptType.Client:
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
{
|
||||
ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2, box);
|
||||
goto default;
|
||||
}
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
if (GlobalVars.GameOpened == GlobalVars.OpenedGame.Server)
|
||||
{
|
||||
#if LAUNCHER
|
||||
if (box != null)
|
||||
{
|
||||
ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2, box);
|
||||
}
|
||||
#elif CMD
|
||||
ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2);
|
||||
ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2);
|
||||
#endif
|
||||
|
||||
#if LAUNCHER
|
||||
MessageBox.Show("Failed to launch Novetus. (Error: A server is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Failed to launch Novetus. (Error: A server is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else if (GlobalVars.UserConfiguration.FirstServerLaunch)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (GlobalVars.UserConfiguration.FirstServerLaunch)
|
||||
{
|
||||
#if LAUNCHER
|
||||
MessageBox.Show("For your first time hosting a server, make sure your server's port forwarded (set up in your router), going through a tunnel server, or running from UPnP.\nIf your port is forwarded or you are going through a tunnel server, make sure your port is set up as UDP, not TCP.\nRoblox does NOT use TCP, only UDP.", "Novetus - Hosting Tips", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("For your first time hosting a server, make sure your server's port forwarded (set up in your router), going through a tunnel server, or running from UPnP.\nIf your port is forwarded or you are going through a tunnel server, make sure your port is set up as UDP, not TCP.\nRoblox does NOT use TCP, only UDP.", "Novetus - Hosting Tips", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
#elif CMD
|
||||
ConsolePrint("For your first time hosting a server, make sure your server's port forwarded (set up in your router), going through a tunnel server, or running from UPnP.\nIf your port is forwarded or you are going through a tunnel server, make sure your port is set up as UDP, not TCP.\nRoblox does NOT use TCP, only UDP.\nPress any key to continue...", 4);
|
||||
Console.ReadKey();
|
||||
ConsolePrint("For your first time hosting a server, make sure your server's port forwarded (set up in your router), going through a tunnel server, or running from UPnP.\nIf your port is forwarded or you are going through a tunnel server, make sure your port is set up as UDP, not TCP.\nRoblox does NOT use TCP, only UDP.\nPress any key to continue...", 4);
|
||||
Console.ReadKey();
|
||||
#endif
|
||||
GlobalVars.UserConfiguration.FirstServerLaunch = false;
|
||||
}
|
||||
GlobalVars.UserConfiguration.FirstServerLaunch = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (GlobalVars.GameOpened == GlobalVars.OpenedGame.Client)
|
||||
{
|
||||
#if LAUNCHER
|
||||
if (box != null)
|
||||
{
|
||||
ConsolePrint("ERROR - Failed to launch Novetus. (A game is already running.)", 2, box);
|
||||
}
|
||||
#elif CMD
|
||||
ConsolePrint("ERROR - Failed to launch Novetus. (A game is already running.)", 2);
|
||||
#endif
|
||||
|
||||
#if LAUNCHER
|
||||
MessageBox.Show("Failed to launch Novetus. (Error: A game is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if LAUNCHER
|
||||
@ -1933,6 +1956,7 @@ public class GlobalFuncs
|
||||
#if URI || LAUNCHER
|
||||
MessageBox.Show("Failed to launch Novetus. (Error: The client has been detected as modified.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1950,17 +1974,28 @@ public class GlobalFuncs
|
||||
OpenClient(type, rbxexe, args, ClientName, mapname, e);
|
||||
}
|
||||
|
||||
if (type.Equals(ScriptType.Server))
|
||||
switch (type)
|
||||
{
|
||||
GlobalVars.IsServerOpen = true;
|
||||
case ScriptType.Client:
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
{
|
||||
goto default;
|
||||
}
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.Server;
|
||||
#if LAUNCHER
|
||||
if (box != null)
|
||||
{
|
||||
PingMasterServer(1, "Server will now display on the defined master server.", box);
|
||||
}
|
||||
if (box != null)
|
||||
{
|
||||
PingMasterServer(1, "Server will now display on the defined master server.", box);
|
||||
}
|
||||
#elif CMD
|
||||
PingMasterServer(1, "Server will now display on the defined master server.");
|
||||
PingMasterServer(1, "Server will now display on the defined master server.");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.Client;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if URI || LAUNCHER || CMD
|
||||
@ -2043,7 +2078,7 @@ public class GlobalFuncs
|
||||
}
|
||||
|
||||
#if LAUNCHER
|
||||
public static void ConsolePrint(string text, int type, RichTextBox box, bool noLog = false)
|
||||
public static void ConsolePrint(string text, int type, RichTextBox box, bool noLog = false)
|
||||
{
|
||||
if (box == null)
|
||||
return;
|
||||
|
@ -28,6 +28,15 @@ public static class GlobalVars
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
public enum OpenedGame
|
||||
{
|
||||
None = 0,
|
||||
Client = 1,
|
||||
Server = 2
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class definitions
|
||||
public static FileFormat.ProgramInfo ProgramInformation = new FileFormat.ProgramInfo();
|
||||
public static FileFormat.Config UserConfiguration = new FileFormat.Config();
|
||||
@ -42,7 +51,7 @@ public static class GlobalVars
|
||||
public static string ExternalIP = SecurityFuncs.GetExternalIPAddress();
|
||||
public static int DefaultRobloxPort = 53640;
|
||||
public static int JoinPort = DefaultRobloxPort;
|
||||
public static bool IsServerOpen = false;
|
||||
public static OpenedGame GameOpened = OpenedGame.None;
|
||||
#endregion
|
||||
|
||||
#region NovetusCMD
|
||||
|
@ -293,26 +293,39 @@ namespace NovetusLauncher
|
||||
{
|
||||
if (GlobalVars.AdminMode)
|
||||
{
|
||||
ShowCloseWarning("You are in Admin Mode.", "Admin Mode", e);
|
||||
DialogResult closeNovetus = MessageBox.Show("You are in Admin Mode.\nAre you sure you want to quit Novetus?", "Novetus - Admin Mode Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (closeNovetus == DialogResult.No)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseEventInternal();
|
||||
}
|
||||
}
|
||||
|
||||
if (GlobalVars.IsServerOpen)
|
||||
else if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
{
|
||||
ShowCloseWarning("A server is open.", "Server", e);
|
||||
switch (GlobalVars.GameOpened)
|
||||
{
|
||||
case GlobalVars.OpenedGame.Client:
|
||||
ShowCloseError("A game is open.", "Game", e);
|
||||
break;
|
||||
case GlobalVars.OpenedGame.Server:
|
||||
ShowCloseError("A server is open.", "Server", e);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowCloseWarning(string text, string title, CancelEventArgs e)
|
||||
private void ShowCloseError(string text, string title, CancelEventArgs e)
|
||||
{
|
||||
DialogResult closeNovetus = MessageBox.Show(text + "\nAre you sure you want to quit Novetus?", "Novetus - " + title + " Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (closeNovetus == DialogResult.No)
|
||||
DialogResult closeNovetus = MessageBox.Show(text + "\nYou must close the game before closing Novetus.", "Novetus - " + title + " is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (closeNovetus == DialogResult.OK)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseEventInternal();
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseEventInternal()
|
||||
@ -534,19 +547,24 @@ namespace NovetusLauncher
|
||||
|
||||
void ClientExited(object sender, EventArgs e)
|
||||
{
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
}
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
ClientExitedBase(sender, e);
|
||||
}
|
||||
|
||||
void ServerExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.IsServerOpen = false;
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalFuncs.PingMasterServer(0, "The server has removed itself from the master server list.", ConsoleBox);
|
||||
ClientExitedBase(sender, e);
|
||||
}
|
||||
|
||||
void EasterEggExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
SplashLabel.Text = LocalVars.prevsplash;
|
||||
if (GlobalVars.AdminMode)
|
||||
@ -1037,6 +1055,12 @@ namespace NovetusLauncher
|
||||
|
||||
public void RestartLauncherAfterSetting(bool check, string title, string subText)
|
||||
{
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
{
|
||||
MessageBox.Show("You must close the currently open client before this setting can be applied.", "Novetus - Client is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (check)
|
||||
{
|
||||
case false:
|
||||
@ -1047,7 +1071,7 @@ namespace NovetusLauncher
|
||||
break;
|
||||
}
|
||||
|
||||
WriteConfigValues();
|
||||
CloseEventInternal();
|
||||
Application.Restart();
|
||||
}
|
||||
|
||||
@ -1159,6 +1183,12 @@ namespace NovetusLauncher
|
||||
|
||||
public void ChangeClient()
|
||||
{
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
{
|
||||
MessageBox.Show("You must close the currently open client before changing clients.", "Novetus - Client is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClientBox.Items.Count == 0)
|
||||
return;
|
||||
|
||||
|
@ -129,6 +129,12 @@ namespace NovetusLauncher
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("You must close the currently open client before changing clients.", "Novetus - Client is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (clientListBox.Items.Count == 0)
|
||||
return;
|
||||
|
||||
@ -449,6 +455,12 @@ namespace NovetusLauncher
|
||||
if (LocalVars.launcherInitState)
|
||||
return;
|
||||
|
||||
if (GlobalVars.GameOpened != GlobalVars.OpenedGame.None)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("You must close the currently open client before changing styles.", "Novetus - Client is Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
styleBox.Text = styleBox.SelectedItem.ToString();
|
||||
|
||||
switch (styleBox.SelectedIndex)
|
||||
|
@ -218,47 +218,56 @@ public partial class AssetSDK : Form
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog
|
||||
try
|
||||
{
|
||||
FileName = "Choose batch download location.",
|
||||
//"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*"
|
||||
Filter = "Roblox Model (*.rbxm)|*.rbxm|Roblox Place (*.rbxl) |*.rbxl|Roblox Mesh (*.mesh)|*.mesh|PNG Image (*.png)|*.png|WAV Sound (*.wav)|*.wav",
|
||||
DefaultExt = ".rbxm",
|
||||
Title = "Save files downloaded via batch"
|
||||
};
|
||||
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string basepath = Path.GetDirectoryName(saveFileDialog1.FileName);
|
||||
string extension = Path.GetExtension(saveFileDialog1.FileName);
|
||||
|
||||
AssetDownloaderBatch_Status.Visible = true;
|
||||
|
||||
string[] lines = AssetDownloaderBatch_BatchIDBox.Lines;
|
||||
|
||||
int lineCount = lines.Count();
|
||||
|
||||
foreach (var line in lines)
|
||||
SaveFileDialog saveFileDialog1 = new SaveFileDialog
|
||||
{
|
||||
string[] linesplit = line.Split('|');
|
||||
bool noErrors = StartItemBatchDownload(
|
||||
linesplit[0] + extension,
|
||||
url,
|
||||
linesplit[1],
|
||||
Convert.ToInt32(linesplit[2]),
|
||||
isWebSite, basepath);
|
||||
FileName = "Choose batch download location.",
|
||||
//"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*"
|
||||
Filter = "Roblox Model (*.rbxm)|*.rbxm|Roblox Place (*.rbxl) |*.rbxl|Roblox Mesh (*.mesh)|*.mesh|PNG Image (*.png)|*.png|WAV Sound (*.wav)|*.wav",
|
||||
DefaultExt = ".rbxm",
|
||||
Title = "Save files downloaded via batch"
|
||||
};
|
||||
|
||||
if (!noErrors)
|
||||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string basepath = Path.GetDirectoryName(saveFileDialog1.FileName);
|
||||
string extension = Path.GetExtension(saveFileDialog1.FileName);
|
||||
|
||||
AssetDownloaderBatch_Status.Visible = true;
|
||||
|
||||
string[] lines = AssetDownloaderBatch_BatchIDBox.Lines;
|
||||
|
||||
int lineCount = lines.Count();
|
||||
|
||||
foreach (var line in lines)
|
||||
{
|
||||
--lineCount;
|
||||
string[] linesplit = line.Split('|');
|
||||
bool noErrors = StartItemBatchDownload(
|
||||
linesplit[0] + extension,
|
||||
url,
|
||||
linesplit[1],
|
||||
Convert.ToInt32(linesplit[2]),
|
||||
isWebSite, basepath);
|
||||
|
||||
if (!noErrors)
|
||||
{
|
||||
--lineCount;
|
||||
}
|
||||
}
|
||||
|
||||
AssetDownloaderBatch_Status.Visible = false;
|
||||
|
||||
string extraText = (lines.Count() != lineCount) ? "\n" + (lines.Count() - lineCount) + " errors were detected during the download. Make sure your IDs and links are valid." : "";
|
||||
|
||||
MessageBox.Show("Batch download complete! " + lineCount + " items downloaded!" + extraText, "Novetus Asset SDK - Download Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
GlobalFuncs.LogExceptions(ex);
|
||||
|
||||
AssetDownloaderBatch_Status.Visible = false;
|
||||
|
||||
string extraText = (lines.Count() != lineCount) ? "\n" + (lines.Count() - lineCount) + " errors were detected during the download. Make sure your IDs and links are valid." : "";
|
||||
|
||||
MessageBox.Show("Batch download complete! " + lineCount + " items downloaded!" + extraText, "Novetus Asset SDK - Download Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
MessageBox.Show("Unable to batch download files. Error:" + ex.Message + "\n Make sure your items are set up properly.", "Novetus Asset SDK - Unable to batch download files.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
@ -64,6 +65,10 @@ namespace NovetusLauncher
|
||||
|
||||
void ClientExited(object sender, EventArgs e)
|
||||
{
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
}
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
GlobalVars.IP = oldIP;
|
||||
GlobalVars.JoinPort = oldPort;
|
||||
|
@ -81,7 +81,11 @@ namespace NovetusURI
|
||||
|
||||
void ClientExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != GlobalVars.OpenedGame.Server)
|
||||
{
|
||||
GlobalVars.GameOpened = GlobalVars.OpenedGame.None;
|
||||
}
|
||||
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, "");
|
||||
Close();
|
||||
}
|
||||
|
||||
|
@ -304,6 +304,7 @@ ROBLOX Script Generator was made by S. Costeira.
|
||||
Thank you to NT_x86 for helping me with security fixes.
|
||||
Thank you XlXi for the idea of the original logo. This logo was remade in newer verions in higher quality.
|
||||
Thank you Nukley for the idea of the Splash Tester.
|
||||
- Credits go to Nostal-ia for getting 2011M corescripts working and helping me with 2011E corescripts.
|
||||
Credits to Hazelnut (creator of JRBX) for the buttons used in the Stylish style.
|
||||
All credits for the used pieces of code go to the respective authors.
|
||||
|
||||
|
@ -53,6 +53,16 @@ Changes from Pre-Release 5:
|
||||
- Increased the speed of loading outfits in 2011 clients.
|
||||
- Fixed issues with launching Novetus from itch.io.
|
||||
- The server browser now pings the server and shows the current server status.
|
||||
- Novetus now does the following things if a client is open:
|
||||
- You can no longer run more than 1 client at the same time unless you are hosting a local server or you are using Local Play.
|
||||
- You can no longer change clients when a game is open.
|
||||
- Novetus will not let you close the launcher unless the currently running game is closed.
|
||||
- Novetus will not let you change styles unless the currently running game is closed.
|
||||
- Nonetus will not let you restart the launcher after changing a setting that requires it to restart.
|
||||
- These changes were done so master server lists can have valid servers, and to reduce accidential closings of Novetus.
|
||||
- Novetus will show hosting tips when hosting servers for the first time.
|
||||
- Added proper core scripts to 2011M and 2011E.
|
||||
- Credits go to Nostal-ia for getting 2011M corescripts working and helping me with 2011E corescripts.
|
||||
Changes from 1.2.4.1:
|
||||
- The OBJ2MeshV1GUI, The Asset Localizer, and the Item SDK have been merged to form the Asset SDK!
|
||||
- Works with the Roblox Asset Delivery API! Note: Script assets wil have to be downloaded manually in order to be used in scripts.
|
||||
|
@ -740,6 +740,7 @@ function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,
|
||||
plr:LoadCharacter()
|
||||
plr.CharacterAppearance=0
|
||||
InitalizeClientAppearance(plr,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID)
|
||||
wait(0.5)
|
||||
LoadCharacterNew(newWaitForChild(plr,"Appearance"),plr.Character,false)
|
||||
game.Workspace:InsertContent("rbxasset://Fonts//libraries.rbxm")
|
||||
newWaitForChild(game.StarterGui, "Health")
|
||||
|
File diff suppressed because one or more lines are too long
553
scripts/game/2011E/cores/MainBotChatScript.lua
Normal file
553
scripts/game/2011E/cores/MainBotChatScript.lua
Normal file
@ -0,0 +1,553 @@
|
||||
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)
|
||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||
return
|
||||
end
|
||||
|
||||
for dialog, gui in pairs(dialogMap) do
|
||||
if dialog and gui then
|
||||
gui.Enabled = false
|
||||
end
|
||||
end
|
||||
|
||||
renewKillswitch(dialog)
|
||||
|
||||
delay(1, checkForLeaveArea)
|
||||
doDialog(dialog)
|
||||
end
|
||||
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()
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
player = game.Players.LocalPlayer
|
||||
waitForProperty(player, "Character")
|
||||
|
||||
--print("Fetching Scripts")
|
||||
fetchScripts()
|
||||
|
||||
--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)
|
57
scripts/game/2011E/cores/Resizer.lua
Normal file
57
scripts/game/2011E/cores/Resizer.lua
Normal file
@ -0,0 +1,57 @@
|
||||
-- this script is responsible for keeping the gui proportions under control
|
||||
|
||||
delay(0, function()
|
||||
local screen = game:GetService("CoreGui").RobloxGui
|
||||
|
||||
local BottomLeftControl = screen:FindFirstChild("BottomLeftControl")
|
||||
local BottomRightControl = screen:FindFirstChild("BottomRightControl")
|
||||
local TopLeftControl = screen:FindFirstChild("TopLeftControl")
|
||||
|
||||
function makeYRelative()
|
||||
|
||||
BottomLeftControl.SizeConstraint = 2
|
||||
BottomRightControl.SizeConstraint = 2
|
||||
screen.BuildTools.Frame.SizeConstraint = 2
|
||||
TopLeftControl.SizeConstraint = 2
|
||||
|
||||
BottomLeftControl.Position = UDim2.new(0,0,1,-BottomLeftControl.AbsoluteSize.Y)
|
||||
BottomRightControl.Position = UDim2.new(1,-BottomRightControl.AbsoluteSize.X,1,-BottomRightControl.AbsoluteSize.Y)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function makeXRelative()
|
||||
|
||||
BottomLeftControl.SizeConstraint = 1
|
||||
BottomRightControl.SizeConstraint = 1
|
||||
TopLeftControl.SizeConstraint = 1
|
||||
screen.BuildTools.Frame.SizeConstraint = 1
|
||||
|
||||
BottomLeftControl.Position = UDim2.new(0,0,1,-BottomLeftControl.AbsoluteSize.Y)
|
||||
BottomRightControl.Position = UDim2.new(1,-BottomRightControl.AbsoluteSize.X,1,-BottomRightControl.AbsoluteSize.Y)
|
||||
|
||||
end
|
||||
|
||||
local function resize()
|
||||
if screen.AbsoluteSize.x > screen.AbsoluteSize.y then
|
||||
makeYRelative()
|
||||
else
|
||||
makeXRelative()
|
||||
end
|
||||
if screen:FindFirstChild("PlayerListBottomRightFrame") then
|
||||
screen.PlayerListBottomRightFrame.Size = UDim2.new(screen.PlayerListBottomRightFrame.Size.X.Scale, screen.PlayerListBottomRightFrame.Size.X.Offset, 0.5, -BottomRightControl.AbsoluteSize.Y - 5)
|
||||
end
|
||||
end
|
||||
screen.Changed:connect(function(property)
|
||||
|
||||
if property == "AbsoluteSize" then
|
||||
wait()
|
||||
resize()
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
wait()
|
||||
resize()
|
||||
|
||||
end)
|
2337
scripts/game/2011E/cores/SettingsScript.lua
Normal file
2337
scripts/game/2011E/cores/SettingsScript.lua
Normal file
File diff suppressed because it is too large
Load Diff
46
scripts/game/2011E/cores/StarterScript.lua
Normal file
46
scripts/game/2011E/cores/StarterScript.lua
Normal file
@ -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\\MainBotChatScript.lua")
|
||||
|
||||
end)
|
294
scripts/game/2011E/cores/SubMenuBuilder.lua
Normal file
294
scripts/game/2011E/cores/SubMenuBuilder.lua
Normal file
@ -0,0 +1,294 @@
|
||||
-- creates the in-game gui sub menus for property tools
|
||||
-- written 9/27/2010 by Ben (jeditkacheff)
|
||||
|
||||
delay(0, function()
|
||||
|
||||
local gui = game:GetService("CoreGui").RobloxGui
|
||||
if gui:FindFirstChild("ControlFrame") then
|
||||
gui = gui:FindFirstChild("ControlFrame")
|
||||
end
|
||||
|
||||
local currentlySelectedButton = nil
|
||||
|
||||
local localAssetBase = "rbxasset://textures/ui/"
|
||||
|
||||
local selectedButton = Instance.new("ObjectValue")
|
||||
selectedButton.RobloxLocked = true
|
||||
selectedButton.Name = "SelectedButton"
|
||||
selectedButton.Parent = gui.BuildTools
|
||||
|
||||
local closeButton = Instance.new("ImageButton")
|
||||
closeButton.Name = "CloseButton"
|
||||
closeButton.RobloxLocked = true
|
||||
closeButton.BackgroundTransparency = 1
|
||||
closeButton.Image = localAssetBase .. "CloseButton.png"
|
||||
closeButton.ZIndex = 2
|
||||
closeButton.Size = UDim2.new(0.2,0,0.05,0)
|
||||
closeButton.AutoButtonColor = false
|
||||
closeButton.Position = UDim2.new(0.75,0,0.01,0)
|
||||
|
||||
|
||||
|
||||
function setUpCloseButtonState(button)
|
||||
|
||||
button.MouseEnter:connect(function()
|
||||
button.Image = localAssetBase .. "CloseButton_dn.png"
|
||||
end)
|
||||
button.MouseLeave:connect(function()
|
||||
button.Image = localAssetBase .. "CloseButton.png"
|
||||
end)
|
||||
button.MouseButton1Click:connect(function()
|
||||
button.ClosedState.Value = true
|
||||
button.Image = localAssetBase .. "CloseButton.png"
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
-- nice selection animation
|
||||
function fadeInButton(button)
|
||||
|
||||
if currentlySelectedButton ~= nil then
|
||||
currentlySelectedButton.Selected = false
|
||||
currentlySelectedButton.ZIndex = 2
|
||||
currentlySelectedButton.Frame.BackgroundTransparency = 1
|
||||
end
|
||||
|
||||
local speed = 0.1
|
||||
button.ZIndex = 3
|
||||
while button.Frame.BackgroundTransparency > 0 do
|
||||
button.Frame.BackgroundTransparency = button.Frame.BackgroundTransparency - speed
|
||||
wait()
|
||||
end
|
||||
button.Selected = true
|
||||
|
||||
currentlySelectedButton = button
|
||||
selectedButton.Value = currentlySelectedButton
|
||||
end
|
||||
|
||||
------------------------------- create the color selection sub menu -----------------------------------
|
||||
|
||||
local paintMenu = Instance.new("ImageLabel")
|
||||
local paintTool = gui.BuildTools.Frame.PropertyTools.PaintTool
|
||||
paintMenu.Name = "PaintMenu"
|
||||
paintMenu.RobloxLocked = true
|
||||
paintMenu.Parent = paintTool
|
||||
paintMenu.Position = UDim2.new(-2.7,0,-3,0)
|
||||
paintMenu.Size = UDim2.new(2.5,0,10,0)
|
||||
paintMenu.BackgroundTransparency = 1
|
||||
paintMenu.ZIndex = 2
|
||||
paintMenu.Image = localAssetBase .. "PaintMenu.png"
|
||||
|
||||
local paintColorButton = Instance.new("ImageButton")
|
||||
paintColorButton.RobloxLocked = true
|
||||
paintColorButton.BorderSizePixel = 0
|
||||
paintColorButton.ZIndex = 2
|
||||
paintColorButton.Size = UDim2.new(0.200000003, 0,0.0500000007, 0)
|
||||
|
||||
local selection = Instance.new("Frame")
|
||||
selection.RobloxLocked = true
|
||||
selection.BorderSizePixel = 0
|
||||
selection.BackgroundColor3 = Color3.new(1,1,1)
|
||||
selection.BackgroundTransparency = 1
|
||||
selection.ZIndex = 2
|
||||
selection.Size = UDim2.new(1.1,0,1.1,0)
|
||||
selection.Position = UDim2.new(-0.05,0,-0.05,0)
|
||||
selection.Parent = paintColorButton
|
||||
|
||||
local header = 0.08
|
||||
local spacing = 18
|
||||
|
||||
local count = 1
|
||||
|
||||
function findNextColor()
|
||||
colorName = tostring(BrickColor.new(count))
|
||||
while colorName == "Medium stone grey" do
|
||||
count = count + 1
|
||||
colorName = tostring(BrickColor.new(count))
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
for i = 0,15 do
|
||||
for j = 1, 4 do
|
||||
newButton = paintColorButton:clone()
|
||||
newButton.RobloxLocked = true
|
||||
newButton.BackgroundColor3 = BrickColor.new(findNextColor()).Color
|
||||
newButton.Name = tostring(BrickColor.new(count))
|
||||
count = count + 1
|
||||
if j == 1 then newButton.Position = UDim2.new(0.08,0,i/spacing + header,0)
|
||||
elseif j == 2 then newButton.Position = UDim2.new(0.29,0,i/spacing + header,0)
|
||||
elseif j == 3 then newButton.Position = UDim2.new(0.5,0,i/spacing + header,0)
|
||||
elseif j == 4 then newButton.Position = UDim2.new(0.71,0,i/spacing + header,0) end
|
||||
newButton.Parent = paintMenu
|
||||
end
|
||||
end
|
||||
|
||||
local paintButtons = paintMenu:GetChildren()
|
||||
for i = 1, #paintButtons do
|
||||
paintButtons[i].MouseButton1Click:connect(function()
|
||||
fadeInButton(paintButtons[i])
|
||||
end)
|
||||
end
|
||||
|
||||
local paintCloseButton = closeButton:clone()
|
||||
paintCloseButton.RobloxLocked = true
|
||||
paintCloseButton.Parent = paintMenu
|
||||
|
||||
local closedState = Instance.new("BoolValue")
|
||||
closedState.RobloxLocked = true
|
||||
closedState.Name = "ClosedState"
|
||||
closedState.Parent = paintCloseButton
|
||||
|
||||
setUpCloseButtonState(paintCloseButton)
|
||||
|
||||
------------------------------- create the material selection sub menu -----------------------------------
|
||||
|
||||
local materialMenu = Instance.new("ImageLabel")
|
||||
local materialTool = gui.BuildTools.Frame.PropertyTools.MaterialSelector
|
||||
materialMenu.RobloxLocked = true
|
||||
materialMenu.Name = "MaterialMenu"
|
||||
materialMenu.Position = UDim2.new(-4,0,-3,0)
|
||||
materialMenu.Size = UDim2.new(2.5,0,6.5,0)
|
||||
materialMenu.BackgroundTransparency = 1
|
||||
materialMenu.ZIndex = 2
|
||||
materialMenu.Image = localAssetBase .. "MaterialMenu.png"
|
||||
materialMenu.Parent = materialTool
|
||||
|
||||
local textures = {"Plastic","Wood","Slate","CorrodedMetal","Ice","Grass","Foil","DiamondPlate","Concrete"}
|
||||
|
||||
local materialButtons = {}
|
||||
|
||||
local materialButton = Instance.new("ImageButton")
|
||||
materialButton.RobloxLocked = true
|
||||
materialButton.BackgroundTransparency = 1
|
||||
materialButton.Size = UDim2.new(0.400000003, 0,0.16, 0)
|
||||
materialButton.ZIndex = 2
|
||||
|
||||
selection.Parent = materialButton
|
||||
|
||||
local current = 1
|
||||
function getTextureAndName(button)
|
||||
|
||||
if current > #textures then
|
||||
button:remove()
|
||||
return false
|
||||
end
|
||||
button.Image = localAssetBase .. textures[current] .. ".png"
|
||||
button.Name = textures[current]
|
||||
current = current + 1
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
local ySpacing = 0.10
|
||||
local xSpacing = 0.07
|
||||
for i = 1,5 do
|
||||
for j = 1,2 do
|
||||
local button = materialButton:clone()
|
||||
button.RobloxLocked = true
|
||||
button.Position = UDim2.new((j -1)/2.2 + xSpacing,0,ySpacing + (i - 1)/5.5,0)
|
||||
if getTextureAndName(button) then button.Parent = materialMenu else button:remove() end
|
||||
table.insert(materialButtons,button)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for i = 1, #materialButtons do
|
||||
materialButtons[i].MouseButton1Click:connect(function()
|
||||
fadeInButton(materialButtons[i])
|
||||
end)
|
||||
end
|
||||
|
||||
local materialCloseButton = closeButton:clone()
|
||||
materialCloseButton.RobloxLocked = true
|
||||
materialCloseButton.Size = UDim2.new(0.2,0,0.08,0)
|
||||
materialCloseButton.Parent = materialMenu
|
||||
|
||||
local closedState = Instance.new("BoolValue")
|
||||
closedState.RobloxLocked = true
|
||||
closedState.Name = "ClosedState"
|
||||
closedState.Parent = materialCloseButton
|
||||
|
||||
setUpCloseButtonState(materialCloseButton)
|
||||
|
||||
|
||||
------------------------------- create the surface selection sub menu -----------------------------------
|
||||
|
||||
local surfaceMenu = Instance.new("ImageLabel")
|
||||
local surfaceTool = gui.BuildTools.Frame.PropertyTools.InputSelector
|
||||
surfaceMenu.RobloxLocked = true
|
||||
surfaceMenu.Name = "SurfaceMenu"
|
||||
surfaceMenu.Position = UDim2.new(-2.6,0,-4,0)
|
||||
surfaceMenu.Size = UDim2.new(2.5,0,5.5,0)
|
||||
surfaceMenu.BackgroundTransparency = 1
|
||||
surfaceMenu.ZIndex = 2
|
||||
surfaceMenu.Image = localAssetBase .. "SurfaceMenu.png"
|
||||
surfaceMenu.Parent = surfaceTool
|
||||
|
||||
textures = {"Smooth", "Studs", "Inlets", "Universal", "Glue", "Weld", "Hinge", "Motor"}
|
||||
current = 1
|
||||
|
||||
local surfaceButtons = {}
|
||||
|
||||
local surfaceButton = Instance.new("ImageButton")
|
||||
surfaceButton.RobloxLocked = true
|
||||
surfaceButton.BackgroundTransparency = 1
|
||||
surfaceButton.Size = UDim2.new(0.400000003, 0,0.19, 0)
|
||||
surfaceButton.ZIndex = 2
|
||||
|
||||
selection.Parent = surfaceButton
|
||||
|
||||
local ySpacing = 0.14
|
||||
local xSpacing = 0.07
|
||||
for i = 1,4 do
|
||||
for j = 1,2 do
|
||||
local button = surfaceButton:clone()
|
||||
button.RobloxLocked = true
|
||||
button.Position = UDim2.new((j -1)/2.2 + xSpacing,0,ySpacing + (i - 1)/4.6,0)
|
||||
getTextureAndName(button)
|
||||
button.Parent = surfaceMenu
|
||||
table.insert(surfaceButtons,button)
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #surfaceButtons do
|
||||
surfaceButtons[i].MouseButton1Click:connect(function()
|
||||
fadeInButton(surfaceButtons[i])
|
||||
end)
|
||||
end
|
||||
|
||||
local surfaceMenuCloseButton = closeButton:clone()
|
||||
surfaceMenuCloseButton.RobloxLocked = true
|
||||
surfaceMenuCloseButton.Size = UDim2.new(0.2,0,0.09,0)
|
||||
surfaceMenuCloseButton.Parent = surfaceMenu
|
||||
|
||||
local closedState = Instance.new("BoolValue")
|
||||
closedState.RobloxLocked = true
|
||||
closedState.Name = "ClosedState"
|
||||
closedState.Parent = surfaceMenuCloseButton
|
||||
|
||||
setUpCloseButtonState(surfaceMenuCloseButton)
|
||||
|
||||
if game.CoreGui.Version >= 2 then
|
||||
local function setupTweenTransition(button, menu, outXScale, inXScale)
|
||||
button.Changed:connect(
|
||||
function(property)
|
||||
if property ~= "Selected" then
|
||||
return
|
||||
end
|
||||
if button.Selected then
|
||||
menu:TweenPosition(UDim2.new(inXScale, menu.Position.X.Offset, menu.Position.Y.Scale, menu.Position.Y.Offset),
|
||||
Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||
else
|
||||
menu:TweenPosition(UDim2.new(outXScale, menu.Position.X.Offset, menu.Position.Y.Scale, menu.Position.Y.Offset),
|
||||
Enum.EasingDirection.In, Enum.EasingStyle.Quart, 0.5, true)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
setupTweenTransition(paintTool, paintMenu, -2.7, 2.6)
|
||||
setupTweenTransition(surfaceTool, surfaceMenu, -2.6, 2.6)
|
||||
setupTweenTransition(materialTool, materialMenu, -4, 1.4)
|
||||
end
|
||||
|
||||
end)
|
153
scripts/game/2011E/cores/ToolTipper.lua
Normal file
153
scripts/game/2011E/cores/ToolTipper.lua
Normal file
@ -0,0 +1,153 @@
|
||||
-- Creates the tool tips for the new gui!
|
||||
|
||||
delay(0, function()
|
||||
|
||||
local topLeftControl = game:GetService("CoreGui").RobloxGui:FindFirstChild("TopLeftControl")
|
||||
local bottomLeftControl = game:GetService("CoreGui").RobloxGui:FindFirstChild("BottomLeftControl")
|
||||
local bottomRightControl = game:GetService("CoreGui").RobloxGui:FindFirstChild("BottomRightControl")
|
||||
|
||||
local frame = Instance.new("TextLabel")
|
||||
frame.RobloxLocked = true
|
||||
frame.Name = "ToolTip"
|
||||
frame.Text = "Hi! I'm a ToolTip!"
|
||||
frame.ZIndex = 10
|
||||
frame.Size = UDim2.new(2,0,1,0)
|
||||
frame.Position = UDim2.new(1,0,0,0)
|
||||
frame.BackgroundColor3 = Color3.new(1,1,153/255)
|
||||
frame.BackgroundTransparency = 1
|
||||
frame.TextTransparency = 1
|
||||
frame.TextWrap = true
|
||||
|
||||
local inside = Instance.new("BoolValue")
|
||||
inside.RobloxLocked = true
|
||||
inside.Name = "inside"
|
||||
inside.Value = false
|
||||
inside.Parent = frame
|
||||
|
||||
function setUpListeners(frame)
|
||||
local fadeSpeed = 0.1
|
||||
frame.Parent.MouseEnter:connect(function()
|
||||
frame.inside.Value = true
|
||||
wait(1.2)
|
||||
if frame.inside.Value then
|
||||
while frame.inside.Value and frame.BackgroundTransparency > 0 do
|
||||
frame.BackgroundTransparency = frame.BackgroundTransparency - fadeSpeed
|
||||
frame.TextTransparency = frame.TextTransparency - fadeSpeed
|
||||
wait()
|
||||
end
|
||||
end
|
||||
end)
|
||||
frame.Parent.MouseLeave:connect(function()
|
||||
frame.inside.Value = false
|
||||
frame.BackgroundTransparency = 1
|
||||
frame.TextTransparency = 1
|
||||
end)
|
||||
frame.Parent.MouseButton1Click:connect(function()
|
||||
frame.inside.Value = false
|
||||
frame.BackgroundTransparency = 1
|
||||
frame.TextTransparency = 1
|
||||
end)
|
||||
end
|
||||
|
||||
----------------- set up Top Left Tool Tips --------------------------
|
||||
|
||||
local topLeftChildren = topLeftControl:GetChildren()
|
||||
|
||||
for i = 1, #topLeftChildren do
|
||||
|
||||
if topLeftChildren[i].Name == "Help" then
|
||||
local helpTip = frame:clone()
|
||||
helpTip.RobloxLocked = true
|
||||
helpTip.Text = "Help"
|
||||
helpTip.Parent = topLeftChildren[i]
|
||||
setUpListeners(helpTip)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
---------------- set up Bottom Left Tool Tips -------------------------
|
||||
|
||||
local bottomLeftChildren = bottomLeftControl:GetChildren()
|
||||
|
||||
for i = 1, #bottomLeftChildren do
|
||||
|
||||
if bottomLeftChildren[i].Name == "Exit" then
|
||||
local exitTip = frame:clone()
|
||||
exitTip.RobloxLocked = true
|
||||
exitTip.Text = "Leave Place"
|
||||
exitTip.Position = UDim2.new(0,0,-1,0)
|
||||
exitTip.Size = UDim2.new(1,0,1,0)
|
||||
exitTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(exitTip)
|
||||
elseif bottomLeftChildren[i].Name == "TogglePlayMode" then
|
||||
local playTip = frame:clone()
|
||||
playTip.RobloxLocked = true
|
||||
playTip.Text = "Roblox Studio"
|
||||
playTip.Position = UDim2.new(0,0,-1,0)
|
||||
playTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(playTip)
|
||||
elseif bottomLeftChildren[i].Name == "ToolButton" then
|
||||
local toolTip = frame:clone()
|
||||
toolTip.RobloxLocked = true
|
||||
toolTip.Text = "Build Tools"
|
||||
toolTip.Position = UDim2.new(0,0,-1,0)
|
||||
toolTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(toolTip)
|
||||
elseif bottomLeftChildren[i].Name == "SettingsButton" then
|
||||
local toolTip = frame:clone()
|
||||
toolTip.RobloxLocked = true
|
||||
toolTip.Text = "Settings"
|
||||
toolTip.Position = UDim2.new(0,0,-1,0)
|
||||
toolTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(toolTip)
|
||||
end
|
||||
end
|
||||
|
||||
---------------- set up Bottom Right Tool Tips -------------------------
|
||||
|
||||
local bottomRightChildren = bottomRightControl:GetChildren()
|
||||
|
||||
for i = 1, #bottomRightChildren do
|
||||
|
||||
if bottomRightChildren[i].Name == "ToggleFullScreen" then
|
||||
local fullScreen = frame:clone()
|
||||
fullScreen.RobloxLocked = true
|
||||
fullScreen.Text = "Fullscreen"
|
||||
fullScreen.Position = UDim2.new(-1,0,-1,0)
|
||||
fullScreen.Parent = bottomRightChildren[i]
|
||||
setUpListeners(fullScreen)
|
||||
elseif bottomRightChildren[i].Name == "ReportAbuse" then
|
||||
local abuseTip = frame:clone()
|
||||
abuseTip.RobloxLocked = true
|
||||
abuseTip.Text = "Report Abuse"
|
||||
abuseTip.Position = UDim2.new(0,0,-1,0)
|
||||
abuseTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(abuseTip)
|
||||
elseif bottomRightChildren[i].Name == "Screenshot" then
|
||||
local shotTip = frame:clone()
|
||||
shotTip.RobloxLocked = true
|
||||
shotTip.Text = "Screenshot"
|
||||
shotTip.Position = UDim2.new(-1,0,-2,0)
|
||||
shotTip.Size = UDim2.new(3,0,2,0)
|
||||
shotTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(shotTip)
|
||||
elseif bottomRightChildren[i].Name:find("Camera") ~= nil then
|
||||
local cameraTip = frame:clone()
|
||||
cameraTip.RobloxLocked = true
|
||||
cameraTip.Text = "Camera View"
|
||||
cameraTip.Position = UDim2.new(0,0,-2,5,0)
|
||||
cameraTip.Size = UDim2.new(4,0,2.5,0)
|
||||
cameraTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(cameraTip)
|
||||
elseif bottomRightChildren[i].Name == "RecordToggle" then
|
||||
local recordTip = frame:clone()
|
||||
recordTip.RobloxLocked = true
|
||||
recordTip.Text = "Take Video"
|
||||
recordTip.Position = UDim2.new(0,0,-1.1,0)
|
||||
recordTip.Size = UDim2.new(1,0,1,0)
|
||||
recordTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(recordTip)
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
@ -3,50 +3,17 @@
|
||||
<External>nil</External>
|
||||
<Item class="Script" referent="RBX0">
|
||||
<Properties>
|
||||
<bool name="Archivable">true</bool>
|
||||
<bool name="Disabled">false</bool>
|
||||
<Content name="LinkedSource"><null></null></Content>
|
||||
<string name="Name">Sorter</string>
|
||||
<ProtectedString name="Source">print("Special thanks to Bitl, Carrot, iago, winsupermario1234, Khangaroo, drslicendice, coke, TheLivingBee, Raymonf, and a bunch of play - testers for help making 2011 fully stable and work. 8)")
|
||||
script.Dialogs:clone().Parent = game.StarterGui
|
||||
script.ReenableDialogScript:clone().Parent = game.Lighting
|
||||
script.TimeoutScript:clone().Parent = game.Lighting
|
||||
script.CoreDialogScripts:clone().Parent = game.Lighting
|
||||
script.ResetCommand:clone().Parent = game.Workspace
|
||||
script:remove()</ProtectedString>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
<Item class="Script" referent="RBX1">
|
||||
<Properties>
|
||||
<bool name="Archivable">true</bool>
|
||||
<bool name="Disabled">true</bool>
|
||||
<Content name="LinkedSource"><null></null></Content>
|
||||
<string name="Name">ReenableDialogScript</string>
|
||||
<ProtectedString name="Source">wait(5)
|
||||
local dialog = script.Parent
|
||||
if dialog:IsA("Dialog") then
|
||||
dialog.InUse = false
|
||||
end
|
||||
script:Remove()
|
||||
</ProtectedString>
|
||||
</Properties>
|
||||
</Item>
|
||||
<Item class="Script" referent="RBX2">
|
||||
<Properties>
|
||||
<bool name="Archivable">true</bool>
|
||||
<bool name="Disabled">true</bool>
|
||||
<Content name="LinkedSource"><null></null></Content>
|
||||
<string name="Name">TimeoutScript</string>
|
||||
<ProtectedString name="Source">wait(5)
|
||||
local dialog = script.Parent
|
||||
if dialog:IsA("Dialog") then
|
||||
dialog.InUse = false
|
||||
end
|
||||
script:Remove()
|
||||
</ProtectedString>
|
||||
</Properties>
|
||||
</Item>
|
||||
<Item class="Script" referent="RBX3">
|
||||
<Properties>
|
||||
<bool name="Archivable">true</bool>
|
||||
<bool name="Disabled">false</bool>
|
||||
<Content name="LinkedSource"><null></null></Content>
|
||||
<string name="Name">ResetCommand</string>
|
||||
@ -66,636 +33,57 @@ function onPlayerEntered(newPlayer)
|
||||
end
|
||||
|
||||
game.Players.ChildAdded:connect(onPlayerEntered)</ProtectedString>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
<Item class="ScreenGui" referent="RBX4">
|
||||
<Item class="Model" referent="RBX2">
|
||||
<Properties>
|
||||
<bool name="Archivable">true</bool>
|
||||
<string name="Name">Dialogs</string>
|
||||
<CoordinateFrame name="ModelInPrimary">
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
<Z>0</Z>
|
||||
<R00>1</R00>
|
||||
<R01>0</R01>
|
||||
<R02>0</R02>
|
||||
<R10>0</R10>
|
||||
<R11>1</R11>
|
||||
<R12>0</R12>
|
||||
<R20>0</R20>
|
||||
<R21>0</R21>
|
||||
<R22>1</R22>
|
||||
</CoordinateFrame>
|
||||
<string name="Name">CoreDialogScripts</string>
|
||||
<Ref name="PrimaryPart">null</Ref>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
<Item class="Frame" referent="RBX5">
|
||||
<Item class="Script" referent="RBX3">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<bool name="Archivable">true</bool>
|
||||
<Color3 name="BackgroundColor3">4288914085</Color3>
|
||||
<float name="BackgroundTransparency">1</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<bool name="Draggable">false</bool>
|
||||
<string name="Name">ControlFrame</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>1</XS>
|
||||
<XO>0</XO>
|
||||
<YS>1</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<token name="Style">0</token>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
</Properties>
|
||||
<Item class="Frame" referent="RBX6">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<bool name="Archivable">true</bool>
|
||||
<Color3 name="BackgroundColor3">4288914085</Color3>
|
||||
<float name="BackgroundTransparency">1</float>
|
||||
<Color3 name="BorderColor3">4279970357</Color3>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<bool name="Draggable">false</bool>
|
||||
<string name="Name">BottomLeftControl</string>
|
||||
<UDim2 name="Position">
|
||||
<XS>0</XS>
|
||||
<XO>0</XO>
|
||||
<YS>1</YS>
|
||||
<YO>-46</YO>
|
||||
</UDim2>
|
||||
<UDim2 name="Size">
|
||||
<XS>0</XS>
|
||||
<XO>130</XO>
|
||||
<YS>0</YS>
|
||||
<YO>46</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<token name="Style">0</token>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
<Item class="LocalScript" referent="RBX7">
|
||||
<Properties>
|
||||
<bool name="Archivable">true</bool>
|
||||
<bool name="Disabled">false</bool>
|
||||
<bool name="Disabled">true</bool>
|
||||
<Content name="LinkedSource"><null></null></Content>
|
||||
<string name="Name">Init</string>
|
||||
<ProtectedString name="Source">--rbxsig%XeVmMtUuu+dXh8pEbcaTkr2m9RJZXY42LaACJ12YYcuPtOUxy4Azi8uMDGU8ZTh7cvZC9BlOWgqmZHKjESSdfOZl0/cgd2JKHPZ2UqiqA1slJa7R5GtCcGXlNPHW8KDYgJGRuwe8h5CSiMDOl6QLTSEegTOG7fzHk/n1AFcRN8I=%
|
||||
--rbxassetid%39250920%
|
||||
--fixed by Carrot#0559
|
||||
|
||||
function waitForProperty(instance, name)
|
||||
while not instance[name] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
|
||||
local beter = game.Lighting
|
||||
|
||||
function waitForDialogChildrenMyLord(beter, name)
|
||||
while not beter:FindFirstChild(name) do
|
||||
beter.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
|
||||
local bois = game.Players.LocalPlayer.PlayerGui
|
||||
|
||||
function waitForFaker(bois, name)
|
||||
while not bois:FindFirstChild(name) do
|
||||
bois.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 = game.Lighting.ReenableDialogScript
|
||||
local reenableDialogScript = game.Lighting.TimeoutScript
|
||||
local dialogMap = {}
|
||||
local dialogConnections = {}
|
||||
|
||||
local gui = nil
|
||||
--waitForDialogChildrenMyLord(game,"CoreGui")
|
||||
--waitForDialogChildrenMyLord(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.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.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.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.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)
|
||||
|
||||
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.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.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
|
||||
|
||||
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.Parent = mainFrame
|
||||
|
||||
for n, obj in pairs(choices) do
|
||||
obj.Parent = mainFrame
|
||||
end
|
||||
lastChoice.Parent = mainFrame
|
||||
|
||||
mainFrame.Parent = parent
|
||||
end
|
||||
|
||||
function presentDialogChoices(talkingPart, dialogChoices)
|
||||
if not currentConversationDialog then
|
||||
return
|
||||
end
|
||||
|
||||
currentConversationPartner = talkingPart
|
||||
local 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)
|
||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||
return
|
||||
end
|
||||
|
||||
for dialog, gui in pairs(dialogMap) do
|
||||
if dialog and gui then
|
||||
gui.Enabled = false
|
||||
end
|
||||
end
|
||||
|
||||
renewKillswitch(dialog)
|
||||
|
||||
delay(1, checkForLeaveArea)
|
||||
doDialog(dialog)
|
||||
end
|
||||
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
|
||||
<string name="Name">ReenableDialogScript</string>
|
||||
<ProtectedString name="Source">wait(5)
|
||||
local dialog = script.Parent
|
||||
if dialog:IsA("Dialog") then
|
||||
dialog.InUse = false
|
||||
end
|
||||
|
||||
function addDialog(dialog)
|
||||
if dialog.Parent then
|
||||
if dialog.Parent:IsA("BasePart") then
|
||||
local chatGui = chatNotificationGui:clone()
|
||||
chatGui.Enabled = not dialog.InUse
|
||||
chatGui.Adornee = dialog.Parent
|
||||
chatGui.Parent = game.Players.LocalPlayer.PlayerGui
|
||||
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)
|
||||
else -- still need to listen to parent changes even if current parent is not a BasePart
|
||||
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)
|
||||
end
|
||||
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
|
||||
|
||||
waitForDialogChildrenMyLord(model,"TimeoutScript")
|
||||
timeoutScript = model.TimeoutScript
|
||||
waitForDialogChildrenMyLord(model,"ReenableDialogScript")
|
||||
reenableDialogScript = model.ReenableDialogScript
|
||||
end
|
||||
]]--
|
||||
|
||||
function onLoad()
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
player = game.Players.LocalPlayer
|
||||
waitForProperty(player, "Character")
|
||||
|
||||
--print("Fetching Scripts")
|
||||
--fetchScripts()
|
||||
|
||||
--print("Creating Guis")
|
||||
createChatNotificationGui()
|
||||
|
||||
waitForFaker(bois,"Dialogs")
|
||||
--print("Creating MessageDialog")
|
||||
createMessageDialog()
|
||||
messageDialog.Parent = game.Players.LocalPlayer.PlayerGui.Dialogs
|
||||
|
||||
|
||||
--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.Parent = game.Players.LocalPlayer.PlayerGui.Dialogs.ControlFrame.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()</ProtectedString>
|
||||
script:Remove()
|
||||
</ProtectedString>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
<Item class="Script" referent="RBX4">
|
||||
<Properties>
|
||||
<bool name="Disabled">true</bool>
|
||||
<Content name="LinkedSource"><null></null></Content>
|
||||
<string name="Name">TimeoutScript</string>
|
||||
<ProtectedString name="Source">wait(15)
|
||||
local dialog = script.Parent
|
||||
if dialog:IsA("Dialog") then
|
||||
dialog.InUse = false
|
||||
end
|
||||
script:Remove()
|
||||
</ProtectedString>
|
||||
<bool name="archivable">true</bool>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
|
@ -1,11 +1,5 @@
|
||||
showServerNotifications = true
|
||||
|
||||
game:GetService("CoreGui").DescendantAdded:connect(function(Child)
|
||||
if (Child:IsA("BaseScript")) and (Child.Name~="SubMenuBuilder") and (Child.Name~="ToolTipper") and (Child.Name~="MainBotChatScript") then
|
||||
Child:Remove()
|
||||
end
|
||||
end)
|
||||
|
||||
pcall(function() settings().Diagnostics:LegacyScriptMode() end)
|
||||
pcall(function() game:GetService("ScriptContext").ScriptsDisabled = false end)
|
||||
|
||||
@ -552,6 +546,7 @@ rbxversion = version()
|
||||
print("ROBLOX Client version '" .. rbxversion .. "' loaded.")
|
||||
|
||||
function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Notifications)
|
||||
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.")
|
||||
local NetworkServer=game:GetService("NetworkServer")
|
||||
local RunService = game:GetService("RunService")
|
||||
@ -587,7 +582,7 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if (PlayerService.NumPlayers > PlayerService.MaxPlayers) then
|
||||
KickPlayer(Player, "Too many players on server.")
|
||||
else
|
||||
@ -608,7 +603,7 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti
|
||||
end
|
||||
|
||||
Player.Changed:connect(function(Property)
|
||||
if (Property=="Character") and (Player.Character~=nil) then
|
||||
if (Player.Character~=nil) then
|
||||
local Character=Player.Character
|
||||
local Humanoid=Character:FindFirstChild("Humanoid")
|
||||
if (Humanoid~=nil) then
|
||||
@ -635,18 +630,9 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti
|
||||
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,Ticket)
|
||||
dofile("rbxasset://scripts\\cores\\StarterScript.lua")
|
||||
pcall(function() game:SetPlaceID(-1, false) end)
|
||||
pcall(function() game:GetService("Players"):SetChatStyle(Enum.ChatStyle.ClassicAndBubble) end)
|
||||
|
||||
pcall(function()
|
||||
game:GetService("GuiService").Changed:connect(function()
|
||||
pcall(function() game:GetService("GuiService").ShowLegacyPlayerList=true end)
|
||||
pcall(function() game.CoreGui.RobloxGui.PlayerListScript:Remove() end)
|
||||
pcall(function() game.CoreGui.RobloxGui.PlayerListTopRightFrame:Remove() end)
|
||||
pcall(function() game.CoreGui.RobloxGui.BigPlayerListWindowImposter:Remove() end)
|
||||
pcall(function() game.CoreGui.RobloxGui.BigPlayerlist:Remove() end)
|
||||
end)
|
||||
end)
|
||||
game:GetService("RunService"):Run()
|
||||
assert((ServerIP~=nil and ServerPort~=nil),"CSConnect Error: ServerIP and ServerPort must be defined.")
|
||||
local function SetMessage(Message) game:SetMessage(Message) end
|
||||
@ -750,6 +736,7 @@ function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Hat1ID,Hat2ID,Hat3ID,He
|
||||
end
|
||||
|
||||
function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,IconType,ItemID)
|
||||
dofile("rbxasset://scripts\\cores\\StarterScript.lua")
|
||||
game:GetService("RunService"):Run()
|
||||
local plr = game.Players:CreateLocalPlayer(UserID)
|
||||
plr.Name = PlayerName
|
||||
@ -766,16 +753,14 @@ function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,
|
||||
game.GuiRoot.ScoreHud:Remove()
|
||||
plr.CharacterAppearance=0
|
||||
InitalizeClientAppearance(plr,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,LeftArmColorID,RightArmColorID,LeftLegColorID,RightLegColorID,TShirtID,ShirtID,PantsID,FaceID,HeadID,ItemID)
|
||||
wait(0.5)
|
||||
LoadCharacterNew(newWaitForChild(plr,"Appearance"),plr.Character,false)
|
||||
game.Workspace:InsertContent("rbxasset://Fonts//libraries.rbxm")
|
||||
newWaitForChild(game.StarterGui, "Dialogs")
|
||||
game.StarterGui.Dialogs:clone().Parent = plr.PlayerGui
|
||||
newWaitForChild(game.StarterGui, "Playerlist")
|
||||
game.StarterGui.Playerlist:clone().Parent = plr.PlayerGui
|
||||
game:GetService("Visit"):SetUploadUrl("")
|
||||
while true do
|
||||
wait(0.001)
|
||||
if (plr.Character ~= nil) then
|
||||
print()
|
||||
if (plr.Character:findFirstChild("Humanoid") and (plr.Character.Humanoid.Health == 0)) then
|
||||
wait(5)
|
||||
plr:LoadCharacter()
|
||||
@ -790,6 +775,7 @@ function CSSolo(UserID,PlayerName,Hat1ID,Hat2ID,Hat3ID,HeadColorID,TorsoColorID,
|
||||
end
|
||||
|
||||
function CSStudio()
|
||||
dofile("rbxasset://scripts\\cores\\StarterScript.lua")
|
||||
end
|
||||
|
||||
_G.CSServer=CSServer
|
||||
|
479
scripts/game/2011M/cores/BackpackBuilder.lua
Normal file
479
scripts/game/2011M/cores/BackpackBuilder.lua
Normal file
@ -0,0 +1,479 @@
|
||||
--- ATTENTION!!! There are site-specific ids at the end of this script!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
delay(0, function()
|
||||
|
||||
if game.CoreGui.Version < 3 then return end -- peace out if we aren't using the right client
|
||||
|
||||
local gui = game:GetService("CoreGui").RobloxGui
|
||||
|
||||
-- A couple of necessary functions
|
||||
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,"Players")
|
||||
waitForProperty(game.Players,"LocalPlayer")
|
||||
local player = game.Players.LocalPlayer
|
||||
|
||||
-- First up is the current loadout
|
||||
local CurrentLoadout = Instance.new("Frame")
|
||||
CurrentLoadout.Name = "CurrentLoadout"
|
||||
CurrentLoadout.Position = UDim2.new(0.5, -240, 1, -85)
|
||||
CurrentLoadout.Size = UDim2.new(0, 480, 0, 48)
|
||||
CurrentLoadout.BackgroundTransparency = 1
|
||||
CurrentLoadout.RobloxLocked = true
|
||||
CurrentLoadout.Parent = gui
|
||||
|
||||
local Debounce = Instance.new("BoolValue")
|
||||
Debounce.Name = "Debounce"
|
||||
Debounce.RobloxLocked = true
|
||||
Debounce.Parent = CurrentLoadout
|
||||
|
||||
local BackpackButton = Instance.new("ImageButton")
|
||||
BackpackButton.RobloxLocked = true
|
||||
BackpackButton.Visible = false
|
||||
BackpackButton.Name = "BackpackButton"
|
||||
BackpackButton.BackgroundTransparency = 1
|
||||
BackpackButton.Image = "rbxasset://textures/ui/backpackButton.png"
|
||||
BackpackButton.Position = UDim2.new(0.5, -195, 1, -30)
|
||||
BackpackButton.Size = UDim2.new(0,107,0,26)
|
||||
waitForChild(gui,"ControlFrame")
|
||||
BackpackButton.Parent = gui.ControlFrame
|
||||
|
||||
for i = 0, 9 do
|
||||
local slotFrame = Instance.new("Frame")
|
||||
slotFrame.RobloxLocked = true
|
||||
slotFrame.BackgroundColor3 = Color3.new(0,0,0)
|
||||
slotFrame.BackgroundTransparency = 1
|
||||
slotFrame.BorderColor3 = Color3.new(1,1,1)
|
||||
slotFrame.Name = "Slot" .. tostring(i)
|
||||
if i == 0 then
|
||||
slotFrame.Position = UDim2.new(0.9,0,0,0)
|
||||
else
|
||||
slotFrame.Position = UDim2.new((i - 1) * 0.1,0,0,0)
|
||||
end
|
||||
slotFrame.Size = UDim2.new(0.1,0,1,0)
|
||||
slotFrame.Parent = CurrentLoadout
|
||||
end
|
||||
|
||||
local TempSlot = Instance.new("ImageButton")
|
||||
TempSlot.Name = "TempSlot"
|
||||
TempSlot.Active = true
|
||||
TempSlot.Size = UDim2.new(1,0,1,0)
|
||||
TempSlot.Style = Enum.ButtonStyle.RobloxButton
|
||||
TempSlot.Visible = false
|
||||
TempSlot.RobloxLocked = true
|
||||
TempSlot.Parent = CurrentLoadout
|
||||
|
||||
-- TempSlot Children
|
||||
local GearReference = Instance.new("ObjectValue")
|
||||
GearReference.Name = "GearReference"
|
||||
GearReference.RobloxLocked = true
|
||||
GearReference.Parent = TempSlot
|
||||
|
||||
local Kill = Instance.new("BoolValue")
|
||||
Kill.Name = "Kill"
|
||||
Kill.RobloxLocked = true
|
||||
Kill.Parent = TempSlot
|
||||
|
||||
local GearImage = Instance.new("ImageLabel")
|
||||
GearImage.Name = "GearImage"
|
||||
GearImage.BackgroundTransparency = 1
|
||||
GearImage.Position = UDim2.new(0,-7,0,-7)
|
||||
GearImage.Size = UDim2.new(1,14,1,14)
|
||||
GearImage.ZIndex = 2
|
||||
GearImage.RobloxLocked = true
|
||||
GearImage.Parent = TempSlot
|
||||
|
||||
local SlotNumber = Instance.new("TextLabel")
|
||||
SlotNumber.Name = "SlotNumber"
|
||||
SlotNumber.BackgroundTransparency = 1
|
||||
SlotNumber.BorderSizePixel = 0
|
||||
SlotNumber.Font = Enum.Font.ArialBold
|
||||
SlotNumber.FontSize = Enum.FontSize.Size18
|
||||
SlotNumber.Position = UDim2.new(0,-7,0,-7)
|
||||
SlotNumber.Size = UDim2.new(0,10,0,15)
|
||||
SlotNumber.TextColor3 = Color3.new(1,1,1)
|
||||
SlotNumber.TextTransparency = 0
|
||||
SlotNumber.TextXAlignment = Enum.TextXAlignment.Left
|
||||
SlotNumber.TextYAlignment = Enum.TextYAlignment.Bottom
|
||||
SlotNumber.ZIndex = 4
|
||||
SlotNumber.RobloxLocked = true
|
||||
SlotNumber.Parent = TempSlot
|
||||
|
||||
local SlotNumberDownShadow = SlotNumber:clone()
|
||||
SlotNumberDownShadow.Name = "SlotNumberDownShadow"
|
||||
SlotNumberDownShadow.TextColor3 = Color3.new(0,0,0)
|
||||
SlotNumberDownShadow.ZIndex = 3
|
||||
SlotNumberDownShadow.Position = UDim2.new(0,-6,0,-6)
|
||||
SlotNumberDownShadow.Parent = TempSlot
|
||||
|
||||
local SlotNumberUpShadow = SlotNumberDownShadow:clone()
|
||||
SlotNumberUpShadow.Name = "SlotNumberUpShadow"
|
||||
SlotNumberUpShadow.Position = UDim2.new(0,-8,0,-8)
|
||||
SlotNumberUpShadow.Parent = TempSlot
|
||||
|
||||
local GearText = Instance.new("TextLabel")
|
||||
GearText.RobloxLocked = true
|
||||
GearText.Name = "GearText"
|
||||
GearText.BackgroundTransparency = 1
|
||||
GearText.Font = Enum.Font.Arial
|
||||
GearText.FontSize = Enum.FontSize.Size14
|
||||
GearText.Position = UDim2.new(0,-8,0,-8)
|
||||
GearText.ZIndex = 2
|
||||
GearText.Size = UDim2.new(1,16,1,16)
|
||||
GearText.Text = ""
|
||||
GearText.TextColor3 = Color3.new(1,1,1)
|
||||
GearText.TextWrap = true
|
||||
GearText.Parent = TempSlot
|
||||
|
||||
--- Great, now lets make the inventory!
|
||||
|
||||
local Backpack = Instance.new("Frame")
|
||||
Backpack.Visible = false
|
||||
Backpack.Name = "Backpack"
|
||||
Backpack.Position = UDim2.new(0.5,0,0.5,0)
|
||||
Backpack.Size = UDim2.new(0,0,0,0)
|
||||
Backpack.Style = Enum.FrameStyle.RobloxSquare
|
||||
Backpack.RobloxLocked = true
|
||||
Backpack.Parent = gui
|
||||
Backpack.Active = true
|
||||
|
||||
-- Backpack Children
|
||||
local SwapSlot = Instance.new("BoolValue")
|
||||
SwapSlot.RobloxLocked = true
|
||||
SwapSlot.Name = "SwapSlot"
|
||||
SwapSlot.Parent = Backpack
|
||||
|
||||
-- SwapSlot Children
|
||||
local Slot = Instance.new("IntValue")
|
||||
Slot.RobloxLocked = true
|
||||
Slot.Name = "Slot"
|
||||
Slot.Parent = SwapSlot
|
||||
|
||||
local GearButton = Instance.new("ObjectValue")
|
||||
GearButton.RobloxLocked = true
|
||||
GearButton.Name = "GearButton"
|
||||
GearButton.Parent = SwapSlot
|
||||
|
||||
local Tabs = Instance.new("Frame")
|
||||
Tabs.Name = "Tabs"
|
||||
Tabs.Visible = false
|
||||
Tabs.RobloxLocked = true
|
||||
Tabs.BackgroundColor3 = Color3.new(0,0,0)
|
||||
Tabs.BackgroundTransparency = 0.5
|
||||
Tabs.BorderSizePixel = 0
|
||||
Tabs.Position = UDim2.new(0,-8,-0.1,-8)
|
||||
Tabs.Size = UDim2.new(1,16,0.1,0)
|
||||
Tabs.Parent = Backpack
|
||||
|
||||
-- Tabs Children
|
||||
local InventoryButton = Instance.new("ImageButton")
|
||||
InventoryButton.RobloxLocked = true
|
||||
InventoryButton.Name = "InventoryButton"
|
||||
InventoryButton.Size = UDim2.new(0.12,0,1,0)
|
||||
InventoryButton.Style = Enum.ButtonStyle.RobloxButton
|
||||
InventoryButton.Selected = true
|
||||
InventoryButton.Parent = Tabs
|
||||
|
||||
-- InventoryButton Children
|
||||
local InventoryText = Instance.new("TextLabel")
|
||||
InventoryText.RobloxLocked = true
|
||||
InventoryText.Name = "InventoryText"
|
||||
InventoryText.BackgroundTransparency = 1
|
||||
InventoryText.Font = Enum.Font.ArialBold
|
||||
InventoryText.FontSize = Enum.FontSize.Size18
|
||||
InventoryText.Position = UDim2.new(0,-7,0,-7)
|
||||
InventoryText.Size = UDim2.new(1,14,1,14)
|
||||
InventoryText.Text = "Gear"
|
||||
InventoryText.TextColor3 = Color3.new(1,1,1)
|
||||
InventoryText.Parent = InventoryButton
|
||||
|
||||
local closeButton = Instance.new("TextButton")
|
||||
closeButton.RobloxLocked = true
|
||||
closeButton.Name = "CloseButton"
|
||||
closeButton.Font = Enum.Font.ArialBold
|
||||
closeButton.FontSize = Enum.FontSize.Size24
|
||||
closeButton.Position = UDim2.new(1,-33,0,2)
|
||||
closeButton.Size = UDim2.new(0,30,0,30)
|
||||
closeButton.Style = Enum.ButtonStyle.RobloxButton
|
||||
closeButton.Text = "X"
|
||||
closeButton.TextColor3 = Color3.new(1,1,1)
|
||||
closeButton.Parent = Tabs
|
||||
|
||||
local Gear = Instance.new("Frame")
|
||||
Gear.Name = "Gear"
|
||||
Gear.RobloxLocked = true
|
||||
Gear.BackgroundTransparency = 1
|
||||
Gear.Size = UDim2.new(1,0,1,0)
|
||||
Gear.Parent = Backpack
|
||||
|
||||
-- Gear Children
|
||||
local GearGrid = Instance.new("Frame")
|
||||
GearGrid.RobloxLocked = true
|
||||
GearGrid.Name = "GearGrid"
|
||||
GearGrid.Size = UDim2.new(0.69,0,1,0)
|
||||
GearGrid.Style = Enum.FrameStyle.RobloxSquare
|
||||
GearGrid.Parent = Gear
|
||||
|
||||
-- GearGrid Children
|
||||
local ResetFrame = Instance.new("Frame")
|
||||
ResetFrame.RobloxLocked = true
|
||||
ResetFrame.Name = "ResetFrame"
|
||||
ResetFrame.Visible = false
|
||||
ResetFrame.BackgroundTransparency = 1
|
||||
ResetFrame.Size = UDim2.new(0,32,0,64)
|
||||
ResetFrame.Parent = GearGrid
|
||||
|
||||
-- ResetFrame Children
|
||||
local ResetImageLabel = Instance.new("ImageLabel")
|
||||
ResetImageLabel.RobloxLocked = true
|
||||
ResetImageLabel.Name = "ResetImageLabel"
|
||||
ResetImageLabel.Image = "rbxasset://textures/ui/ResetIcon.png"
|
||||
ResetImageLabel.BackgroundTransparency = 1
|
||||
ResetImageLabel.Position = UDim2.new(0,0,0,-12)
|
||||
ResetImageLabel.Size = UDim2.new(0.8,0,0.79,0)
|
||||
ResetImageLabel.ZIndex = 2
|
||||
ResetImageLabel.Parent = ResetFrame
|
||||
|
||||
local ResetButtonBorder = Instance.new("TextButton")
|
||||
ResetButtonBorder.RobloxLocked = true
|
||||
ResetButtonBorder.Name = "ResetButtonBorder"
|
||||
ResetButtonBorder.Position = UDim2.new(0,-3,0,-7)
|
||||
ResetButtonBorder.Size = UDim2.new(1,0,0.64,0)
|
||||
ResetButtonBorder.Style = Enum.ButtonStyle.RobloxButton
|
||||
ResetButtonBorder.Text = ""
|
||||
ResetButtonBorder.Parent = ResetFrame
|
||||
|
||||
|
||||
local SearchFrame = Instance.new("Frame")
|
||||
SearchFrame.RobloxLocked = true
|
||||
SearchFrame.Name = "SearchFrame"
|
||||
SearchFrame.BackgroundTransparency = 1
|
||||
SearchFrame.Position = UDim2.new(1,-150,0,0)
|
||||
SearchFrame.Size = UDim2.new(0,150,0,25)
|
||||
SearchFrame.Parent = GearGrid
|
||||
|
||||
-- SearchFrame Children
|
||||
local SearchButton = Instance.new("ImageButton")
|
||||
SearchButton.RobloxLocked = true
|
||||
SearchButton.Name = "SearchButton"
|
||||
SearchButton.Size = UDim2.new(0,25,0,25)
|
||||
SearchButton.BackgroundTransparency = 1
|
||||
SearchButton.Image = "rbxasset://textures/ui/SearchIcon.png"
|
||||
SearchButton.Parent = SearchFrame
|
||||
|
||||
local SearchBoxFrame = Instance.new("TextButton")
|
||||
SearchBoxFrame.RobloxLocked = true
|
||||
SearchBoxFrame.Position = UDim2.new(0,26,0,0)
|
||||
SearchBoxFrame.Size = UDim2.new(0,121,0,25)
|
||||
SearchBoxFrame.Name = "SearchBoxFrame"
|
||||
SearchBoxFrame.Text = ""
|
||||
SearchBoxFrame.Style = Enum.ButtonStyle.RobloxButton
|
||||
SearchBoxFrame.Parent = SearchFrame
|
||||
|
||||
-- SearchBoxFrame Children
|
||||
local SearchBox = Instance.new("TextBox")
|
||||
SearchBox.RobloxLocked = true
|
||||
SearchBox.Name = "SearchBox"
|
||||
SearchBox.BackgroundTransparency = 1
|
||||
SearchBox.Font = Enum.Font.ArialBold
|
||||
SearchBox.FontSize = Enum.FontSize.Size12
|
||||
SearchBox.Position = UDim2.new(0,-5,0,-5)
|
||||
SearchBox.Size = UDim2.new(1,10,1,10)
|
||||
SearchBox.TextColor3 = Color3.new(1,1,1)
|
||||
SearchBox.TextXAlignment = Enum.TextXAlignment.Left
|
||||
SearchBox.ZIndex = 2
|
||||
SearchBox.TextWrap = true
|
||||
SearchBox.Text = "Search..."
|
||||
SearchBox.Parent = SearchBoxFrame
|
||||
|
||||
local GearButton = Instance.new("ImageButton")
|
||||
GearButton.RobloxLocked = true
|
||||
GearButton.Visible = false
|
||||
GearButton.Name = "GearButton"
|
||||
GearButton.Size = UDim2.new(0,64,0,64)
|
||||
GearButton.Style = Enum.ButtonStyle.RobloxButton
|
||||
GearButton.Parent = GearGrid
|
||||
|
||||
-- GearButton Children
|
||||
local GearReference = Instance.new("ObjectValue")
|
||||
GearReference.RobloxLocked = true
|
||||
GearReference.Name = "GearReference"
|
||||
GearReference.Parent = GearButton
|
||||
|
||||
local GreyOutButton = Instance.new("Frame")
|
||||
GreyOutButton.RobloxLocked = true
|
||||
GreyOutButton.Name = "GreyOutButton"
|
||||
GreyOutButton.BackgroundTransparency = 0.5
|
||||
GreyOutButton.Size = UDim2.new(1,0,1,0)
|
||||
GreyOutButton.Active = true
|
||||
GreyOutButton.Visible = false
|
||||
GreyOutButton.ZIndex = 3
|
||||
GreyOutButton.Parent = GearButton
|
||||
|
||||
local GearText = Instance.new("TextLabel")
|
||||
GearText.RobloxLocked = true
|
||||
GearText.Name = "GearText"
|
||||
GearText.BackgroundTransparency = 1
|
||||
GearText.Font = Enum.Font.Arial
|
||||
GearText.FontSize = Enum.FontSize.Size14
|
||||
GearText.Position = UDim2.new(0,-8,0,-8)
|
||||
GearText.Size = UDim2.new(1,16,1,16)
|
||||
GearText.Text = ""
|
||||
GearText.ZIndex = 2
|
||||
GearText.TextColor3 = Color3.new(1,1,1)
|
||||
GearText.TextWrap = true
|
||||
GearText.Parent = GearButton
|
||||
|
||||
local GearGridScrollingArea = Instance.new("Frame")
|
||||
GearGridScrollingArea.RobloxLocked = true
|
||||
GearGridScrollingArea.Name = "GearGridScrollingArea"
|
||||
GearGridScrollingArea.Position = UDim2.new(0.7,0,0,0)
|
||||
GearGridScrollingArea.Size = UDim2.new(0,17,1,0)
|
||||
GearGridScrollingArea.BackgroundTransparency = 1
|
||||
GearGridScrollingArea.Parent = Gear
|
||||
|
||||
local GearLoadouts = Instance.new("Frame")
|
||||
GearLoadouts.RobloxLocked = true
|
||||
GearLoadouts.Name = "GearLoadouts"
|
||||
GearLoadouts.BackgroundTransparency = 1
|
||||
GearLoadouts.Position = UDim2.new(0.7,23,0.5,1)
|
||||
GearLoadouts.Size = UDim2.new(0.3,-23,0.5,-1)
|
||||
GearLoadouts.Parent = Gear
|
||||
GearLoadouts.Visible = false
|
||||
|
||||
-- GearLoadouts Children
|
||||
local GearLoadoutsHeader = Instance.new("Frame")
|
||||
GearLoadoutsHeader.RobloxLocked = true
|
||||
GearLoadoutsHeader.Name = "GearLoadoutsHeader"
|
||||
GearLoadoutsHeader.BackgroundColor3 = Color3.new(0,0,0)
|
||||
GearLoadoutsHeader.BackgroundTransparency = 0.2
|
||||
GearLoadoutsHeader.BorderColor3 = Color3.new(1,0,0)
|
||||
GearLoadoutsHeader.Size = UDim2.new(1,2,0.15,-1)
|
||||
GearLoadoutsHeader.Parent = GearLoadouts
|
||||
|
||||
-- GearLoadoutsHeader Children
|
||||
local LoadoutsHeaderText = Instance.new("TextLabel")
|
||||
LoadoutsHeaderText.RobloxLocked = true
|
||||
LoadoutsHeaderText.Name = "LoadoutsHeaderText"
|
||||
LoadoutsHeaderText.BackgroundTransparency = 1
|
||||
LoadoutsHeaderText.Font = Enum.Font.ArialBold
|
||||
LoadoutsHeaderText.FontSize = Enum.FontSize.Size18
|
||||
LoadoutsHeaderText.Size = UDim2.new(1,0,1,0)
|
||||
LoadoutsHeaderText.Text = "Loadouts"
|
||||
LoadoutsHeaderText.TextColor3 = Color3.new(1,1,1)
|
||||
LoadoutsHeaderText.Parent = GearLoadoutsHeader
|
||||
|
||||
local GearLoadoutsScrollingArea = GearGridScrollingArea:clone()
|
||||
GearLoadoutsScrollingArea.RobloxLocked = true
|
||||
GearLoadoutsScrollingArea.Name = "GearLoadoutsScrollingArea"
|
||||
GearLoadoutsScrollingArea.Position = UDim2.new(1,-15,0.15,2)
|
||||
GearLoadoutsScrollingArea.Size = UDim2.new(0,17,0.85,-2)
|
||||
GearLoadoutsScrollingArea.Parent = GearLoadouts
|
||||
|
||||
local LoadoutsList = Instance.new("Frame")
|
||||
LoadoutsList.RobloxLocked = true
|
||||
LoadoutsList.Name = "LoadoutsList"
|
||||
LoadoutsList.Position = UDim2.new(0,0,0.15,2)
|
||||
LoadoutsList.Size = UDim2.new(1,-17,0.85,-2)
|
||||
LoadoutsList.Style = Enum.FrameStyle.RobloxSquare
|
||||
LoadoutsList.Parent = GearLoadouts
|
||||
|
||||
|
||||
local GearPreview = Instance.new("Frame")
|
||||
GearPreview.RobloxLocked = true
|
||||
GearPreview.Name = "GearPreview"
|
||||
GearPreview.Position = UDim2.new(0.7,23,0,0)
|
||||
GearPreview.Size = UDim2.new(0.3,-23,0.5,-1)
|
||||
GearPreview.Style = Enum.FrameStyle.RobloxRound
|
||||
GearPreview.Parent = Gear
|
||||
|
||||
-- GearPreview Children
|
||||
local GearStats = Instance.new("Frame")
|
||||
GearStats.RobloxLocked = true
|
||||
GearStats.Name = "GearStats"
|
||||
GearStats.BackgroundTransparency = 1
|
||||
GearStats.Position = UDim2.new(0,0,0.75,0)
|
||||
GearStats.Size = UDim2.new(1,0,0.25,0)
|
||||
GearStats.Parent = GearPreview
|
||||
|
||||
-- GearStats Children
|
||||
local GearName = Instance.new("TextLabel")
|
||||
GearName.RobloxLocked = true
|
||||
GearName.Name = "GearName"
|
||||
GearName.BackgroundTransparency = 1
|
||||
GearName.Font = Enum.Font.ArialBold
|
||||
GearName.FontSize = Enum.FontSize.Size18
|
||||
GearName.Position = UDim2.new(0,-3,0,0)
|
||||
GearName.Size = UDim2.new(1,6,1,5)
|
||||
GearName.Text = ""
|
||||
GearName.TextColor3 = Color3.new(1,1,1)
|
||||
GearName.TextWrap = true
|
||||
GearName.Parent = GearStats
|
||||
|
||||
local GearImage = Instance.new("ImageLabel")
|
||||
GearImage.RobloxLocked = true
|
||||
GearImage.Name = "GearImage"
|
||||
GearImage.Image = ""
|
||||
GearImage.BackgroundTransparency = 1
|
||||
GearImage.Position = UDim2.new(0.125,0,0,0)
|
||||
GearImage.Size = UDim2.new(0.75,0,0.75,0)
|
||||
GearImage.Parent = GearPreview
|
||||
|
||||
--GearImage Children
|
||||
local GearIcons = Instance.new("Frame")
|
||||
GearIcons.BackgroundColor3 = Color3.new(0,0,0)
|
||||
GearIcons.BackgroundTransparency = 0.5
|
||||
GearIcons.BorderSizePixel = 0
|
||||
GearIcons.RobloxLocked = true
|
||||
GearIcons.Name = "GearIcons"
|
||||
GearIcons.Position = UDim2.new(0.4,2,0.85,-2)
|
||||
GearIcons.Size = UDim2.new(0.6,0,0.15,0)
|
||||
GearIcons.Visible = false
|
||||
GearIcons.Parent = GearImage
|
||||
|
||||
-- GearIcons Children
|
||||
local GenreImage = Instance.new("ImageLabel")
|
||||
GenreImage.RobloxLocked = true
|
||||
GenreImage.Name = "GenreImage"
|
||||
GenreImage.BackgroundColor3 = Color3.new(102/255,153/255,1)
|
||||
GenreImage.BackgroundTransparency = 0.5
|
||||
GenreImage.BorderSizePixel = 0
|
||||
GenreImage.Size = UDim2.new(0.25,0,1,0)
|
||||
GenreImage.Parent = GearIcons
|
||||
|
||||
local AttributeOneImage = GenreImage:clone()
|
||||
AttributeOneImage.RobloxLocked = true
|
||||
AttributeOneImage.Name = "AttributeOneImage"
|
||||
AttributeOneImage.BackgroundColor3 = Color3.new(1,51/255,0)
|
||||
AttributeOneImage.Position = UDim2.new(0.25,0,0,0)
|
||||
AttributeOneImage.Parent = GearIcons
|
||||
|
||||
local AttributeTwoImage = GenreImage:clone()
|
||||
AttributeTwoImage.RobloxLocked = true
|
||||
AttributeTwoImage.Name = "AttributeTwoImage"
|
||||
AttributeTwoImage.BackgroundColor3 = Color3.new(153/255,1,153/255)
|
||||
AttributeTwoImage.Position = UDim2.new(0.5,0,0,0)
|
||||
AttributeTwoImage.Parent = GearIcons
|
||||
|
||||
local AttributeThreeImage = GenreImage:clone()
|
||||
AttributeThreeImage.RobloxLocked = true
|
||||
AttributeThreeImage.Name = "AttributeThreeImage"
|
||||
AttributeThreeImage.BackgroundColor3 = Color3.new(0,0.5,0.5)
|
||||
AttributeThreeImage.Position = UDim2.new(0.75,0,0,0)
|
||||
AttributeThreeImage.Parent = GearIcons
|
||||
|
||||
|
||||
-- Backpack Resizer (handles all backpack resizing junk)
|
||||
--game:GetService("ScriptContext"):AddCoreScript(53878053,Backpack,"BackpackResizer")
|
||||
dofile("rbxasset://scripts\\cores\\BackpackResizer.lua")
|
||||
|
||||
end)
|
2607
scripts/game/2011M/cores/BackpackResizer.lua
Normal file
2607
scripts/game/2011M/cores/BackpackResizer.lua
Normal file
File diff suppressed because it is too large
Load Diff
730
scripts/game/2011M/cores/BackpackScript.lua
Normal file
730
scripts/game/2011M/cores/BackpackScript.lua
Normal file
@ -0,0 +1,730 @@
|
||||
delay(0, function()
|
||||
|
||||
if game.CoreGui.Version < 3 then return end -- peace out if we aren't using the right client
|
||||
|
||||
-- A couple of necessary functions
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--- Begin Locals
|
||||
waitForChild(game,"Players")
|
||||
waitForProperty(game.Players,"LocalPlayer")
|
||||
local player = game.Players.LocalPlayer
|
||||
|
||||
waitForChild(game, "LocalBackpack")
|
||||
game.LocalBackpack:SetOldSchoolBackpack(false)
|
||||
|
||||
local currentLoadout = game:GetService("CoreGui").RobloxGui:FindFirstChild("CurrentLoadout")
|
||||
local maxNumLoadoutItems = 10
|
||||
|
||||
local guiBackpack = currentLoadout.Parent.Backpack
|
||||
|
||||
local characterChildAddedCon = nil
|
||||
local keyPressCon = nil
|
||||
local backpackChildCon = nil
|
||||
|
||||
local debounce = currentLoadout.Debounce
|
||||
|
||||
local waitingOnEnlarge = nil
|
||||
|
||||
local enlargeFactor = 1.18
|
||||
local buttonSizeEnlarge = UDim2.new(1 * enlargeFactor,0,1 * enlargeFactor,0)
|
||||
local buttonSizeNormal = UDim2.new(1,0,1,0)
|
||||
local enlargeOverride = true
|
||||
|
||||
local guiTweenSpeed = 0.5
|
||||
|
||||
for i = 0, 9 do
|
||||
game:GetService("GuiService"):AddKey(tostring(i)) -- register our keys
|
||||
end
|
||||
|
||||
local gearSlots = {}
|
||||
for i = 1, maxNumLoadoutItems do
|
||||
gearSlots[i] = "empty"
|
||||
end
|
||||
|
||||
local inventory = {}
|
||||
--- End Locals
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- Begin Functions
|
||||
local function kill(prop,con,gear)
|
||||
if con then con:disconnect() end
|
||||
if prop == true and gear then
|
||||
reorganizeLoadout(gear,false)
|
||||
end
|
||||
end
|
||||
|
||||
function removeGear(gear)
|
||||
local emptySlot = nil
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] == gear and gear.Parent ~= nil then
|
||||
emptySlot = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if emptySlot then
|
||||
if gearSlots[emptySlot].GearReference.Value then
|
||||
if gearSlots[emptySlot].GearReference.Value.Parent == game.Players.LocalPlayer.Character then -- if we currently have this equipped, unequip it
|
||||
gearSlots[emptySlot].GearReference.Value.Parent = game.Players.LocalPlayer.Backpack
|
||||
end
|
||||
|
||||
if gearSlots[emptySlot].GearReference.Value:IsA("HopperBin") and gearSlots[emptySlot].GearReference.Value.Active then -- this is an active hopperbin
|
||||
gearSlots[emptySlot].GearReference.Value:Disable()
|
||||
gearSlots[emptySlot].GearReference.Value.Active = false
|
||||
end
|
||||
end
|
||||
|
||||
gearSlots[emptySlot] = "empty"
|
||||
|
||||
local centerizeX = gear.Size.X.Scale/2
|
||||
local centerizeY = gear.Size.Y.Scale/2
|
||||
gear:TweenSizeAndPosition(UDim2.new(0,0,0,0),
|
||||
UDim2.new(gear.Position.X.Scale + centerizeX,gear.Position.X.Offset,gear.Position.Y.Scale + centerizeY,gear.Position.Y.Offset),
|
||||
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/4,true)
|
||||
delay(guiTweenSpeed/2,
|
||||
function()
|
||||
gear:remove()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function insertGear(gear, addToSlot)
|
||||
local pos = nil
|
||||
if not addToSlot then
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] == "empty" then
|
||||
pos = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if pos == 1 and gearSlots[1] ~= "empty" then gear:remove() return end -- we are currently full, can't add in
|
||||
else
|
||||
pos = addToSlot
|
||||
-- push all gear down one slot
|
||||
local start = 1
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] == "empty" then
|
||||
start = i
|
||||
break
|
||||
end
|
||||
end
|
||||
for i = start, pos + 1, -1 do
|
||||
gearSlots[i] = gearSlots[i - 1]
|
||||
if i == 10 then
|
||||
gearSlots[i].SlotNumber.Text = "0"
|
||||
gearSlots[i].SlotNumberDownShadow.Text = "0"
|
||||
gearSlots[i].SlotNumberUpShadow.Text = "0"
|
||||
else
|
||||
gearSlots[i].SlotNumber.Text = i
|
||||
gearSlots[i].SlotNumberDownShadow.Text = i
|
||||
gearSlots[i].SlotNumberUpShadow.Text = i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
gearSlots[pos] = gear
|
||||
if pos ~= maxNumLoadoutItems then
|
||||
if(type(tostring(pos)) == "string") then
|
||||
local posString = tostring(pos)
|
||||
gear.SlotNumber.Text = posString
|
||||
gear.SlotNumberDownShadow.Text = posString
|
||||
gear.SlotNumberUpShadow.Text = posString
|
||||
end
|
||||
else -- tenth gear doesn't follow mathematical pattern :(
|
||||
gear.SlotNumber.Text = "0"
|
||||
gear.SlotNumberDownShadow.Text = "0"
|
||||
gear.SlotNumberUpShadow.Text = "0"
|
||||
end
|
||||
gear.Visible = true
|
||||
|
||||
local con = nil
|
||||
con = gear.Kill.Changed:connect(function(prop) kill(prop,con,gear) end)
|
||||
end
|
||||
|
||||
|
||||
function reorganizeLoadout(gear, inserting, equipped, addToSlot)
|
||||
if inserting then -- add in gear
|
||||
insertGear(gear, addToSlot)
|
||||
else
|
||||
removeGear(gear)
|
||||
end
|
||||
if gear ~= "empty" then gear.ZIndex = 1 end
|
||||
end
|
||||
|
||||
function checkToolAncestry(child,parent)
|
||||
if child:FindFirstChild("RobloxBuildTool") then return end -- don't show roblox build tools
|
||||
if child:IsA("Tool") or child:IsA("HopperBin") then
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] ~= "empty" and gearSlots[i].GearReference.Value == child then
|
||||
if parent == nil then
|
||||
gearSlots[i].Kill.Value = true
|
||||
return false
|
||||
elseif child.Parent == player.Character then
|
||||
gearSlots[i].Selected = true
|
||||
return true
|
||||
elseif child.Parent == player.Backpack then
|
||||
if child:IsA("Tool") then gearSlots[i].Selected = false end
|
||||
return true
|
||||
else
|
||||
gearSlots[i].Kill.Value = true
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function removeAllEquippedGear(physGear)
|
||||
local stuff = player.Character:GetChildren()
|
||||
for i = 1, #stuff do
|
||||
if ( stuff[i]:IsA("Tool") or stuff[i]:IsA("HopperBin") ) and stuff[i] ~= physGear then
|
||||
if stuff[i]:IsA("Tool") then stuff[i].Parent = player.Backpack end
|
||||
if stuff[i]:IsA("HopperBin") then
|
||||
stuff[i]:Disable()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function hopperBinSwitcher(numKey, physGear)
|
||||
if not physGear then return end
|
||||
|
||||
physGear:ToggleSelect()
|
||||
|
||||
if gearSlots[numKey] == "empty" then return end
|
||||
|
||||
if not physGear.Active then
|
||||
gearSlots[numKey].Selected = false
|
||||
normalizeButton(gearSlots[numKey])
|
||||
else
|
||||
gearSlots[numKey].Selected = true
|
||||
enlargeButton(gearSlots[numKey])
|
||||
end
|
||||
end
|
||||
|
||||
function toolSwitcher(numKey)
|
||||
|
||||
if not gearSlots[numKey] then return end
|
||||
local physGear = gearSlots[numKey].GearReference.Value
|
||||
if physGear == nil then return end
|
||||
|
||||
removeAllEquippedGear(physGear) -- we don't remove this gear, as then we get a double switcheroo
|
||||
|
||||
local key = numKey
|
||||
if numKey == 0 then key = 10 end
|
||||
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] and gearSlots[i] ~= "empty" and i ~= key then
|
||||
normalizeButton(gearSlots[i])
|
||||
gearSlots[i].Selected = false
|
||||
if gearSlots[i].GearReference.Value:IsA("HopperBin") and gearSlots[i].GearReference.Value.Active then
|
||||
gearSlots[i].GearReference.Value:ToggleSelect()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if physGear:IsA("HopperBin") then
|
||||
hopperBinSwitcher(numKey,physGear)
|
||||
else
|
||||
if physGear.Parent == player.Character then
|
||||
physGear.Parent = player.Backpack
|
||||
gearSlots[numKey].Selected = false
|
||||
|
||||
normalizeButton(gearSlots[numKey])
|
||||
else
|
||||
physGear.Parent = player.Character
|
||||
gearSlots[numKey].Selected = true
|
||||
|
||||
enlargeButton(gearSlots[numKey])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function activateGear(num)
|
||||
local numKey = nil
|
||||
if num == "0" then
|
||||
numKey = 10 -- why do lua indexes have to start at 1? :(
|
||||
else
|
||||
numKey = tonumber(num)
|
||||
end
|
||||
|
||||
if(numKey == nil) then return end
|
||||
|
||||
if gearSlots[numKey] ~= "empty" then
|
||||
toolSwitcher(numKey)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
enlargeButton = function(button)
|
||||
if button.Size.Y.Scale > 1 then return end
|
||||
if not button.Parent then return end
|
||||
if not button.Selected then return end
|
||||
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] == "empty" then break end
|
||||
if gearSlots[i] ~= button then
|
||||
normalizeButton(gearSlots[i])
|
||||
end
|
||||
end
|
||||
|
||||
if not enlargeOverride then
|
||||
waitingOnEnlarge = button
|
||||
return
|
||||
end
|
||||
|
||||
if button:IsA("ImageButton") or button:IsA("TextButton") then
|
||||
button.ZIndex = 2
|
||||
local centerizeX = -(buttonSizeEnlarge.X.Scale - button.Size.X.Scale)/2
|
||||
local centerizeY = -(buttonSizeEnlarge.Y.Scale - button.Size.Y.Scale)/2
|
||||
button:TweenSizeAndPosition(buttonSizeEnlarge,
|
||||
UDim2.new(button.Position.X.Scale + centerizeX,button.Position.X.Offset,button.Position.Y.Scale + centerizeY,button.Position.Y.Offset),
|
||||
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,guiTweenSpeed/5,enlargeOverride)
|
||||
end
|
||||
end
|
||||
|
||||
normalizeAllButtons = function()
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] == "empty" then break end
|
||||
if gearSlots[i] ~= button then
|
||||
normalizeButton(gearSlots[i],0.1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
normalizeButton = function(button, speed)
|
||||
if not button then return end
|
||||
if button.Size.Y.Scale <= 1 then return end
|
||||
if button.Selected then return end
|
||||
if not button.Parent then return end
|
||||
|
||||
local moveSpeed = speed
|
||||
if moveSpeed == nil or type(moveSpeed) ~= "number" then moveSpeed = guiTweenSpeed/5 end
|
||||
|
||||
if button:IsA("ImageButton") or button:IsA("TextButton") then
|
||||
button.ZIndex = 1
|
||||
local inverseEnlarge = 1/enlargeFactor
|
||||
local centerizeX = -(buttonSizeNormal.X.Scale - button.Size.X.Scale)/2
|
||||
local centerizeY = -(buttonSizeNormal.Y.Scale - button.Size.Y.Scale)/2
|
||||
button:TweenSizeAndPosition(buttonSizeNormal,
|
||||
UDim2.new(button.Position.X.Scale + centerizeX,button.Position.X.Offset,button.Position.Y.Scale + centerizeY,button.Position.Y.Offset),
|
||||
Enum.EasingDirection.Out, Enum.EasingStyle.Quad,moveSpeed,enlargeOverride)
|
||||
end
|
||||
end
|
||||
|
||||
waitForDebounce = function()
|
||||
if debounce.Value then
|
||||
debounce.Changed:wait()
|
||||
end
|
||||
end
|
||||
|
||||
function pointInRectangle(point,rectTopLeft,rectSize)
|
||||
if point.x > rectTopLeft.x and point.x < (rectTopLeft.x + rectSize.x) then
|
||||
if point.y > rectTopLeft.y and point.y < (rectTopLeft.y + rectSize.y) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function swapGear(gearClone,toFrame)
|
||||
local toFrameChildren = toFrame:GetChildren()
|
||||
if #toFrameChildren == 1 then
|
||||
if toFrameChildren[1]:FindFirstChild("SlotNumber") then
|
||||
|
||||
local toSlot = tonumber(toFrameChildren[1].SlotNumber.Text)
|
||||
local gearCloneSlot = tonumber(gearClone.SlotNumber.Text)
|
||||
if toSlot == 0 then toSlot = 10 end
|
||||
if gearCloneSlot == 0 then gearCloneSlot = 10 end
|
||||
|
||||
gearSlots[toSlot] = gearClone
|
||||
gearSlots[gearCloneSlot] = toFrameChildren[1]
|
||||
|
||||
toFrameChildren[1].SlotNumber.Text = gearClone.SlotNumber.Text
|
||||
toFrameChildren[1].SlotNumberDownShadow.Text = gearClone.SlotNumber.Text
|
||||
toFrameChildren[1].SlotNumberUpShadow.Text = gearClone.SlotNumber.Text
|
||||
|
||||
local subString = string.sub(toFrame.Name,5)
|
||||
gearClone.SlotNumber.Text = subString
|
||||
gearClone.SlotNumberDownShadow.Text = subString
|
||||
gearClone.SlotNumberUpShadow.Text = subString
|
||||
|
||||
gearClone.Position = UDim2.new(gearClone.Position.X.Scale,0,gearClone.Position.Y.Scale,0)
|
||||
toFrameChildren[1].Position = UDim2.new(toFrameChildren[1].Position.X.Scale,0,toFrameChildren[1].Position.Y.Scale,0)
|
||||
|
||||
toFrameChildren[1].Parent = gearClone.Parent
|
||||
gearClone.Parent = toFrame
|
||||
end
|
||||
else
|
||||
local slotNum = tonumber(gearClone.SlotNumber.Text)
|
||||
if slotNum == 0 then slotNum = 10 end
|
||||
gearSlots[slotNum] = "empty" -- reset this gear slot
|
||||
|
||||
local subString = string.sub(toFrame.Name,5)
|
||||
gearClone.SlotNumber.Text = subString
|
||||
gearClone.SlotNumberDownShadow.Text = subString
|
||||
gearClone.SlotNumberUpShadow.Text = subString
|
||||
|
||||
local toSlotNum = tonumber(gearClone.SlotNumber.Text)
|
||||
if toSlotNum == 0 then toSlotNum = 10 end
|
||||
gearSlots[toSlotNum] = gearClone
|
||||
gearClone.Position = UDim2.new(gearClone.Position.X.Scale,0,gearClone.Position.Y.Scale,0)
|
||||
gearClone.Parent = toFrame
|
||||
end
|
||||
end
|
||||
|
||||
function resolveDrag(gearClone,x,y)
|
||||
local mousePoint = Vector2.new(x,y)
|
||||
|
||||
local frame = gearClone.Parent
|
||||
local frames = frame.Parent:GetChildren()
|
||||
|
||||
for i = 1, #frames do
|
||||
if frames[i]:IsA("Frame") then
|
||||
if pointInRectangle(mousePoint, frames[i].AbsolutePosition,frames[i].AbsoluteSize) then
|
||||
swapGear(gearClone,frames[i])
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if x < frame.AbsolutePosition.x or x > ( frame.AbsolutePosition.x + frame.AbsoluteSize.x ) then
|
||||
reorganizeLoadout(gearClone,false)
|
||||
return false
|
||||
elseif y < frame.AbsolutePosition.y or y > ( frame.AbsolutePosition.y + frame.AbsoluteSize.y ) then
|
||||
reorganizeLoadout(gearClone,false)
|
||||
return false
|
||||
else
|
||||
if dragBeginPos then gearClone.Position = dragBeginPos end
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
function unequipAllItems(dontEquipThis)
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] == "empty" then break end
|
||||
if gearSlots[i].GearReference.Value ~= dontEquipThis then
|
||||
if gearSlots[i].GearReference.Value:IsA("HopperBin") then
|
||||
gearSlots[i].GearReference.Value:Disable()
|
||||
elseif gearSlots[i].GearReference.Value:IsA("Tool") then
|
||||
gearSlots[i].GearReference.Value.Parent = game.Players.LocalPlayer.Backpack
|
||||
end
|
||||
gearSlots[i].Selected = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local addingPlayerChild = function(child, equipped, addToSlot, inventoryGearButton)
|
||||
waitForDebounce()
|
||||
debounce.Value = true
|
||||
|
||||
if child:FindFirstChild("RobloxBuildTool") then debounce.Value = false return end -- don't show roblox build tools
|
||||
if not child:IsA("Tool") then
|
||||
if not child:IsA("HopperBin") then
|
||||
debounce.Value = false
|
||||
return -- we don't care about anything besides tools (sigh...)
|
||||
end
|
||||
end
|
||||
|
||||
if not addToSlot then
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] ~= "empty" and gearSlots[i].GearReference.Value == child then -- we already have gear, do nothing
|
||||
debounce.Value = false
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local gearClone = currentLoadout.TempSlot:clone()
|
||||
gearClone.Name = child.Name
|
||||
gearClone.GearImage.Image = child.TextureId
|
||||
if gearClone.GearImage.Image == "" then
|
||||
gearClone.GearText.Text = child.Name
|
||||
end
|
||||
gearClone.GearReference.Value = child
|
||||
|
||||
gearClone.RobloxLocked = true
|
||||
|
||||
local slotToMod = -1
|
||||
|
||||
if not addToSlot then
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] == "empty" then
|
||||
slotToMod = i
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
slotToMod = addToSlot
|
||||
end
|
||||
|
||||
if slotToMod == - 1 then debounce.Value = false print("no slots!") return end -- No available slot to add in!
|
||||
|
||||
local slotNum = slotToMod % 10
|
||||
local parent = currentLoadout:FindFirstChild("Slot"..tostring(slotNum))
|
||||
gearClone.Parent = parent
|
||||
|
||||
if inventoryGearButton then
|
||||
local absolutePositionFinal = inventoryGearButton.AbsolutePosition
|
||||
local currentAbsolutePosition = gearClone.AbsolutePosition
|
||||
local diff = absolutePositionFinal - currentAbsolutePosition
|
||||
gearClone.Position = UDim2.new(gearClone.Position.X.Scale,diff.x,gearClone.Position.Y.Scale,diff.y)
|
||||
gearClone.ZIndex = 4
|
||||
end
|
||||
|
||||
if addToSlot then
|
||||
reorganizeLoadout(gearClone, true, equipped, addToSlot)
|
||||
else
|
||||
reorganizeLoadout(gearClone, true)
|
||||
end
|
||||
|
||||
if gearClone.Parent == nil then debounce.Value = false return end -- couldn't fit in (hopper is full!)
|
||||
|
||||
if equipped then
|
||||
gearClone.Selected = true
|
||||
unequipAllItems(child)
|
||||
delay(guiTweenSpeed + 0.01,function() -- if our gear is equipped, we will want to enlarge it when done moving
|
||||
if (gearClone.GearReference.Value:IsA("Tool") and gearClone:FindFirstChild("GearReference") and gearClone.GearReference.Value.Parent == player.Character) or
|
||||
(gearClone.GearReference.Value:IsA("HopperBin") and gearClone.GearReference.Value.Active == true) then
|
||||
enlargeButton(gearClone)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local dragBeginPos = nil
|
||||
local clickCon, buttonDeleteCon, mouseEnterCon, mouseLeaveCon, dragStop, dragBegin = nil
|
||||
clickCon = gearClone.MouseButton1Click:connect(function() if not gearClone.Draggable then activateGear(gearClone.SlotNumber.Text) end end)
|
||||
mouseEnterCon = gearClone.MouseEnter:connect(function()
|
||||
if guiBackpack.Visible then
|
||||
gearClone.Draggable = true
|
||||
end
|
||||
end)
|
||||
dragBegin = gearClone.DragBegin:connect(function(pos)
|
||||
dragBeginPos = pos
|
||||
gearClone.ZIndex = 7
|
||||
local children = gearClone:GetChildren()
|
||||
for i = 1, #children do
|
||||
if children[i]:IsA("TextLabel") then
|
||||
if string.find(children[i].Name,"Shadow") then
|
||||
children[i].ZIndex = 8
|
||||
else
|
||||
children[i].ZIndex = 9
|
||||
end
|
||||
elseif children[i]:IsA("Frame") or children[i]:IsA("ImageLabel") then
|
||||
children[i].ZIndex = 7
|
||||
end
|
||||
end
|
||||
end)
|
||||
dragStop = gearClone.DragStopped:connect(function(x,y)
|
||||
if gearClone.Selected then
|
||||
gearClone.ZIndex = 2
|
||||
else
|
||||
gearClone.ZIndex = 1
|
||||
end
|
||||
local children = gearClone:GetChildren()
|
||||
for i = 1, #children do
|
||||
if children[i]:IsA("TextLabel") then
|
||||
if string.find(children[i].Name,"Shadow") then
|
||||
children[i].ZIndex = 3
|
||||
else
|
||||
children[i].ZIndex = 4
|
||||
end
|
||||
elseif children[i]:IsA("Frame") or children[i]:IsA("ImageLabel") then
|
||||
children[i].ZIndex = 2
|
||||
end
|
||||
end
|
||||
resolveDrag(gearClone,x,y)
|
||||
end)
|
||||
mouseLeaveCon = gearClone.MouseLeave:connect(function()
|
||||
gearClone.Draggable = false
|
||||
end)
|
||||
buttonDeleteCon = gearClone.AncestryChanged:connect(function()
|
||||
if gearClone.Parent and gearClone.Parent.Parent == currentLoadout then return end
|
||||
if clickCon then clickCon:disconnect() end
|
||||
if buttonDeleteCon then buttonDeleteCon:disconnect() end
|
||||
if mouseEnterCon then mouseEnterCon:disconnect() end
|
||||
if mouseLeaveCon then mouseLeaveCon:disconnect() end
|
||||
if dragStop then dragStop:disconnect() end
|
||||
if dragBegin then dragBegin:disconnect() end
|
||||
end) -- this probably isn't necessary since objects are being deleted (probably), but this might still leak just in case
|
||||
|
||||
local childCon = nil
|
||||
local childChangeCon = nil
|
||||
childCon = child.AncestryChanged:connect(function(newChild,parent)
|
||||
if not checkToolAncestry(newChild,parent) then
|
||||
if childCon then childCon:disconnect() end
|
||||
if childChangeCon then childChangeCon:disconnect() end
|
||||
removeFromInventory(child)
|
||||
elseif parent == game.Players.LocalPlayer.Backpack then
|
||||
normalizeButton(gearClone)
|
||||
end
|
||||
end)
|
||||
|
||||
childChangeCon = child.Changed:connect(function(prop)
|
||||
if prop == "Name" then
|
||||
if gearClone and gearClone.GearImage.Image == "" then
|
||||
gearClone.GearText.Text = child.Name
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
debounce.Value = false
|
||||
|
||||
end
|
||||
|
||||
function addToInventory(child)
|
||||
if not child:IsA("Tool") or not child:IsA("HopperBin") then return end
|
||||
|
||||
local slot = nil
|
||||
for i = 1, #inventory do
|
||||
if inventory[i] and inventory[i] == child then return end
|
||||
if not inventory[i] then slot = i end
|
||||
end
|
||||
if slot then
|
||||
inventory[slot] = child
|
||||
elseif #inventory < 1 then
|
||||
inventory[1] = child
|
||||
else
|
||||
inventory[#inventory + 1] = child
|
||||
end
|
||||
end
|
||||
|
||||
function removeFromInventory(child)
|
||||
for i = 1, #inventory do
|
||||
if inventory[i] == child then
|
||||
table.remove(inventory,i)
|
||||
inventory[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- these next two functions are used for safe guarding
|
||||
-- when we are waiting for character to come back after dying
|
||||
function activateLoadout()
|
||||
keyPressCon = game:GetService("GuiService").KeyPressed:connect(function(key) activateGear(key) end)
|
||||
currentLoadout.Visible = true
|
||||
end
|
||||
|
||||
function deactivateLoadout()
|
||||
if keyPressCon then keyPressCon:disconnect() end
|
||||
currentLoadout.Visible = false
|
||||
end
|
||||
|
||||
function setupBackpackListener()
|
||||
if backpackChildCon then backpackChildCon:disconnect() end
|
||||
backpackChildCon = player.Backpack.ChildAdded:connect(function(child)
|
||||
addingPlayerChild(child)
|
||||
addToInventory(child)
|
||||
end)
|
||||
end
|
||||
|
||||
function playerCharacterChildAdded(child)
|
||||
addingPlayerChild(child,true)
|
||||
addToInventory(child)
|
||||
end
|
||||
-- End Functions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- Begin Script
|
||||
wait() -- let stuff initialize incase this is first heartbeat...
|
||||
|
||||
waitForChild(player,"Backpack")
|
||||
local backpackChildren = player.Backpack:GetChildren()
|
||||
local size = math.min(10,#backpackChildren)
|
||||
for i = 1, size do
|
||||
addingPlayerChild(backpackChildren[i],false)
|
||||
end
|
||||
setupBackpackListener()
|
||||
|
||||
waitForProperty(player,"Character")
|
||||
for i,v in ipairs(player.Character:GetChildren()) do
|
||||
playerCharacterChildAdded(v)
|
||||
end
|
||||
characterChildAddedCon = player.Character.ChildAdded:connect(function(child) playerCharacterChildAdded(child) end)
|
||||
|
||||
waitForChild(player.Character,"Humanoid")
|
||||
humanoidDiedCon = player.Character.Humanoid.Died:connect(function() deactivateLoadout() end)
|
||||
|
||||
player.CharacterRemoving:connect(function()
|
||||
if characterChildAddedCon then characterChildAddedCon:disconnect() end
|
||||
if humanoidDiedCon then humanoidDiedCon:disconnect() end
|
||||
if backpackChildCon then backpackChildCon:disconnect() end
|
||||
deactivateLoadout()
|
||||
end)
|
||||
player.CharacterAdded:connect(function()
|
||||
player = game.Players.LocalPlayer -- make sure we are still looking at the correct character
|
||||
|
||||
for i = 1, #gearSlots do
|
||||
if gearSlots[i] ~= "empty" then
|
||||
gearSlots[i].Parent = nil
|
||||
gearSlots[i] = "empty"
|
||||
end
|
||||
end
|
||||
|
||||
waitForChild(player,"Backpack")
|
||||
local backpackChildren = player.Backpack:GetChildren()
|
||||
local size = math.min(10,#backpackChildren)
|
||||
for i = 1, size do
|
||||
addingPlayerChild(backpackChildren[i])
|
||||
end
|
||||
|
||||
setupBackpackListener()
|
||||
|
||||
characterChildAddedCon =
|
||||
player.Character.ChildAdded:connect(function(child)
|
||||
addingPlayerChild(child,true)
|
||||
end)
|
||||
|
||||
waitForChild(player.Character,"Humanoid")
|
||||
humanoidDiedCon =
|
||||
player.Character.Humanoid.Died:connect(function()
|
||||
deactivateLoadout()
|
||||
end)
|
||||
activateLoadout()
|
||||
end)
|
||||
|
||||
waitForChild(guiBackpack,"SwapSlot")
|
||||
guiBackpack.SwapSlot.Changed:connect(function()
|
||||
if guiBackpack.SwapSlot.Value then
|
||||
local swapSlot = guiBackpack.SwapSlot
|
||||
local pos = swapSlot.Slot.Value
|
||||
if pos == 0 then pos = 10 end
|
||||
if gearSlots[pos] then
|
||||
reorganizeLoadout(gearSlots[pos],false)
|
||||
end
|
||||
if swapSlot.GearButton.Value then
|
||||
addingPlayerChild(swapSlot.GearButton.Value.GearReference.Value,false,pos)
|
||||
end
|
||||
guiBackpack.SwapSlot.Value = false
|
||||
end
|
||||
end)
|
||||
|
||||
keyPressCon = game:GetService("GuiService").KeyPressed:connect(function(key) activateGear(key) end)
|
||||
|
||||
end)
|
563
scripts/game/2011M/cores/MainBotChatScript.lua
Normal file
563
scripts/game/2011M/cores/MainBotChatScript.lua
Normal file
@ -0,0 +1,563 @@
|
||||
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)
|
||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||
return
|
||||
end
|
||||
|
||||
for dialog, gui in pairs(dialogMap) do
|
||||
if dialog and gui then
|
||||
gui.Enabled = false
|
||||
end
|
||||
end
|
||||
|
||||
renewKillswitch(dialog)
|
||||
|
||||
delay(1, checkForLeaveArea)
|
||||
doDialog(dialog)
|
||||
end
|
||||
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()
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
player = game.Players.LocalPlayer
|
||||
waitForProperty(player, "Character")
|
||||
|
||||
--print("Fetching Scripts")
|
||||
fetchScripts()
|
||||
|
||||
--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)
|
136
scripts/game/2011M/cores/NotificationScript.lua
Normal file
136
scripts/game/2011M/cores/NotificationScript.lua
Normal file
@ -0,0 +1,136 @@
|
||||
delay(0, function()
|
||||
|
||||
function waitForProperty(instance, property)
|
||||
while not instance[property] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
function waitForChild(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
|
||||
waitForProperty(game.Players,"LocalPlayer")
|
||||
waitForChild(game:GetService("CoreGui").RobloxGui,"Popup")
|
||||
waitForChild(game:GetService("CoreGui").RobloxGui.Popup,"AcceptButton")
|
||||
game:GetService("CoreGui").RobloxGui.Popup.AcceptButton.Modal = true
|
||||
|
||||
local localPlayer = game.Players.LocalPlayer
|
||||
local acceptedTeleport = Instance.new("IntValue")
|
||||
|
||||
local teleportEnabled = false
|
||||
|
||||
local makePopupInvisible = function()
|
||||
if game:GetService("CoreGui").RobloxGui.Popup then game:GetService("CoreGui").RobloxGui.Popup.Visible = false end
|
||||
end
|
||||
|
||||
function makeFriend(fromPlayer,toPlayer)
|
||||
|
||||
local popup = game:GetService("CoreGui").RobloxGui:FindFirstChild("Popup")
|
||||
if popup == nil then return end -- there is no popup!
|
||||
if popup.Visible then return end -- currently popping something, abort!
|
||||
|
||||
popup.PopupText.Text = "Accept Friend Request from " .. tostring(fromPlayer.Name) .. "?"
|
||||
popup.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=352&y=352"
|
||||
|
||||
popup.Visible = true
|
||||
popup:TweenSize(UDim2.new(0,330,0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)
|
||||
|
||||
local yesCon, noCon
|
||||
|
||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||
popup.Visible = false
|
||||
toPlayer:RequestFriendship(fromPlayer)
|
||||
if yesCon then yesCon:disconnect() end
|
||||
if noCon then noCon:disconnect() end
|
||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
||||
end)
|
||||
|
||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||
popup.Visible = false
|
||||
toPlayer:RevokeFriendship(fromPlayer)
|
||||
if yesCon then yesCon:disconnect() end
|
||||
if noCon then noCon:disconnect() end
|
||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
game.Players.FriendRequestEvent:connect(function(fromPlayer,toPlayer,event)
|
||||
|
||||
-- if this doesn't involve me, then do nothing
|
||||
if fromPlayer ~= localPlayer and toPlayer ~= localPlayer then return end
|
||||
|
||||
if fromPlayer == localPlayer then
|
||||
if event == Enum.FriendRequestEvent.Accept then
|
||||
game:GetService("GuiService"):SendNotification("You are Friends",
|
||||
"With " .. toPlayer.Name .. "!",
|
||||
"http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(toPlayer.userId).."&x=48&y=48",
|
||||
5)
|
||||
end
|
||||
elseif toPlayer == localPlayer then
|
||||
if event == Enum.FriendRequestEvent.Issue then
|
||||
game:GetService("GuiService"):SendNotification("Friend Request",
|
||||
"From " .. fromPlayer.Name,
|
||||
"http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=48&y=48",
|
||||
8,
|
||||
function()
|
||||
makeFriend(fromPlayer,toPlayer)
|
||||
end)
|
||||
elseif event == Enum.FriendRequestEvent.Accept then
|
||||
game:GetService("GuiService"):SendNotification("You are Friends",
|
||||
"With " .. fromPlayer.Name .. "!",
|
||||
"http://www.roblox.com/thumbs/avatar.ashx?userId="..tostring(fromPlayer.userId).."&x=48&y=48",
|
||||
5)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if teleportEnabled then
|
||||
game:GetService("TeleportService").ConfirmationCallback = function(message, placeId, spawnName)
|
||||
local popup = game:GetService("CoreGui").RobloxGui:FindFirstChild("Popup")
|
||||
popup.PopupText.Text = message
|
||||
popup.PopupImage.Image = ""
|
||||
|
||||
local yesCon, noCon
|
||||
|
||||
local function killCons()
|
||||
if yesCon then yesCon:disconnect() end
|
||||
if noCon then noCon:disconnect() end
|
||||
game.GuiService:RemoveCenterDialog(game:GetService("CoreGui").RobloxGui:FindFirstChild("Popup"))
|
||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
||||
end
|
||||
|
||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||
killCons()
|
||||
local success = pcall(function() game:GetService("TeleportService"):TeleportImpl(placeId,spawnName) end)
|
||||
end)
|
||||
|
||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||
killCons()
|
||||
local success = pcall(function() game:GetService("TeleportService"):TeleportCancel() end)
|
||||
end)
|
||||
|
||||
local centerDialogSuccess = pcall(function() game.GuiService:AddCenterDialog(game:GetService("CoreGui").RobloxGui:FindFirstChild("Popup"), Enum.CenterDialogType.QuitDialog,
|
||||
--ShowFunction
|
||||
function()
|
||||
game:GetService("CoreGui").RobloxGui:FindFirstChild("Popup").Visible = true
|
||||
popup:TweenSize(UDim2.new(0,330,0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)
|
||||
end,
|
||||
--HideFunction
|
||||
function()
|
||||
popup:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,makePopupInvisible())
|
||||
end)
|
||||
end)
|
||||
|
||||
if centerDialogSuccess == false then
|
||||
game:GetService("CoreGui").RobloxGui:FindFirstChild("Popup").Visible = true
|
||||
popup:TweenSize(UDim2.new(0,330,0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)
|
||||
end
|
||||
return true
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
3603
scripts/game/2011M/cores/PlayerlistScript.lua
Normal file
3603
scripts/game/2011M/cores/PlayerlistScript.lua
Normal file
File diff suppressed because it is too large
Load Diff
67
scripts/game/2011M/cores/PopupScript.lua
Normal file
67
scripts/game/2011M/cores/PopupScript.lua
Normal file
@ -0,0 +1,67 @@
|
||||
--build our gui
|
||||
|
||||
delay(0, function()
|
||||
|
||||
local popupFrame = Instance.new("Frame")
|
||||
popupFrame.Position = UDim2.new(0.5,-165,0.5,-175)
|
||||
popupFrame.Size = UDim2.new(0,330,0,350)
|
||||
popupFrame.Style = Enum.FrameStyle.RobloxRound
|
||||
popupFrame.ZIndex = 4
|
||||
popupFrame.Name = "Popup"
|
||||
popupFrame.Visible = false
|
||||
popupFrame.Parent = game:GetService("CoreGui").RobloxGui
|
||||
|
||||
local darken = popupFrame:clone()
|
||||
darken.Size = UDim2.new(1,16,1,16)
|
||||
darken.Position = UDim2.new(0,-8,0,-8)
|
||||
darken.Name = "Darken"
|
||||
darken.ZIndex = 1
|
||||
darken.Parent = popupFrame
|
||||
|
||||
local acceptButton = Instance.new("TextButton")
|
||||
acceptButton.Position = UDim2.new(0,20,0,270)
|
||||
acceptButton.Size = UDim2.new(0,100,0,50)
|
||||
acceptButton.Font = Enum.Font.ArialBold
|
||||
acceptButton.FontSize = Enum.FontSize.Size24
|
||||
acceptButton.Style = Enum.ButtonStyle.RobloxButton
|
||||
acceptButton.TextColor3 = Color3.new(248/255,248/255,248/255)
|
||||
acceptButton.Text = "Yes"
|
||||
acceptButton.ZIndex = 5
|
||||
acceptButton.Name = "AcceptButton"
|
||||
acceptButton.Parent = popupFrame
|
||||
|
||||
local declineButton = acceptButton:clone()
|
||||
declineButton.Position = UDim2.new(1,-120,0,270)
|
||||
declineButton.Text = "No"
|
||||
declineButton.Name = "DeclineButton"
|
||||
declineButton.Parent = popupFrame
|
||||
|
||||
local popupImage = Instance.new("ImageLabel")
|
||||
popupImage.BackgroundTransparency = 1
|
||||
popupImage.Position = UDim2.new(0.5,-140,0,0)
|
||||
popupImage.Size = UDim2.new(0,280,0,280)
|
||||
popupImage.ZIndex = 3
|
||||
popupImage.Name = "PopupImage"
|
||||
popupImage.Parent = popupFrame
|
||||
|
||||
local backing = Instance.new("ImageLabel")
|
||||
backing.BackgroundTransparency = 1
|
||||
backing.Size = UDim2.new(1,0,1,0)
|
||||
backing.Image = "rbxasset://textures/ui/Backing.png"
|
||||
backing.Name = "Backing"
|
||||
backing.ZIndex = 2
|
||||
backing.Parent = popupImage
|
||||
|
||||
local popupText = Instance.new("TextLabel")
|
||||
popupText.Name = "PopupText"
|
||||
popupText.Size = UDim2.new(1,0,0.8,0)
|
||||
popupText.Font = Enum.Font.ArialBold
|
||||
popupText.FontSize = Enum.FontSize.Size36
|
||||
popupText.BackgroundTransparency = 1
|
||||
popupText.Text = "Hello I'm a popup"
|
||||
popupText.TextColor3 = Color3.new(248/255,248/255,248/255)
|
||||
popupText.TextWrap = true
|
||||
popupText.ZIndex = 5
|
||||
popupText.Parent = popupFrame
|
||||
|
||||
end)
|
73
scripts/game/2011M/cores/Resizer.lua
Normal file
73
scripts/game/2011M/cores/Resizer.lua
Normal file
@ -0,0 +1,73 @@
|
||||
-- this script is responsible for keeping the gui proportions under control
|
||||
|
||||
delay(0, function()
|
||||
|
||||
local screen = game:GetService("CoreGui").RobloxGui
|
||||
|
||||
local BottomLeftControl
|
||||
local BottomRightControl
|
||||
local TopLeftControl
|
||||
local BuildTools
|
||||
|
||||
local controlFrame = screen:FindFirstChild("ControlFrame")
|
||||
local loadoutPadding = 43
|
||||
local currentLoadout
|
||||
|
||||
BottomLeftControl = controlFrame:FindFirstChild("BottomLeftControl")
|
||||
BottomRightControl = controlFrame:FindFirstChild("BottomRightControl")
|
||||
TopLeftControl = controlFrame:FindFirstChild("TopLeftControl")
|
||||
currentLoadout = screen:FindFirstChild("CurrentLoadout")
|
||||
BuildTools = controlFrame:FindFirstChild("BuildTools")
|
||||
|
||||
function makeYRelative()
|
||||
|
||||
BottomLeftControl.SizeConstraint = 2
|
||||
BottomRightControl.SizeConstraint = 2
|
||||
if TopLeftControl then TopLeftControl.SizeConstraint = 2 end
|
||||
if currentLoadout then currentLoadout.SizeConstraint = 2 end
|
||||
if BuildTools then BuildTools.Frame.SizeConstraint = 2 end
|
||||
|
||||
BottomLeftControl.Position = UDim2.new(0,0,1,-BottomLeftControl.AbsoluteSize.Y)
|
||||
BottomRightControl.Position = UDim2.new(1,-BottomRightControl.AbsoluteSize.X,1,-BottomRightControl.AbsoluteSize.Y)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function makeXRelative()
|
||||
|
||||
BottomLeftControl.SizeConstraint = 1
|
||||
BottomRightControl.SizeConstraint = 1
|
||||
if TopLeftControl then TopLeftControl.SizeConstraint = 1 end
|
||||
if currentLoadout then currentLoadout.SizeConstraint = 1 end
|
||||
if BuildTools then BuildTools.Frame.SizeConstraint = 1 end
|
||||
|
||||
BottomLeftControl.Position = UDim2.new(0,0,1,-BottomLeftControl.AbsoluteSize.Y)
|
||||
BottomRightControl.Position = UDim2.new(1,-BottomRightControl.AbsoluteSize.X,1,-BottomRightControl.AbsoluteSize.Y)
|
||||
|
||||
end
|
||||
|
||||
local function resize()
|
||||
if screen.AbsoluteSize.x > screen.AbsoluteSize.y then
|
||||
makeYRelative()
|
||||
else
|
||||
makeXRelative()
|
||||
end
|
||||
if currentLoadout then
|
||||
currentLoadout.Position =
|
||||
UDim2.new(0,screen.AbsoluteSize.X/2 -currentLoadout.AbsoluteSize.X/2,currentLoadout.Position.Y.Scale,-currentLoadout.AbsoluteSize.Y - loadoutPadding)
|
||||
end
|
||||
end
|
||||
screen.Changed:connect(function(property)
|
||||
|
||||
if property == "AbsoluteSize" then
|
||||
wait()
|
||||
resize()
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
wait()
|
||||
resize()
|
||||
|
||||
end)
|
3668
scripts/game/2011M/cores/SettingsScript.lua
Normal file
3668
scripts/game/2011M/cores/SettingsScript.lua
Normal file
File diff suppressed because it is too large
Load Diff
87
scripts/game/2011M/cores/StarterScript.lua
Normal file
87
scripts/game/2011M/cores/StarterScript.lua
Normal file
@ -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\\MainBotChatScript.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)
|
50
scripts/game/2011M/cores/StarterScriptServer.lua
Normal file
50
scripts/game/2011M/cores/StarterScriptServer.lua
Normal file
@ -0,0 +1,50 @@
|
||||
-- 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
|
||||
|
||||
|
||||
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\\MainBotChatScript.lua")
|
||||
end)
|
294
scripts/game/2011M/cores/SubMenuBuilder.lua
Normal file
294
scripts/game/2011M/cores/SubMenuBuilder.lua
Normal file
@ -0,0 +1,294 @@
|
||||
-- creates the in-game gui sub menus for property tools
|
||||
-- written 9/27/2010 by Ben (jeditkacheff)
|
||||
|
||||
delay(0, function()
|
||||
|
||||
local gui = game:GetService("CoreGui").RobloxGui
|
||||
if gui:FindFirstChild("ControlFrame") then
|
||||
gui = gui:FindFirstChild("ControlFrame")
|
||||
end
|
||||
|
||||
local currentlySelectedButton = nil
|
||||
|
||||
local localAssetBase = "rbxasset://textures/ui/"
|
||||
|
||||
local selectedButton = Instance.new("ObjectValue")
|
||||
selectedButton.RobloxLocked = true
|
||||
selectedButton.Name = "SelectedButton"
|
||||
selectedButton.Parent = gui.BuildTools
|
||||
|
||||
local closeButton = Instance.new("ImageButton")
|
||||
closeButton.Name = "CloseButton"
|
||||
closeButton.RobloxLocked = true
|
||||
closeButton.BackgroundTransparency = 1
|
||||
closeButton.Image = localAssetBase .. "CloseButton.png"
|
||||
closeButton.ZIndex = 2
|
||||
closeButton.Size = UDim2.new(0.2,0,0.05,0)
|
||||
closeButton.AutoButtonColor = false
|
||||
closeButton.Position = UDim2.new(0.75,0,0.01,0)
|
||||
|
||||
|
||||
|
||||
function setUpCloseButtonState(button)
|
||||
|
||||
button.MouseEnter:connect(function()
|
||||
button.Image = localAssetBase .. "CloseButton_dn.png"
|
||||
end)
|
||||
button.MouseLeave:connect(function()
|
||||
button.Image = localAssetBase .. "CloseButton.png"
|
||||
end)
|
||||
button.MouseButton1Click:connect(function()
|
||||
button.ClosedState.Value = true
|
||||
button.Image = localAssetBase .. "CloseButton.png"
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
-- nice selection animation
|
||||
function fadeInButton(button)
|
||||
|
||||
if currentlySelectedButton ~= nil then
|
||||
currentlySelectedButton.Selected = false
|
||||
currentlySelectedButton.ZIndex = 2
|
||||
currentlySelectedButton.Frame.BackgroundTransparency = 1
|
||||
end
|
||||
|
||||
local speed = 0.1
|
||||
button.ZIndex = 3
|
||||
while button.Frame.BackgroundTransparency > 0 do
|
||||
button.Frame.BackgroundTransparency = button.Frame.BackgroundTransparency - speed
|
||||
wait()
|
||||
end
|
||||
button.Selected = true
|
||||
|
||||
currentlySelectedButton = button
|
||||
selectedButton.Value = currentlySelectedButton
|
||||
end
|
||||
|
||||
------------------------------- create the color selection sub menu -----------------------------------
|
||||
|
||||
local paintMenu = Instance.new("ImageLabel")
|
||||
local paintTool = gui.BuildTools.Frame.PropertyTools.PaintTool
|
||||
paintMenu.Name = "PaintMenu"
|
||||
paintMenu.RobloxLocked = true
|
||||
paintMenu.Parent = paintTool
|
||||
paintMenu.Position = UDim2.new(-2.7,0,-3,0)
|
||||
paintMenu.Size = UDim2.new(2.5,0,10,0)
|
||||
paintMenu.BackgroundTransparency = 1
|
||||
paintMenu.ZIndex = 2
|
||||
paintMenu.Image = localAssetBase .. "PaintMenu.png"
|
||||
|
||||
local paintColorButton = Instance.new("ImageButton")
|
||||
paintColorButton.RobloxLocked = true
|
||||
paintColorButton.BorderSizePixel = 0
|
||||
paintColorButton.ZIndex = 2
|
||||
paintColorButton.Size = UDim2.new(0.200000003, 0,0.0500000007, 0)
|
||||
|
||||
local selection = Instance.new("Frame")
|
||||
selection.RobloxLocked = true
|
||||
selection.BorderSizePixel = 0
|
||||
selection.BackgroundColor3 = Color3.new(1,1,1)
|
||||
selection.BackgroundTransparency = 1
|
||||
selection.ZIndex = 2
|
||||
selection.Size = UDim2.new(1.1,0,1.1,0)
|
||||
selection.Position = UDim2.new(-0.05,0,-0.05,0)
|
||||
selection.Parent = paintColorButton
|
||||
|
||||
local header = 0.08
|
||||
local spacing = 18
|
||||
|
||||
local count = 1
|
||||
|
||||
function findNextColor()
|
||||
colorName = tostring(BrickColor.new(count))
|
||||
while colorName == "Medium stone grey" do
|
||||
count = count + 1
|
||||
colorName = tostring(BrickColor.new(count))
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
for i = 0,15 do
|
||||
for j = 1, 4 do
|
||||
newButton = paintColorButton:clone()
|
||||
newButton.RobloxLocked = true
|
||||
newButton.BackgroundColor3 = BrickColor.new(findNextColor()).Color
|
||||
newButton.Name = tostring(BrickColor.new(count))
|
||||
count = count + 1
|
||||
if j == 1 then newButton.Position = UDim2.new(0.08,0,i/spacing + header,0)
|
||||
elseif j == 2 then newButton.Position = UDim2.new(0.29,0,i/spacing + header,0)
|
||||
elseif j == 3 then newButton.Position = UDim2.new(0.5,0,i/spacing + header,0)
|
||||
elseif j == 4 then newButton.Position = UDim2.new(0.71,0,i/spacing + header,0) end
|
||||
newButton.Parent = paintMenu
|
||||
end
|
||||
end
|
||||
|
||||
local paintButtons = paintMenu:GetChildren()
|
||||
for i = 1, #paintButtons do
|
||||
paintButtons[i].MouseButton1Click:connect(function()
|
||||
fadeInButton(paintButtons[i])
|
||||
end)
|
||||
end
|
||||
|
||||
local paintCloseButton = closeButton:clone()
|
||||
paintCloseButton.RobloxLocked = true
|
||||
paintCloseButton.Parent = paintMenu
|
||||
|
||||
local closedState = Instance.new("BoolValue")
|
||||
closedState.RobloxLocked = true
|
||||
closedState.Name = "ClosedState"
|
||||
closedState.Parent = paintCloseButton
|
||||
|
||||
setUpCloseButtonState(paintCloseButton)
|
||||
|
||||
------------------------------- create the material selection sub menu -----------------------------------
|
||||
|
||||
local materialMenu = Instance.new("ImageLabel")
|
||||
local materialTool = gui.BuildTools.Frame.PropertyTools.MaterialSelector
|
||||
materialMenu.RobloxLocked = true
|
||||
materialMenu.Name = "MaterialMenu"
|
||||
materialMenu.Position = UDim2.new(-4,0,-3,0)
|
||||
materialMenu.Size = UDim2.new(2.5,0,6.5,0)
|
||||
materialMenu.BackgroundTransparency = 1
|
||||
materialMenu.ZIndex = 2
|
||||
materialMenu.Image = localAssetBase .. "MaterialMenu.png"
|
||||
materialMenu.Parent = materialTool
|
||||
|
||||
local textures = {"Plastic","Wood","Slate","CorrodedMetal","Ice","Grass","Foil","DiamondPlate","Concrete"}
|
||||
|
||||
local materialButtons = {}
|
||||
|
||||
local materialButton = Instance.new("ImageButton")
|
||||
materialButton.RobloxLocked = true
|
||||
materialButton.BackgroundTransparency = 1
|
||||
materialButton.Size = UDim2.new(0.400000003, 0,0.16, 0)
|
||||
materialButton.ZIndex = 2
|
||||
|
||||
selection.Parent = materialButton
|
||||
|
||||
local current = 1
|
||||
function getTextureAndName(button)
|
||||
|
||||
if current > #textures then
|
||||
button:remove()
|
||||
return false
|
||||
end
|
||||
button.Image = localAssetBase .. textures[current] .. ".png"
|
||||
button.Name = textures[current]
|
||||
current = current + 1
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
local ySpacing = 0.10
|
||||
local xSpacing = 0.07
|
||||
for i = 1,5 do
|
||||
for j = 1,2 do
|
||||
local button = materialButton:clone()
|
||||
button.RobloxLocked = true
|
||||
button.Position = UDim2.new((j -1)/2.2 + xSpacing,0,ySpacing + (i - 1)/5.5,0)
|
||||
if getTextureAndName(button) then button.Parent = materialMenu else button:remove() end
|
||||
table.insert(materialButtons,button)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for i = 1, #materialButtons do
|
||||
materialButtons[i].MouseButton1Click:connect(function()
|
||||
fadeInButton(materialButtons[i])
|
||||
end)
|
||||
end
|
||||
|
||||
local materialCloseButton = closeButton:clone()
|
||||
materialCloseButton.RobloxLocked = true
|
||||
materialCloseButton.Size = UDim2.new(0.2,0,0.08,0)
|
||||
materialCloseButton.Parent = materialMenu
|
||||
|
||||
local closedState = Instance.new("BoolValue")
|
||||
closedState.RobloxLocked = true
|
||||
closedState.Name = "ClosedState"
|
||||
closedState.Parent = materialCloseButton
|
||||
|
||||
setUpCloseButtonState(materialCloseButton)
|
||||
|
||||
|
||||
------------------------------- create the surface selection sub menu -----------------------------------
|
||||
|
||||
local surfaceMenu = Instance.new("ImageLabel")
|
||||
local surfaceTool = gui.BuildTools.Frame.PropertyTools.InputSelector
|
||||
surfaceMenu.RobloxLocked = true
|
||||
surfaceMenu.Name = "SurfaceMenu"
|
||||
surfaceMenu.Position = UDim2.new(-2.6,0,-4,0)
|
||||
surfaceMenu.Size = UDim2.new(2.5,0,5.5,0)
|
||||
surfaceMenu.BackgroundTransparency = 1
|
||||
surfaceMenu.ZIndex = 2
|
||||
surfaceMenu.Image = localAssetBase .. "SurfaceMenu.png"
|
||||
surfaceMenu.Parent = surfaceTool
|
||||
|
||||
textures = {"Smooth", "Studs", "Inlets", "Universal", "Glue", "Weld", "Hinge", "Motor"}
|
||||
current = 1
|
||||
|
||||
local surfaceButtons = {}
|
||||
|
||||
local surfaceButton = Instance.new("ImageButton")
|
||||
surfaceButton.RobloxLocked = true
|
||||
surfaceButton.BackgroundTransparency = 1
|
||||
surfaceButton.Size = UDim2.new(0.400000003, 0,0.19, 0)
|
||||
surfaceButton.ZIndex = 2
|
||||
|
||||
selection.Parent = surfaceButton
|
||||
|
||||
local ySpacing = 0.14
|
||||
local xSpacing = 0.07
|
||||
for i = 1,4 do
|
||||
for j = 1,2 do
|
||||
local button = surfaceButton:clone()
|
||||
button.RobloxLocked = true
|
||||
button.Position = UDim2.new((j -1)/2.2 + xSpacing,0,ySpacing + (i - 1)/4.6,0)
|
||||
getTextureAndName(button)
|
||||
button.Parent = surfaceMenu
|
||||
table.insert(surfaceButtons,button)
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #surfaceButtons do
|
||||
surfaceButtons[i].MouseButton1Click:connect(function()
|
||||
fadeInButton(surfaceButtons[i])
|
||||
end)
|
||||
end
|
||||
|
||||
local surfaceMenuCloseButton = closeButton:clone()
|
||||
surfaceMenuCloseButton.RobloxLocked = true
|
||||
surfaceMenuCloseButton.Size = UDim2.new(0.2,0,0.09,0)
|
||||
surfaceMenuCloseButton.Parent = surfaceMenu
|
||||
|
||||
local closedState = Instance.new("BoolValue")
|
||||
closedState.RobloxLocked = true
|
||||
closedState.Name = "ClosedState"
|
||||
closedState.Parent = surfaceMenuCloseButton
|
||||
|
||||
setUpCloseButtonState(surfaceMenuCloseButton)
|
||||
|
||||
if game.CoreGui.Version >= 2 then
|
||||
local function setupTweenTransition(button, menu, outXScale, inXScale)
|
||||
button.Changed:connect(
|
||||
function(property)
|
||||
if property ~= "Selected" then
|
||||
return
|
||||
end
|
||||
if button.Selected then
|
||||
menu:TweenPosition(UDim2.new(inXScale, menu.Position.X.Offset, menu.Position.Y.Scale, menu.Position.Y.Offset),
|
||||
Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||
else
|
||||
menu:TweenPosition(UDim2.new(outXScale, menu.Position.X.Offset, menu.Position.Y.Scale, menu.Position.Y.Offset),
|
||||
Enum.EasingDirection.In, Enum.EasingStyle.Quart, 0.5, true)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
setupTweenTransition(paintTool, paintMenu, -2.7, 2.6)
|
||||
setupTweenTransition(surfaceTool, surfaceMenu, -2.6, 2.6)
|
||||
setupTweenTransition(materialTool, materialMenu, -4, 1.4)
|
||||
end
|
||||
|
||||
end)
|
185
scripts/game/2011M/cores/ToolTipper.lua
Normal file
185
scripts/game/2011M/cores/ToolTipper.lua
Normal file
@ -0,0 +1,185 @@
|
||||
-- Creates the tool tips for the new gui!
|
||||
|
||||
delay(0, function()
|
||||
|
||||
local controlFrame = game:GetService("CoreGui").RobloxGui:FindFirstChild("ControlFrame")
|
||||
|
||||
local topLeftControl
|
||||
local bottomLeftControl
|
||||
local bottomRightControl
|
||||
|
||||
if controlFrame then
|
||||
topLeftControl = controlFrame:FindFirstChild("TopLeftControl")
|
||||
bottomLeftControl = controlFrame:FindFirstChild("BottomLeftControl")
|
||||
bottomRightControl = controlFrame:FindFirstChild("BottomRightControl")
|
||||
else
|
||||
topLeftControl = script.Parent:FindFirstChild("TopLeftControl")
|
||||
bottomLeftControl = script.Parent:FindFirstChild("BottomLeftControl")
|
||||
bottomRightControl = script.Parent:FindFirstChild("BottomRightControl")
|
||||
end
|
||||
|
||||
local frame = Instance.new("TextLabel")
|
||||
frame.RobloxLocked = true
|
||||
frame.Name = "ToolTip"
|
||||
frame.Text = "Hi! I'm a ToolTip!"
|
||||
frame.Font = Enum.Font.ArialBold
|
||||
frame.FontSize = Enum.FontSize.Size12
|
||||
frame.TextColor3 = Color3.new(1,1,1)
|
||||
frame.BorderSizePixel = 0
|
||||
frame.ZIndex = 10
|
||||
frame.Size = UDim2.new(2,0,1,0)
|
||||
frame.Position = UDim2.new(1,0,0,0)
|
||||
frame.BackgroundColor3 = Color3.new(0,0,0)
|
||||
frame.BackgroundTransparency = 1
|
||||
frame.TextTransparency = 1
|
||||
frame.TextWrap = true
|
||||
|
||||
local inside = Instance.new("BoolValue")
|
||||
inside.RobloxLocked = true
|
||||
inside.Name = "inside"
|
||||
inside.Value = false
|
||||
inside.Parent = frame
|
||||
|
||||
function setUpListeners(frame)
|
||||
local fadeSpeed = 0.1
|
||||
frame.Parent.MouseEnter:connect(function()
|
||||
frame.inside.Value = true
|
||||
wait(1.2)
|
||||
if frame.inside.Value then
|
||||
while frame.inside.Value and frame.BackgroundTransparency > 0 do
|
||||
frame.BackgroundTransparency = frame.BackgroundTransparency - fadeSpeed
|
||||
frame.TextTransparency = frame.TextTransparency - fadeSpeed
|
||||
wait()
|
||||
end
|
||||
end
|
||||
end)
|
||||
frame.Parent.MouseLeave:connect(function()
|
||||
frame.inside.Value = false
|
||||
frame.BackgroundTransparency = 1
|
||||
frame.TextTransparency = 1
|
||||
end)
|
||||
frame.Parent.MouseButton1Click:connect(function()
|
||||
frame.inside.Value = false
|
||||
frame.BackgroundTransparency = 1
|
||||
frame.TextTransparency = 1
|
||||
end)
|
||||
end
|
||||
|
||||
----------------- set up Top Left Tool Tips --------------------------
|
||||
|
||||
if topLeftControl then
|
||||
local topLeftChildren = topLeftControl:GetChildren()
|
||||
|
||||
for i = 1, #topLeftChildren do
|
||||
|
||||
if topLeftChildren[i].Name == "Help" then
|
||||
local helpTip = frame:clone()
|
||||
helpTip.RobloxLocked = true
|
||||
helpTip.Text = "Help"
|
||||
helpTip.Parent = topLeftChildren[i]
|
||||
setUpListeners(helpTip)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
---------------- set up Bottom Left Tool Tips -------------------------
|
||||
|
||||
local bottomLeftChildren = bottomLeftControl:GetChildren()
|
||||
|
||||
for i = 1, #bottomLeftChildren do
|
||||
|
||||
if bottomLeftChildren[i].Name == "Exit" then
|
||||
local exitTip = frame:clone()
|
||||
exitTip.RobloxLocked = true
|
||||
exitTip.Text = "Leave Place"
|
||||
exitTip.Position = UDim2.new(0,0,-1,0)
|
||||
exitTip.Size = UDim2.new(1,0,1,0)
|
||||
exitTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(exitTip)
|
||||
elseif bottomLeftChildren[i].Name == "TogglePlayMode" then
|
||||
local playTip = frame:clone()
|
||||
playTip.RobloxLocked = true
|
||||
playTip.Text = "Roblox Studio"
|
||||
playTip.Position = UDim2.new(0,0,-1,0)
|
||||
playTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(playTip)
|
||||
elseif bottomLeftChildren[i].Name == "ToolButton" then
|
||||
local toolTip = frame:clone()
|
||||
toolTip.RobloxLocked = true
|
||||
toolTip.Text = "Build Tools"
|
||||
toolTip.Position = UDim2.new(0,0,-1,0)
|
||||
toolTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(toolTip)
|
||||
elseif bottomLeftChildren[i].Name == "SettingsButton" then
|
||||
local toolTip = frame:clone()
|
||||
toolTip.RobloxLocked = true
|
||||
toolTip.Text = "Settings"
|
||||
toolTip.Position = UDim2.new(0,0,-1,0)
|
||||
toolTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(toolTip)
|
||||
end
|
||||
end
|
||||
|
||||
---------------- set up Bottom Right Tool Tips -------------------------
|
||||
|
||||
local bottomRightChildren = bottomRightControl:GetChildren()
|
||||
|
||||
for i = 1, #bottomRightChildren do
|
||||
|
||||
if bottomRightChildren[i].Name == "ToggleFullScreen" then
|
||||
local fullScreen = frame:clone()
|
||||
fullScreen.RobloxLocked = true
|
||||
fullScreen.Text = "Fullscreen"
|
||||
fullScreen.Position = UDim2.new(-1,0,-1,0)
|
||||
fullScreen.Size = UDim2.new(2.4,0,1,0)
|
||||
fullScreen.Parent = bottomRightChildren[i]
|
||||
setUpListeners(fullScreen)
|
||||
elseif bottomRightChildren[i].Name == "ReportAbuse" then
|
||||
local abuseTip = frame:clone()
|
||||
abuseTip.RobloxLocked = true
|
||||
abuseTip.Text = "Report Abuse"
|
||||
abuseTip.Position = UDim2.new(0,0,-1,0)
|
||||
abuseTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(abuseTip)
|
||||
elseif bottomRightChildren[i].Name == "Screenshot" then
|
||||
local shotTip = frame:clone()
|
||||
shotTip.RobloxLocked = true
|
||||
shotTip.Text = "Screenshot"
|
||||
shotTip.Position = UDim2.new(0,0,-1,0)
|
||||
shotTip.Size = UDim2.new(2.1,0,1,0)
|
||||
shotTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(shotTip)
|
||||
elseif bottomRightChildren[i].Name:find("Camera") ~= nil then
|
||||
local cameraTip = frame:clone()
|
||||
cameraTip.RobloxLocked = true
|
||||
cameraTip.Text = "Camera View"
|
||||
if bottomRightChildren[i].Name:find("Zoom") then
|
||||
cameraTip.Position = UDim2.new(-1,0,-1.5)
|
||||
else
|
||||
cameraTip.Position = UDim2.new(0,0,-1.5,0)
|
||||
end
|
||||
cameraTip.Size = UDim2.new(2,0,1.25,0)
|
||||
cameraTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(cameraTip)
|
||||
elseif bottomRightChildren[i].Name == "RecordToggle" then
|
||||
local recordTip = frame:clone()
|
||||
recordTip.RobloxLocked = true
|
||||
recordTip.Text = "Take Video"
|
||||
recordTip.Position = UDim2.new(0,0,-1.1,0)
|
||||
recordTip.Size = UDim2.new(1,0,1,0)
|
||||
recordTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(recordTip)
|
||||
elseif bottomRightChildren[i].Name == "Help" then
|
||||
print("found help in bottom right")
|
||||
local helpTip = frame:clone()
|
||||
helpTip.RobloxLocked = true
|
||||
helpTip.Text = "Help"
|
||||
helpTip.Position = UDim2.new(-0.5,0,-1,0)
|
||||
helpTip.Size = UDim2.new(1.5,0,1,0)
|
||||
helpTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(helpTip)
|
||||
end
|
||||
end
|
||||
|
||||
end)
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user