Replace string concatenation with interplation in corescripts (with darklua 0.12)

This commit is contained in:
Lewin Kelly 2023-12-12 11:45:41 +00:00
parent b97ed39e10
commit da219017d7
17 changed files with 299 additions and 439 deletions

View File

@ -46,32 +46,20 @@ local spinnerIcons
local smallScreenThreshold = 450
-- user facing images
local assetUrls = {}
local assetUrl = "http://banland.xyz/Asset/?id="
local errorImageUrl = assetUrl .. "42557901"
table.insert(assetUrls, errorImageUrl)
local buyImageUrl = assetUrl .. "104651457"
table.insert(assetUrls, buyImageUrl)
local buyImageDownUrl = assetUrl .. "104651515"
table.insert(assetUrls, buyImageDownUrl)
local buyImageDisabledUrl = assetUrl .. "104651532"
table.insert(assetUrls, buyImageDisabledUrl)
local cancelButtonImageUrl = assetUrl .. "104651592"
table.insert(assetUrls, cancelButtonImageUrl)
local cancelButtonDownUrl = assetUrl .. "104651639"
table.insert(assetUrls, cancelButtonDownUrl)
local okButtonUrl = assetUrl .. "104651665"
table.insert(assetUrls, okButtonUrl)
local okButtonPressedrl = assetUrl .. "104651707"
table.insert(assetUrls, okButtonPressedrl)
local freeButtonImageUrl = assetUrl .. "104651733"
table.insert(assetUrls, freeButtonImageUrl)
local freeButtonImageDownUrl = assetUrl .. "104651761"
table.insert(assetUrls, freeButtonImageDownUrl)
local tixIcon = assetUrl .. "102481431"
table.insert(assetUrls, tixIcon)
local robuxIcon = assetUrl .. "102481419"
table.insert(assetUrls, robuxIcon)
local errorImageUrl = `{assetUrl}42557901`
local buyImageUrl = `{assetUrl}104651457`
local buyImageDownUrl = `{assetUrl}104651515`
local buyImageDisabledUrl = `{assetUrl}104651532`
local cancelButtonImageUrl = `{assetUrl}104651592`
local cancelButtonDownUrl = `{assetUrl}104651639`
local okButtonUrl = `{assetUrl}104651665`
local okButtonPressedrl = `{assetUrl}104651707`
local freeButtonImageUrl = `{assetUrl}104651733`
local freeButtonImageDownUrl = `{assetUrl}104651761`
local tixIcon = `{assetUrl}102481431`
local robuxIcon = `{assetUrl}102481419`
-- user facing string
local buyHeaderText = "Buy"
@ -109,8 +97,21 @@ function getRbxUtility()
end
function preloadAssets()
for i = 1, #assetUrls do
game:GetService("ContentProvider"):Preload(assetUrls[i])
for _, assetUrl in ipairs {
errorImageUrl,
buyImageUrl,
buyImageDownUrl,
buyImageDisabledUrl,
cancelButtonImageUrl,
cancelButtonDownUrl,
okButtonUrl,
okButtonPressedrl,
freeButtonImageUrl,
freeButtonImageDownUrl,
tixIcon,
robuxIcon,
} do
game:GetService("ContentProvider"):Preload(assetUrl)
end
end
----------------------------- End Util Functions ---------------------------------------------
@ -224,15 +225,11 @@ function updatePurchasePromptData(_)
newItemDescription
if purchasingConsumable then
purchaseDialog.BodyFrame.ItemPreview.Image = baseUrl
.. "thumbs/asset.ashx?assetid="
.. tostring(currentProductInfo.IconImageAssetId)
.. "&x=100&y=100&format=png"
purchaseDialog.BodyFrame.ItemPreview.Image =
`{baseUrl}thumbs/asset.ashx?assetid={currentProductInfo.IconImageAssetId}&x=100&y=100&format=png`
else
purchaseDialog.BodyFrame.ItemPreview.Image = baseUrl
.. "thumbs/asset.ashx?assetid="
.. tostring(currentAssetId)
.. "&x=100&y=100&format=png"
purchaseDialog.BodyFrame.ItemPreview.Image =
`{baseUrl}thumbs/asset.ashx?assetid={currentAssetId}&x=100&y=100&format=png`
end
end
@ -247,7 +244,7 @@ function doPlayerFundsCheck(checkIndefinitely)
and checkingPlayerFunds
and canPurchase
do
wait(1 / 10)
wait(0.1)
canPurchase, insufficientFunds = canPurchaseItem()
retries -= 1
end
@ -415,30 +412,19 @@ function doAcceptPurchase(_)
-- http call to do the purchase
local response = "none"
local url
local url = `{getSecureApiBaseUrl()}marketplace/`
local currencyData = `&currencyTypeId={currencyEnumToInt(
currentCurrencyType
)}&currencyTypeId={currencyEnumToInt(
currentCurrencyType
)}`
-- consumables need to use a different url
if purchasingConsumable then
url = getSecureApiBaseUrl()
.. "marketplace/submitpurchase?productId="
.. tostring(currentProductId)
.. "&currencyTypeId="
.. tostring(currencyEnumToInt(currentCurrencyType))
.. "&expectedUnitPrice="
.. tostring(currentCurrencyAmount)
.. "&placeId="
.. tostring(Game.PlaceId)
url ..= `submitpurchase?productId={currentProductId}{currencyData}&expectedUnitPrice={currentCurrencyAmount}&placeId={Game.PlaceId}`
else
url = getSecureApiBaseUrl()
.. "marketplace/purchase?productId="
.. tostring(currentProductId)
.. "&currencyTypeId="
.. tostring(currencyEnumToInt(currentCurrencyType))
.. "&purchasePrice="
.. tostring(currentCurrencyAmount)
.. "&locationType=Game"
.. "&locationId="
.. Game.PlaceId
url ..= `purchase?productId={currentProductId}{currencyData}&purchasePrice={currentCurrencyAmount}&locationType=Game&locationId={Game.PlaceId}`
end
local success, reason = ypcall(function()
@ -652,7 +638,7 @@ local function getPlayerBalance()
local playerBalance
local success, errorCode = ypcall(function()
playerBalance =
game:HttpGetAsync(getSecureApiBaseUrl() .. "currency/balance")
game:HttpGetAsync(`{getSecureApiBaseUrl()}currency/balance`)
end)
if not success then
print("Get player balance failed because", errorCode)
@ -671,12 +657,12 @@ end
-- should open an external default browser window to this url
function openBuyCurrencyWindow()
checkingPlayerFunds = true
GuiService:OpenBrowserWindow(baseUrl .. "Upgrades/Robux.aspx")
GuiService:OpenBrowserWindow(`{baseUrl}Upgrades/Robux.aspx`)
end
function openBCUpSellWindow()
GuiService:OpenBrowserWindow(
baseUrl .. "Upgrades/BuildersClubMemberships.aspx"
`{baseUrl}Upgrades/BuildersClubMemberships.aspx`
)
end
@ -714,18 +700,12 @@ function updateAfterBalanceText(playerBalance, notRightBc)
openBuyCurrencyWindow
)
end
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "You need "
.. currencyTypeToString(currentCurrencyType)
.. " "
.. tostring(-afterBalanceNumber)
.. " more to buy this, click here to purchase more."
purchaseDialog.BodyFrame.AfterBalanceButton.Text =
`You need R$ {-afterBalanceNumber} more to buy this, click here to purchase more.`
return true, true
elseif afterBalanceNumber < 0 and keyWord == "tickets" then
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "You need "
.. tostring(-afterBalanceNumber)
.. " "
.. currencyTypeToString(currentCurrencyType)
.. " more to buy this item."
purchaseDialog.BodyFrame.AfterBalanceButton.Text =
`You need {-afterBalanceNumber} Tix more to buy this item.`
return true, true -- user can't buy more tickets, so we say fail the transaction (maybe instead we can prompt them to trade currency???)
end
end
@ -735,11 +715,10 @@ function updateAfterBalanceText(playerBalance, notRightBc)
openBuyCurrencyWindowConnection:disconnect()
openBuyCurrencyWindowConnection = nil
end
purchaseDialog.BodyFrame.AfterBalanceButton.Text = "Your balance after this transaction will be "
.. currencyTypeToString(currentCurrencyType)
.. " "
.. tostring(afterBalanceNumber)
.. "."
purchaseDialog.BodyFrame.AfterBalanceButton.Text =
`Your balance after this transaction will be {currencyTypeToString(
currentCurrencyType
)} {afterBalanceNumber}.`
return true, false
end
@ -780,9 +759,7 @@ function canPurchaseItem()
local currentProductInfoRaw
success = ypcall(function()
currentProductInfoRaw = Game:HttpGetAsync(
getSecureApiBaseUrl()
.. "marketplace/productDetails?productid="
.. tostring(currentProductId)
`{getSecureApiBaseUrl()}marketplace/productDetails?productid={currentProductId}`
)
end)
if success then
@ -814,11 +791,7 @@ function canPurchaseItem()
local success2, errorCode = ypcall(function()
playerOwnsAsset = game:HttpGetAsync(
getSecureApiBaseUrl()
.. "ownership/hasAsset?userId="
.. tostring(game.Players.LocalPlayer.userId)
.. "&assetId="
.. tostring(currentAssetId)
`{getSecureApiBaseUrl()}ownership/hasAsset?userId={game.Players.LocalPlayer.userId}&assetId={currentAssetId}`
)
end)
@ -925,7 +898,8 @@ end
-- function computeSpaceString(pLabel)
-- local nString = " "
-- local tempSpaceLabel = Instance.new "TextButton"
-- tempSpaceLabel.Size = UDim2.new(0, pLabel.AbsoluteSize.X, 0, pLabel.AbsoluteSize.Y)
-- tempSpaceLabel.Size =
-- UDim2.new(0, pLabel.AbsoluteSize.X, 0, pLabel.AbsoluteSize.Y)
-- tempSpaceLabel.FontSize = pLabel.FontSize
-- tempSpaceLabel.Parent = pLabel.Parent
-- tempSpaceLabel.BackgroundTransparency = 1
@ -933,10 +907,10 @@ end
-- tempSpaceLabel.Name = "SpaceButton"
-- while tempSpaceLabel.TextBounds.X < pLabel.TextBounds.X do
-- nString = nString .. " "
-- nString ..= " "
-- tempSpaceLabel.Text = nString
-- end
-- nString = nString .. " "
-- nString ..= " "
-- tempSpaceLabel.Text = ""
-- return nString
-- end

View File

@ -624,9 +624,8 @@ function initializeDeveloperConsole()
message.TextWrapped = wordWrapToggleOn
message.Size = UDim2.new(0.98, 0, 0, 2000)
message.Parent = Dev_Container
message.Text = messageList[i].Time
.. " -- "
.. messageList[i].Message
message.Text =
`{messageList[i].Time} -- {messageList[i].Message}`
message.Size = UDim2.new(0.98, 0, 0, message.TextBounds.Y)
message.Position = UDim2.new(0, 5, 0, posOffset)

View File

@ -292,7 +292,7 @@ local function presentDialogChoices(talkingPart, dialogChoices)
end
lastChoice.Position = UDim2.new(0, 0, 0, yPosition)
lastChoice.Number.Text = pos .. ")"
lastChoice.Number.Text = `{pos})`
mainFrame.Size = UDim2.new(0, 350, 0, yPosition + 24 + 32)
mainFrame.Position = UDim2.new(0, 20, 0, -mainFrame.Size.Y.Offset - 20)
@ -312,7 +312,6 @@ local function renewKillswitch(dialog)
currentAbortDialogScript.Parent = dialog
end
local function selectChoice(choice)
renewKillswitch(currentConversationDialog)

View File

@ -2186,18 +2186,18 @@ t.AutoTruncateTextObject = function(textLabel)
end
else
local len = string.len(text)
textLabel.Text = text .. "~"
textLabel.Text = `{text}~`
--Shrink the text
local textSize = binaryGrow(0, len, function(pos)
if pos == 0 then
textLabel.Text = "~"
else
textLabel.Text = string.sub(text, 1, pos) .. "~"
textLabel.Text = `{string.sub(text, 1, pos)}~`
end
return textLabel.TextFits
end)
shortText = string.sub(text, 1, textSize) .. "~"
shortText = `{string.sub(text, 1, textSize)}~`
textLabel.Text = shortText
--Make sure the fullLabel fits
@ -2699,9 +2699,9 @@ t.CreateSetPanel = function(
and type(userIdsForSets) ~= "userdata"
then
error(
"CreateSetPanel: userIdsForSets (first arg) is of type "
.. type(userIdsForSets)
.. ", should be of type table or userdata"
`CreateSetPanel: userIdsForSets (first arg) is of type {type(
userIdsForSets
)}, should be of type table or userdata`
)
end
if not objectSelected then
@ -2709,16 +2709,16 @@ t.CreateSetPanel = function(
end
if type(objectSelected) ~= "function" then
error(
"CreateSetPanel: objectSelected (second arg) is of type "
.. type(objectSelected)
.. ", should be of type function!"
`CreateSetPanel: objectSelected (second arg) is of type {type(
objectSelected
)}, should be of type function!`
)
end
if dialogClosed and type(dialogClosed) ~= "function" then
error(
"CreateSetPanel: dialogClosed (third arg) is of type "
.. type(dialogClosed)
.. ", should be of type function!"
`CreateSetPanel: dialogClosed (third arg) is of type {type(
dialogClosed
)}, should be of type function!`
)
end
@ -2750,17 +2750,14 @@ t.CreateSetPanel = function(
local SmallThumbnailUrl
local LargeThumbnailUrl
local BaseUrl = game:GetService("ContentProvider").BaseUrl:lower()
local ThumbUrl = `{BaseUrl}Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=`
if useAssetVersionId then
LargeThumbnailUrl = BaseUrl
.. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&assetversionid="
SmallThumbnailUrl = BaseUrl
.. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=75&ht=75&assetversionid="
LargeThumbnailUrl = `{ThumbUrl}420&ht=420&assetversionid=`
SmallThumbnailUrl = `{ThumbUrl}75&ht=75&assetversionid=`
else
LargeThumbnailUrl = BaseUrl
.. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&aid="
SmallThumbnailUrl = BaseUrl
.. "Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=75&ht=75&aid="
LargeThumbnailUrl = `{ThumbUrl}420&ht=420&aid=`
SmallThumbnailUrl = `{ThumbUrl}75&ht=75&aid=`
end
local function drillDownSetZIndex(parent, index)
@ -3135,7 +3132,7 @@ t.CreateSetPanel = function(
local function createTerrainTypeButton(name, parent)
local dropDownTextButton = Instance.new "TextButton"
dropDownTextButton.Name = name .. "Button"
dropDownTextButton.Name = `{name}Button`
dropDownTextButton.Font = Enum.Font.ArialBold
dropDownTextButton.FontSize = Enum.FontSize.Size14
dropDownTextButton.BorderSizePixel = 0
@ -3446,12 +3443,12 @@ t.CreateSetPanel = function(
local function resetAllSetButtonSelection()
local setButtons = setGui.SetPanel.Sets.SetsLists:GetChildren()
for i = 1, #setButtons do
if setButtons[i]:IsA "TextButton" then
setButtons[i].Selected = false
setButtons[i].BackgroundTransparency = 1
setButtons[i].TextColor3 = Color3.new(1, 1, 1)
setButtons[i].BackgroundColor3 = Color3.new(1, 1, 1)
for _, setButton in ipairs(setButtons) do
if setButton:IsA "TextButton" then
setButton.Selected = false
setButton.BackgroundTransparency = 1
setButton.TextColor3 = Color3.new(1, 1, 1)
setButton.BackgroundColor3 = Color3.new(1, 1, 1)
end
end
end
@ -4026,9 +4023,9 @@ t.CreateLoadingFrame = function(name, size, position)
)
if percent and type(percent) ~= "number" then
error(
"updateLoadingGuiPercent expects number as argument, got "
.. type(percent)
.. " instead"
`updateLoadingGuiPercent expects number as argument, got {type(
percent
)} instead`
)
end
@ -4077,9 +4074,8 @@ t.CreateLoadingFrame = function(name, size, position)
loadingGreenBar.Changed:connect(function(prop)
if prop == "Size" then
loadingPercent.Text = tostring(
math.ceil(loadingGreenBar.Size.X.Scale * 100)
) .. "%"
loadingPercent.Text =
`{math.ceil(loadingGreenBar.Size.X.Scale * 100)}%`
end
end)
@ -4120,7 +4116,7 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent)
end
local dragBar = Instance.new "Frame"
dragBar.Name = tostring(name) .. "DragBar"
dragBar.Name = `{name}DragBar`
dragBar.BackgroundColor3 = Color3.new(39 / 255, 39 / 255, 39 / 255)
dragBar.BorderColor3 = Color3.new(0, 0, 0)
if size then
@ -4146,7 +4142,7 @@ t.CreatePluginFrame = function(name, size, position, scrollable, parent)
-- plugin name label
local pluginNameLabel = Instance.new "TextLabel"
pluginNameLabel.Name = "BarNameLabel"
pluginNameLabel.Text = " " .. tostring(name)
pluginNameLabel.Text = ` {name}`
pluginNameLabel.TextColor3 = Color3.new(1, 1, 1)
pluginNameLabel.TextStrokeTransparency = 0
pluginNameLabel.Size = UDim2.new(1, 0, 1, 0)

View File

@ -1257,7 +1257,7 @@ local function createGameSettingsMenu(baseZIndex, _)
game:GetService("GuiService"):SendNotification(
"Graphics Quality",
"Increased to (" .. graphicsSetter.Text .. ")",
`Increased to ({graphicsSetter.Text})`,
"",
2,
function() end
@ -1272,7 +1272,7 @@ local function createGameSettingsMenu(baseZIndex, _)
game:GetService("GuiService"):SendNotification(
"Graphics Quality",
"Decreased to (" .. graphicsSetter.Text .. ")",
`Decreased to ({graphicsSetter.Text})`,
"",
2,
function() end

View File

@ -218,7 +218,7 @@ local function getMembershipTypeIcon(membershipType, playerName)
elseif membershipType == Enum.MembershipType.OutrageousBuildersClub then
return "rbxasset://textures/ui/TinyObcIcon.png"
else
error("Unknown membershipType" .. membershipType)
error(`Unknown membershipType {membershipType}`)
end
end
@ -235,7 +235,7 @@ local function getFriendStatusIcon(friendStatus)
elseif friendStatus == Enum.FriendStatus.FriendRequestReceived then
return "http://banland.xyz/asset/?id=99776838"
else
error("Unknown FriendStatus: " .. friendStatus)
error(`Unknown FriendStatus {friendStatus}`)
end
end
@ -301,7 +301,7 @@ end
local function WaitForChild(parent, child)
while not parent:FindFirstChild(child) do
wait()
debugprint(" child " .. parent.Name .. " waiting for " .. child)
debugprint(` child {parent.Name} waiting for {child}`)
end
return parent[child]
end
@ -880,7 +880,7 @@ local DefaultEntriesOnScreen = 8
for _, i in pairs(Images) do
Game:GetService("ContentProvider")
:Preload("http://banland.xyz/asset/?id=" .. i)
:Preload(`http://banland.xyz/asset/?id={i}`)
end
-- ordered array of 'score data', each entry has:
@ -1171,26 +1171,25 @@ function HighlightMyRank(
MemberButton,
AdminButton
)
BanPlayerButton.Image = "http://banland.xyz/asset/?id="
.. Images.LightPopupMid
VisitorButton.Image = "http://banland.xyz/asset/?id=" .. Images.DarkPopupMid
MemberButton.Image = "http://banland.xyz/asset/?id=" .. Images.LightPopupMid
AdminButton.Image = "http://banland.xyz/asset/?id="
.. Images.DarkPopupBottom
BanPlayerButton.Image =
`http://banland.xyz/asset/?id={Images.LightPopupMid}`
VisitorButton.Image = `http://banland.xyz/asset/?id={Images.DarkPopupMid}`
MemberButton.Image = `http://banland.xyz/asset/?id={Images.LightPopupMid}`
AdminButton.Image = `http://banland.xyz/asset/?id={Images.DarkPopupBottom}`
local rank = player.PersonalServerRank
if rank <= PrivilegeLevel.Banned then
BanPlayerButton.Image = "http://banland.xyz/asset/?id="
.. Images.LightBluePopupMid
BanPlayerButton.Image =
`http://banland.xyz/asset/?id={Images.LightBluePopupMid}`
elseif rank <= PrivilegeLevel.Visitor then
VisitorButton.Image = "http://banland.xyz/asset/?id="
.. Images.DarkBluePopupMid
VisitorButton.Image =
`http://banland.xyz/asset/?id={Images.DarkBluePopupMid}`
elseif rank <= PrivilegeLevel.Member then
MemberButton.Image = "http://banland.xyz/asset/?id="
.. Images.LightBluePopupMid
MemberButton.Image =
`http://banland.xyz/asset/?id={Images.LightBluePopupMid}`
elseif rank <= PrivilegeLevel.Admin then
AdminButton.Image = "http://banland.xyz/asset/?id="
.. Images.DarkBluePopupBottom
AdminButton.Image =
`http://banland.xyz/asset/?id={Images.DarkBluePopupBottom}`
end
end
@ -1467,7 +1466,7 @@ local function DoesStatExist(statName, exception)
and playerf.Player:FindFirstChild "leaderstats"
and playerf.Player.leaderstats:FindFirstChild(statName)
then
--print('player:' .. playerf['Player'].Name ..' has stat')
-- print(`player {playerf.Player.Name} has stat`)
return true
end
end
@ -1625,9 +1624,7 @@ function RecreateScoreColumns(ptable)
-- make an entry for this object
local nentry = MakeScoreEntry(entry, scoreval, panel)
if nentry then
debugprint(
"adding " .. nentry.Name .. " to " .. entry.Player.Name
)
debugprint(`adding {nentry.Name} to {entry.Player.Name}`)
nentry.Parent = panel
-- add score to team
if
@ -1947,7 +1944,7 @@ function UpdateMaximize()
for j = 1, #ScoreNames, 1 do
local scoreval = ScoreNames[j]
if i:FindFirstChild(scoreval.Name) and scoreval.XOffset then
--print('updateing stat position: ' .. scoreval['Name'])
-- print(`updateing stat position {scoreval["Name"]}`)
i[scoreval.Name]:TweenPosition(
UDim2.new(RightEdgeSpace, -scoreval.XOffset, 0, 0),
"Out",
@ -2220,7 +2217,7 @@ function StartDrag(entry, startx, starty)
end
local nowY = AbsoluteToPercent(nx, ny).Y
debugprint(
"drag dist:" .. Vector2.new(startx - nx, starty - ny).magnitude
`drag dist {Vector2.new(startx - nx, starty - ny).magnitude}`
)
if
Vector2.new(startx - nx, starty - ny).magnitude
@ -2481,7 +2478,7 @@ end
--]]
function LeaderstatsRemoved(_, playerEntry)
while AddingFrameLock do
debugprint("waiting to insert " .. playerEntry.Player.Name)
debugprint(`waiting to insert {playerEntry.Player.Name}`)
wait()
end
AddingFrameLock = true
@ -2699,7 +2696,7 @@ end
--]]
local function InsertPlayerFrame(nplayer)
while AddingFrameLock do
debugprint("waiting to insert " .. nplayer.Name)
debugprint(`waiting to insert {nplayer.Name}`)
wait()
end
AddingFrameLock = true
@ -3042,7 +3039,7 @@ local function SetPlayerToTeam(entry)
end
-- if player was set to an invalid team, then set it back to neutral
if not setToTeam and #(game.Teams:GetTeams()) > 0 then
debugprint(entry.Player.Name .. "could not find team")
debugprint(`{entry.Player.Name} could not find team`)
entry.MyTeam = nil
if not NeutralTeam then
AddNeutralTeam()
@ -3069,18 +3066,18 @@ function PlayerChanged(entry, property)
if property == "Neutral" then
-- if player changing to neutral
if entry.Player.Neutral and #(game.Teams:GetTeams()) > 0 then
debugprint(entry.Player.Name .. "setting to neutral")
debugprint(`{entry.Player.Name} setting to neutral`)
FindRemovePlayerFromTeam(entry)
entry.MyTeam = nil
if not NeutralTeam then
debugprint(entry.Player.Name .. "creating neutral team")
debugprint(`{entry.Player.Name} creating neutral team`)
AddNeutralTeam()
else
debugprint(entry.Player.Name .. "adding to neutral team")
debugprint(`{entry.Player.Name} adding to neutral team`)
AddPlayerToTeam(NeutralTeam, entry)
end
elseif #(game.Teams:GetTeams()) > 0 then -- else player switching to a team, or a weird edgecase
debugprint(entry.Player.Name .. "has been set non-neutral")
debugprint(`{entry.Player.Name} has been set non-neutral`)
SetPlayerToTeam(entry)
end
BaseUpdate()
@ -3089,7 +3086,7 @@ function PlayerChanged(entry, property)
and not entry.Player.Neutral
and entry.Player ~= entry.MyTeam
then
debugprint(entry.Player.Name .. "setting to new team")
debugprint(`{entry.Player.Name} setting to new team`)
SetPlayerToTeam(entry)
BaseUpdate()
elseif property == "Name" or property == "MembershipType" then
@ -3114,12 +3111,7 @@ end
function OnFriendshipChanged(player, friendStatus)
Delay(0.5, function()
debugprint(
"friend status changed for:"
.. player.Name
.. " "
.. tostring(friendStatus)
.. " vs "
.. tostring(GetFriendStatus(player))
`friend status changed for {player.Name} {friendStatus} vs {GetFriendStatus(player)}`
)
for _, entry in ipairs(PlayerFrames) do
if entry.Player == player then
@ -3130,7 +3122,7 @@ function OnFriendshipChanged(player, friendStatus)
elseif nicon ~= "" and entry.Frame.FriendLabel.Image == "" then
entry.Frame.TitleFrame.Title.Position = entry.Frame.TitleFrame.Title.Position
+ UDim2.new(0, 17, 0, 0)
debugprint("confirmed status:" .. player.Name)
debugprint(`confirmed status {player.Name}`)
end
entry.Frame.FriendLabel.Image = nicon
return
@ -3586,7 +3578,7 @@ IsPersonalServer = not not game.Workspace:FindFirstChild "PSVariable"
-- while true do
-- local str_players = ""
-- for _, i in pairs(game.Players:GetPlayers()) do
-- str_players ..= " " .. i.Name
-- str_players ..= ` {i.Name}`
-- end
-- debugplayers.Text = str_players
-- wait(0.5)

View File

@ -44,12 +44,9 @@ function makeFriend(fromPlayer, toPlayer)
return
end -- previously cancelled friend request, we don't want it!
popup.PopupText.Text = "Accept Friend Request from "
.. tostring(fromPlayer.Name)
.. "?"
popup.PopupImage.Image = "http://banland.xyz/thumbs/avatar.ashx?userId="
.. tostring(fromPlayer.userId)
.. "&x=352&y=352"
popup.PopupText.Text = `Accept Friend Request from {fromPlayer.Name}?`
popup.PopupImage.Image =
`http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=352&y=352`
showTwoButtons()
popup.Visible = true
@ -116,10 +113,8 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
if event == Enum.FriendRequestEvent.Accept then
game:GetService("GuiService"):SendNotification(
"You are Friends",
"With " .. toPlayer.Name .. "!",
"http://banland.xyz/thumbs/avatar.ashx?userId="
.. tostring(toPlayer.userId)
.. "&x=48&y=48",
`With {toPlayer.Name}!`,
`http://banland.xyz/thumbs/avatar.ashx?userId={toPlayer.userId}&x=48&y=48`,
5,
function() end
)
@ -131,10 +126,8 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
end -- previously cancelled friend request, we don't want it!
game:GetService("GuiService"):SendNotification(
"Friend Request",
"From " .. fromPlayer.Name,
"http://banland.xyz/thumbs/avatar.ashx?userId="
.. tostring(fromPlayer.userId)
.. "&x=48&y=48",
`From {fromPlayer.Name}`,
`http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`,
8,
function()
makeFriend(fromPlayer, toPlayer)
@ -143,10 +136,8 @@ game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
elseif event == Enum.FriendRequestEvent.Accept then
game:GetService("GuiService"):SendNotification(
"You are Friends",
"With " .. fromPlayer.Name .. "!",
"http://banland.xyz/thumbs/avatar.ashx?userId="
.. tostring(fromPlayer.userId)
.. "&x=48&y=48",
`With {fromPlayer.Name}!`,
`http://banland.xyz/thumbs/avatar.ashx?userId={fromPlayer.userId}&x=48&y=48`,
5,
function() end
)

View File

@ -99,7 +99,7 @@ for i = 0, NumSlots do
slotFrame.BackgroundColor3 = Color3.new(0, 0, 0)
slotFrame.BackgroundTransparency = 1
slotFrame.BorderColor3 = Color3.new(1, 1, 1)
slotFrame.Name = "Slot" .. tostring(i)
slotFrame.Name = `Slot{i}`
slotFrame.ZIndex = 4.0
if i == 0 then
slotFrame.Position = UDim2.new(0.9, 0, 0, 0)

View File

@ -792,7 +792,7 @@ local addingPlayerChild = function(
end
local slotNum = slotToMod % 10
local parent = currentLoadout:FindFirstChild("Slot" .. tostring(slotNum))
local parent = currentLoadout:FindFirstChild(`Slot{slotNum}`)
gearClone.Parent = parent
if inventoryGearButton then

View File

@ -287,12 +287,12 @@ function JsonReader:ReadNumber()
local result = self:Next()
local peek = self:Peek()
while peek ~= nil and string.find(peek, "[%+%-%d%.eE]") do
result = result .. self:Next()
result ..= self:Next()
peek = self:Peek()
end
result = tonumber(result)
if result == nil then
error(string.format("Invalid number: '%s'", result))
error(`"Invalid number: '{result}'`)
else
return result
end
@ -309,7 +309,7 @@ function JsonReader:ReadString()
ch = self.escapes[ch]
end
end
result = result .. ch
result ..= ch
end
assert(self:Next() == '"')
local fromunicode = function(m)
@ -326,7 +326,7 @@ function JsonReader:ReadComment()
elseif second == "*" then
self:ReadBlockComment()
else
error(string.format("Invalid comment: %s", self:All()))
error(`Invalid comment: {self:All()}`)
end
end
@ -338,9 +338,7 @@ function JsonReader:ReadBlockComment()
done = true
end
if not done and ch == "/" and self:Peek() == "*" then
error(
string.format("Invalid comment: %s, '/*' illegal.", self:All())
)
error(string.format(`Invalid comment: {self:All()}, '/*' illegal.`))
end
end
self:Next()
@ -370,13 +368,7 @@ function JsonReader:ReadArray()
if not done then
local ch = self:Next()
if ch ~= "," then
error(
string.format(
"Invalid array: '%s' due to: '%s'",
self:All(),
ch
)
)
error(`Invalid array: '{self:All()}' due to: '{ch}'`)
end
end
end
@ -394,18 +386,12 @@ function JsonReader:ReadObject()
while not done do
local key = self:Read()
if type(key) ~= "string" then
error(string.format("Invalid non-string object key: %s", key))
error(`Invalid non-string object key: {key}`)
end
self:SkipWhiteSpace()
local ch = self:Next()
if ch ~= ":" then
error(
string.format(
"Invalid object: '%s' due to: '%s'",
self:All(),
ch
)
)
error(`Invalid object: '{self:All()}' due to: '{ch}'`)
end
self:SkipWhiteSpace()
local val = self:Read()
@ -417,13 +403,7 @@ function JsonReader:ReadObject()
if not done then
ch = self:Next()
if ch ~= "," then
error(
string.format(
"Invalid array: '%s' near: '%s'",
self:All(),
ch
)
)
error(`Invalid array: '{self:All()}' near: '{ch}'`)
end
end
end
@ -522,14 +502,16 @@ t.SelectTerrainRegion = function(
if type(regionToSelect) ~= "Region3" then
error(
"regionToSelect (first arg), should be of type Region3, but is type "
.. type(regionToSelect)
`regionToSelect (first arg), should be of type Region3, but is type {type(
regionToSelect
)}`
)
end
if type(color) ~= "BrickColor" then
error(
"color (second arg), should be of type BrickColor, but is type "
.. type(color)
`color (second arg), should be of type BrickColor, but is type {type(
color
)}`
)
end
@ -568,10 +550,14 @@ t.SelectTerrainRegion = function(
-- srs translation from region3 to region3int16
-- local function Region3ToRegion3int16(region3)
-- local theLowVec = region3.CFrame.p - (region3.Size / 2) + Vector3.new(2, 2, 2)
-- local theLowVec = region3.CFrame.p
-- - (region3.Size / 2)
-- + Vector3.new(2, 2, 2)
-- local lowCell = WorldToCellPreferSolid(terrain, theLowVec)
-- local theHighVec = region3.CFrame.p + (region3.Size / 2) - Vector3.new(2, 2, 2)
-- local theHighVec = region3.CFrame.p
-- + (region3.Size / 2)
-- - Vector3.new(2, 2, 2)
-- local highCell = WorldToCellPreferSolid(terrain, theHighVec)
-- local highIntVec = Vector3int16.new(highCell.x, highCell.y, highCell.z)
@ -960,9 +946,7 @@ local function Create_PrivImpl(objectType)
elseif type(k) == "number" then
if type(v) ~= "userdata" then
error(
"Bad entry in Create body: Numeric keys must be paired with children, got a: "
.. type(v),
2
`Bad entry in Create body: Numeric keys must be paired with children, got a: {v}`
)
end
v.Parent = obj
@ -971,10 +955,7 @@ local function Create_PrivImpl(objectType)
elseif type(k) == "table" and k.__eventname then
if type(v) ~= "function" then
error(
"Bad entry in Create body: Key `[Create.E'"
.. k.__eventname
.. "']` must have a function value, got: "
.. tostring(v),
`Bad entry in Create body: Key \`[Create.E'{k.__eventname}']\` must have a function value, got: {v}`,
2
)
end
@ -984,8 +965,7 @@ local function Create_PrivImpl(objectType)
elseif k == t.Create then
if type(v) ~= "function" then
error(
"Bad entry in Create body: Key `[Create]` should be paired with a constructor function, got: "
.. tostring(v),
`Bad entry in Create body: Key \`[Create]\` should be paired with a constructor function, got: {v}`,
2
)
elseif ctor then
@ -997,14 +977,7 @@ local function Create_PrivImpl(objectType)
end
ctor = v
else
error(
"Bad entry ("
.. tostring(k)
.. " => "
.. tostring(v)
.. ") in Create body",
2
)
error(`Bad entry ({k} => {v}) in Create body`, 2)
end
end

View File

@ -1251,9 +1251,7 @@ t.SetupStamperDragger = function(
end
if not Mouse:IsA "Mouse" then
error(
"Error: RbxStamper.DoStamperMouseMove: Mouse is of type "
.. Mouse.className
.. " should be of type Mouse"
`Error: RbxStamper.DoStamperMouseMove: Mouse is of type {Mouse.className} should be of type Mouse`
)
return
end
@ -1845,8 +1843,7 @@ t.SetupStamperDragger = function(
end
-- After rotating, update the position
configFound, targetCFrame =
findConfigAtMouseTarget(Mouse, stampData)
configFound, targetCFrame = findConfigAtMouseTarget(Mouse, stampData)
if configFound then
stampData.CurrentParts =
positionPartsAtCFrame3(targetCFrame, stampData.CurrentParts)
@ -2566,7 +2563,8 @@ t.SetupStamperDragger = function(
end
-- if it's a model, we also want to fill in the playerID and playerName tags, if it has those (e.g. for the friend-only door)
local playerIdTag = stampData.CurrentParts:FindFirstChild "PlayerIdTag"
local playerIdTag =
stampData.CurrentParts:FindFirstChild "PlayerIdTag"
local playerNameTag =
stampData.CurrentParts:FindFirstChild "PlayerNameTag"
@ -2804,7 +2802,8 @@ t.SetupStamperDragger = function(
end
if clone:FindFirstChild("ClusterMaterial", true) then -- extract all info from vector
local clusterMaterial = clone:FindFirstChild("ClusterMaterial", true)
local clusterMaterial =
clone:FindFirstChild("ClusterMaterial", true)
if clusterMaterial:IsA "Vector3Value" then
cellInfo.Material = clusterMaterial.Value.X
cellInfo.clusterType = clusterMaterial.Value.Y

View File

@ -773,11 +773,11 @@ function getGearContextMenu()
local element = contextElement
if element.Type == "Button" then
local button = Instance.new "TextButton"
button.Name = "UnequipContextButton" .. i
button.Name = `UnequipContextButton{i}`
button.BackgroundColor3 = Color3.new(0, 0, 0)
button.BorderSizePixel = 0
button.TextXAlignment = Enum.TextXAlignment.Left
button.Text = " " .. contextElement.Text
button.Text = ` {contextElement.Text}`
button.Font = Enum.Font.Arial
button.FontSize = Enum.FontSize.Size14
button.Size = UDim2.new(1, 8, 0, elementHeight)
@ -815,7 +815,7 @@ function getGearContextMenu()
contextElement.Element = button
elseif element.Type == "Label" then
local frame = Instance.new "Frame"
frame.Name = "ContextLabel" .. i
frame.Name = `ContextLabel{i}`
frame.BackgroundTransparency = 1
frame.Size = UDim2.new(1, 8, 0, elementHeight)

View File

@ -83,7 +83,7 @@ do
end,
},
__tostring = function(self)
return "Enum." .. self[EnumName]
return `Enum.{self[EnumName]}`
end,
}
local item_mt = {
@ -91,7 +91,7 @@ do
return value == self or value == self.Name or value == self.Value
end,
__tostring = function(self)
return "Enum." .. self[EnumName] .. "." .. self.Name
return `Enum.{self[EnumName]}.{self.Name}`
end,
}
CreateEnum = function(enumName)
@ -179,11 +179,45 @@ local Chat = {
Messages_List = {},
MessageThread = nil,
--[[ Admins_List = {'Sorcus', 'Shedletsky', 'Telamon', 'Tarabyte', 'StickMasterLuke', 'OnlyTwentyCharacters', 'FusRoblox', 'SolarCrane',
'HotThoth', 'JediTkacheff', 'Builderman', 'Brighteyes', 'ReeseMcblox', 'GemLocker', 'GongfuTiger', 'Erik.Cassel', 'Matt Dusek', 'Keith',
'Totbl', 'LordRugDump', 'David.Baszucki', 'Dbapostle', 'DaveYorkRBX', 'nJay', 'OstrichSized', 'TobotRobot', 'twberg', 'Mercury', 'RBAdam', 'Doughtless',
'Anaminus', 'Stravant', 'Cr3470r', 'CodeWriter', 'Games', 'AcesWayUpHigh', 'Phil'
}, --]]
-- Admins_List = {
-- "Sorcus",
-- "Shedletsky",
-- "Telamon",
-- "Tarabyte",
-- "StickMasterLuke",
-- "OnlyTwentyCharacters",
-- "FusRoblox",
-- "SolarCrane",
-- "HotThoth",
-- "JediTkacheff",
-- "Builderman",
-- "Brighteyes",
-- "ReeseMcblox",
-- "GemLocker",
-- "GongfuTiger",
-- "Erik.Cassel",
-- "Matt Dusek",
-- "Keith",
-- "Totbl",
-- "LordRugDump",
-- "David.Baszucki",
-- "Dbapostle",
-- "DaveYorkRBX",
-- "nJay",
-- "OstrichSized",
-- "TobotRobot",
-- "twberg",
-- "Mercury",
-- "RBAdam",
-- "Doughtless",
-- "Anaminus",
-- "Stravant",
-- "Cr3470r",
-- "CodeWriter",
-- "Games",
-- "AcesWayUpHigh",
-- "Phil",
-- },
Admins_List = { "taskmanager", "Heliodex", "tako" },
SafeChat_List = {
@ -990,21 +1024,23 @@ end
-- Scrolling
-- function Chat:ScrollQueue(value)
-- --[[for i = 1, #self.MessageQueue do
-- for i = 1, #self.MessageQueue do
-- if self.MessageQueue[i] then
-- for _, label in pairs(self.MessageQueue[i]) do
-- local next = self.MessageQueue[i].Next
-- local previous = self.MessageQueue[i].Previous
-- if label and label:IsA('TextLabel') or label:IsA('TextButton') then
-- if
-- label and label:IsA "TextLabel" or label:IsA "TextButton"
-- then
-- if value > 0 and previous and previous.Message then
-- label.Position = previous['Message'].Position
-- label.Position = previous["Message"].Position
-- elseif value < 1 and next.Message then
-- label.Position = previous['Message'].Position
-- label.Position = previous["Message"].Position
-- end
-- end
-- end
-- end
-- end ]]
-- end
-- end
-- Handles the rendering of the text objects in their appropriate places
@ -1119,10 +1155,10 @@ function Chat:ComputeSpaceString(pLabel)
end
while self.TempSpaceLabel.TextBounds.X < pLabel.TextBounds.X do
nString = nString .. " "
nString ..= " "
self.TempSpaceLabel.Text = nString
end
nString = nString .. " "
nString ..= " "
self.CachedSpaceStrings_List[pLabel.Text] = nString
self.TempSpaceLabel.Text = ""
return nString
@ -1194,10 +1230,10 @@ function Chat:CreateMessage(cPlayer, message)
-- If we ever hit the mark, which would be in every popular game btw
-- we wrap around and reuse the labels
if #self.MessageQueue > self.Configuration.HistoryLength then
--[[pLabel = self.MessageQueue[#self.MessageQueue]['Player']
mLabel = self.MessageQueue[#self.MessageQueue]['Message']
--[[pLabel = self.MessageQueue[#self.MessageQueue]["Player"]
mLabel = self.MessageQueue[#self.MessageQueue]["Message"]
pLabel.Text = pName .. ':'
pLabel.Text = `{pName}:`
pLabel.Name = pName
local pColor
@ -1213,17 +1249,17 @@ function Chat:CreateMessage(cPlayer, message)
nString = Chat:ComputeSpaceString(pLabel)
else
nString = self.CachedSpaceStrings_List[pName]
end
end
mLabel.Text = ""
mLabel.Name = pName .. " - message"
mLabel.Text = nString .. message;
mLabel.Name = `{pName} - message`
mLabel.Text = nString .. message
mLabel.Parent = nil
mLabel.Parent = self.RenderFrame
mLabel.Position = UDim2.new(0, 0, 1, 0);
pLabel.Position = UDim2.new(0, 0, 1, 0);]]
mLabel.Position = UDim2.new(0, 0, 1, 0)
pLabel.Position = UDim2.new(0, 0, 1, 0)]]
-- Reinserted at the beginning, ring buffer
self.MessageQueue[#self.MessageQueue] = nil
@ -1232,7 +1268,7 @@ function Chat:CreateMessage(cPlayer, message)
-- Haven't hit the mark yet, so keep creating
pLabel = Gui.Create "TextLabel" {
Name = pName,
Text = pName .. ":",
Text = `{pName}:`,
-- TextColor3 = pColor,
FontSize = Chat.Configuration.FontSize,
TextXAlignment = Enum.TextXAlignment.Left,
@ -1263,7 +1299,7 @@ function Chat:CreateMessage(cPlayer, message)
end
mLabel = Gui.Create "TextLabel" {
Name = pName .. " - message",
Name = `{pName} - message`,
-- Max is 3 lines
Size = UDim2.new(1, 0, 0.5, 0),
TextColor3 = Chat.Configuration.MessageColor,

View File

@ -52,15 +52,11 @@ function onDied(victim, humanoid)
local victorId = 0
if killer then
victorId = killer.userId
print("STAT: kill by " .. victorId .. " of " .. victim.userId)
game:HttpGet(
url .. "/Game/Knockouts.ashx?UserID=" .. victorId .. "&" .. access
)
print(`STAT: kill by {victorId} of {victim.userId}`)
game:HttpGet(`{url}/Game/Knockouts.ashx?UserID={victorId}&{access}`)
end
print("STAT: death of " .. victim.userId .. " by " .. victorId)
game:HttpGet(
url .. "/Game/Wipeouts.ashx?UserID=" .. victim.userId .. "&" .. access
)
print(`STAT: death of {victim.userId} by {victorId}`)
game:HttpGet(`{url}/Game/Wipeouts.ashx?UserID={victim.userId}&{access}`)
end
-----------------------------------END UTILITY FUNCTIONS -------------------------
@ -104,75 +100,61 @@ local ns = game:GetService "NetworkServer"
if url ~= nil then
pcall(function()
game:GetService("Players"):SetAbuseReportUrl(
url .. "/Report/Games.ashx"
)
game:GetService("Players"):SetAbuseReportUrl(`{url}/Report/Games.ashx`)
end)
pcall(function()
game:GetService("ScriptInformationProvider")
:SetAssetUrl(url .. "/Asset/")
game:GetService("ScriptInformationProvider"):SetAssetUrl(`{url}/Asset/`)
end)
pcall(function()
game:GetService("ContentProvider"):SetBaseUrl(url .. "/")
game:GetService("ContentProvider"):SetBaseUrl(`{url}/`)
end)
-- pcall(function() game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end)
-- pcall(function()
-- game:GetService("Players"):SetChatFilterUrl(
-- `{url}/Game/ChatFilter.ashx`
-- )
-- end)
-- BadgeService:SetPlaceId(placeId)
if access ~= nil then
BadgeService:SetAwardBadgeUrl(
url
.. "/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d&"
.. access
`{url}/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d&{access}`
)
BadgeService:SetHasBadgeUrl(
url .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d&" .. access
`{url}/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d&{access}`
)
BadgeService:SetIsBadgeDisabledUrl(
url
.. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d&"
.. access
`{url}/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d&{access}`
)
FriendService:SetMakeFriendUrl(
servicesUrl
.. "/Friend/CreateFriend?firstUserId=%d&secondUserId=%d&"
.. access
`{servicesUrl}/Friend/CreateFriend?firstUserId=%d&secondUserId=%d&{access}`
)
FriendService:SetBreakFriendUrl(
servicesUrl
.. "/Friend/BreakFriend?firstUserId=%d&secondUserId=%d&"
.. access
`{servicesUrl}/Friend/BreakFriend?firstUserId=%d&secondUserId=%d&{access}`
)
FriendService:SetGetFriendsUrl(
servicesUrl .. "/Friend/AreFriends?userId=%d&" .. access
`{servicesUrl}/Friend/AreFriends?userId={access}`
)
end
BadgeService:SetIsBadgeLegalUrl ""
InsertService
:SetBaseSetsUrl(
url .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base"
)
InsertService:SetUserSetsUrl(
url .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d"
InsertService:SetBaseSetsUrl(
`{url}/Game/Tools/InsertAsset.ashx?nsets=10&type=base`
)
InsertService
:SetCollectionUrl(url .. "/Game/Tools/InsertAsset.ashx?sid=%d")
InsertService:SetAssetUrl(url .. "/Asset/?id=%d")
InsertService
:SetAssetVersionUrl(url .. "/Asset/?assetversionid=%d")
InsertService:SetUserSetsUrl(
`{url}/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d`
)
InsertService:SetCollectionUrl(`{url}/Game/Tools/InsertAsset.ashx?sid=%d`)
InsertService:SetAssetUrl(`{url}/Asset/?id=%d`)
InsertService:SetAssetVersionUrl(`{url}/Asset/?assetversionid=%d`)
pcall(function()
loadfile(url .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)()
loadfile(`{url}/Game/LoadPlaceInfo.ashx?PlaceId={placeId}`)()
end)
pcall(function()
if access then
loadfile(
url
.. "/Game/PlaceSpecificScript.ashx?PlaceId="
.. placeId
.. "&"
.. access
`{url}/Game/PlaceSpecificScript.ashx?PlaceId={placeId}&{access}`
)()
end
end)
@ -213,42 +195,24 @@ if placeId ~= nil and killID ~= nil and deathID ~= nil and url ~= nil then
end
game:GetService("Players").PlayerAdded:connect(function(player)
print("Player " .. player.userId .. " added")
print(`Player {player.userId} added`)
if url and access and placeId and player and player.userId then
game:HttpGet(
url
.. "/Game/ClientPresence.ashx?action=connect&"
.. access
.. "&PlaceID="
.. placeId
.. "&UserID="
.. player.userId
`{url}/Game/ClientPresence.ashx?action=connect&{access}&PlaceID={placeId}&UserID={player.userId}`
)
game:HttpGet(
url
.. "/Game/PlaceVisit.ashx?UserID="
.. player.userId
.. "&AssociatedPlaceID="
.. placeId
.. "&"
.. access
`{url}/Game/PlaceVisit.ashx?UserID={player.userId}&AssociatedPlaceID={placeId}&{access}`
)
end
end)
game:GetService("Players").PlayerRemoving:connect(function(player)
print("Player " .. player.userId .. " leaving")
print(`Player {player.userId} leaving`)
if url and access and placeId and player and player.userId then
game:HttpGet(
url
.. "/Game/ClientPresence.ashx?action=disconnect&"
.. access
.. "&PlaceID="
.. placeId
.. "&UserID="
.. player.userId
`{url}/Game/ClientPresence.ashx?action=disconnect&{access}&PlaceID={placeId}&UserID={player.userId}`
)
end
end)
@ -258,7 +222,7 @@ if placeId ~= nil and url ~= nil then
wait()
-- load the game
game:Load(url .. "/asset/?id=" .. placeId)
game:Load(`{url}/asset/?id={placeId}`)
end
if _MAP_LOCATION_EXISTS then
@ -279,18 +243,16 @@ if timeout then
end
ScriptContext.ScriptsDisabled = false
--delay(1, function()
-- loadfile(url .. "/analytics/GamePerfMonitor.ashx")(game.JobId, placeId)
--end)
-- delay(1, function()
-- loadfile(`{url}/analytics/GamePerfMonitor.ashx`)(game.JobId, placeId)
-- end)
-- yimy stuff
local reset = ";mc"
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg == reset then
if player.Character then
player.Character.Humanoid.Health = 0
end
if msg == reset and player.Character then
player.Character.Humanoid.Health = 0
end
end)
end)

View File

@ -193,10 +193,10 @@ function onConnectionAccepted(_, replicator)
end
-- called when the client connection fails
function onConnectionFailed(_, error)
function onConnectionFailed(_, err)
showErrorWindow(
"Failed to connect to the Game. (ID=" .. error .. ")",
"ID" .. error,
`Failed to connect to the Game. (ID={err})`,
`ID{err}`,
"Other"
)
end
@ -212,12 +212,12 @@ function onConnectionRejected()
end
local idled = false
function onPlayerIdled(time)
if time > 20 * 60 then
function onPlayerIdled(idleTime)
if idleTime > 20 * 60 then
showErrorWindow(
string.format(
"You were disconnected for being idle %d minutes",
time / 60
idleTime / 60
),
"Idle",
"Idle"

View File

@ -14,36 +14,23 @@ local ScriptContext = game:GetService "ScriptContext"
pcall(function()
ContentProvider:SetBaseUrl(baseUrl)
InsertService:SetAssetUrl(baseUrl .. "/asset?id=%d")
InsertService:SetAssetVersionUrl(baseUrl .. "/asset?assetversionid=%d")
InsertService:SetAssetUrl(`{baseUrl}/asset?id=%d`)
InsertService:SetAssetVersionUrl(`{baseUrl}/asset?assetversionid=%d`)
end)
HttpService.HttpEnabled = true
ScriptContext.ScriptsDisabled = true
print(
"["
.. game.JobId
.. "] Starting new render for "
.. renderType
.. " ID "
.. assetId
)
print(`[{game.JobId}] Starting new render for {renderType} ID {assetId}`)
game:HttpPost(
baseUrl
.. "/api/render/update?apiKey="
.. thumbnailKey
.. "&amp;taskID="
.. game.JobId,
`{baseUrl}/api/render/update?apiKey={thumbnailKey}&amp;taskID={game.JobId}`,
"Rendering",
true,
"text/json"
)
local player = game:GetService("Players"):CreateLocalPlayer(0)
player.CharacterAppearance = baseUrl
.. "/asset/characterfetch?userID="
.. assetId
player.CharacterAppearance = `{baseUrl}/asset/characterfetch?userID={assetId}`
player:LoadCharacter(false)
-- Raise up the character's arm if they have gear.
@ -55,7 +42,7 @@ end
local clickBody = ThumbnailGenerator:Click("PNG", 2048, 2048, true)
print("[" .. game.JobId .. "] Rendered bodyshot")
print(`[{game.JobId}] Rendered bodyshot`)
player.Character.Torso["Right Shoulder"].CurrentAngle = 0
@ -76,44 +63,25 @@ workspace.CurrentCamera = Camera
local clickHead = ThumbnailGenerator:Click("PNG", 300, 300, true)
local result = "Completed\n"
.. tostring(clickBody)
.. "\n"
.. tostring(clickHead)
local result = `Completed\n{clickBody}\n{clickHead}`
print("[" .. game.JobId .. "] Rendered headshot")
print(`[{game.JobId}] Rendered headshot`)
for i = 1, 3 do
local ok, err = pcall(function()
game:HttpPost(
baseUrl
.. "/api/render/update?apiKey="
.. thumbnailKey
.. "&amp;taskID="
.. game.JobId,
`{baseUrl}/api/render/update?apiKey={thumbnailKey}&amp;taskID={game.JobId}`,
result,
true,
"text/json"
)
end)
if ok then
print("[" .. game.JobId .. "] Upload successful! Moving on...")
print(`[{game.JobId}] Upload successful! Moving on...`)
break
elseif i == 3 then
print(
"["
.. game.JobId
.. "] An error occurred! ("
.. err
.. "). Giving up..."
)
print(`[{game.JobId}] An error occurred! ({err}). Giving up...`)
break
end
print(
"["
.. game.JobId
.. "] An error occurred! ("
.. err
.. "). Uploading again..."
)
print(`[{game.JobId}] An error occurred! ({err}). Uploading again...`)
end

View File

@ -14,36 +14,23 @@ local ScriptContext = game:GetService "ScriptContext"
pcall(function()
ContentProvider:SetBaseUrl(baseUrl)
InsertService:SetAssetUrl(baseUrl .. "/asset?id=%d")
InsertService:SetAssetVersionUrl(baseUrl .. "/asset?assetversionid=%d")
InsertService:SetAssetUrl(`{baseUrl}/asset?id=%d`)
InsertService:SetAssetVersionUrl(`{baseUrl}/asset?assetversionid=%d`)
end)
HttpService.HttpEnabled = true
ScriptContext.ScriptsDisabled = true
print(
"["
.. game.JobId
.. "] Starting new render for "
.. renderType
.. " ID "
.. assetId
)
print(`[{game.JobId}] Starting new render for {renderType} ID {assetId}`)
game:HttpPost(
baseUrl
.. "/api/render/update?apiKey="
.. thumbnailKey
.. "&amp;taskID="
.. game.JobId,
`{baseUrl}/api/render/update?apiKey={thumbnailKey}&amp;taskID={game.JobId}`,
"Rendering",
true,
"text/json"
)
local player = game:GetService("Players"):CreateLocalPlayer(0)
player.CharacterAppearance = baseUrl
.. "/api/render/characterasset?id="
.. assetId
player.CharacterAppearance = `{baseUrl}/api/render/characterasset?id={assetId}`
player:LoadCharacter(false)
-- Raise up the character's arm if they have gear.
@ -56,39 +43,23 @@ end
local click = ThumbnailGenerator:Click("PNG", 2048, 2048, true)
local result = "Completed\n" .. tostring(click)
print("[" .. game.JobId .. "] Successfully rendered, moving on...")
print(`[{game.JobId}] Successfully rendered, moving on...`)
for i = 1, 3 do
local ok, err = pcall(function()
game:HttpPost(
baseUrl
.. "/api/render/update?apiKey="
.. thumbnailKey
.. "&amp;taskID="
.. game.JobId,
`{baseUrl}/api/render/update?apiKey={thumbnailKey}&amp;taskID={game.JobId}`,
result,
true,
"text/json"
)
end)
if ok then
print("[" .. game.JobId .. "] Upload successful! Moving on...")
print(`[{game.JobId}] Upload successful! Moving on...`)
break
elseif i == 3 then
print(
"["
.. game.JobId
.. "] An error occurred! ("
.. err
.. "). Giving up..."
)
print(`[{game.JobId}] An error occurred! ({err}). Giving up...`)
break
end
print(
"["
.. game.JobId
.. "] An error occurred! ("
.. err
.. "). Uploading again..."
)
print(`[{game.JobId}] An error occurred! ({err}). Uploading again...`)
end