Receive result from RCCService as base64 and save as png, other luau formatting fixes

This commit is contained in:
Lewin Kelly 2023-10-18 21:31:58 +01:00
parent ebce3c82c6
commit 3aae7fc2b7
3 changed files with 32 additions and 16 deletions

View File

@ -10258,6 +10258,10 @@ declare _CHAR_APPEARANCE: string
declare _PING_URL: string
declare _BASE_URL: string
declare _THUMBNAIL_KEY: string
declare _RENDER_TYPE: string
declare _ASSET_ID: number
declare _MAP_LOCATION_EXISTS: boolean
declare _MAP_LOCATION: any
declare _SERVER_PORT: number

View File

@ -1,14 +1,16 @@
-- Avatar v1.1.0
-- This is the thumbnail script for R6 avatars. Straight up and down, with the right arm out if they have a gear.
local baseUrl: string = _BASE_URL
local thumbnailKey: string = _THUMBNAIL_KEY
local renderType: string = _RENDER_TYPE
local assetId: number = _ASSET_ID
local baseUrl = _BASE_URL
local thumbnailKey = _THUMBNAIL_KEY
local renderType = _RENDER_TYPE
local assetId = _ASSET_ID
local ThumbnailGenerator = game:GetService "ThumbnailGenerator"
local ContentProvider = game:GetService "ContentProvider"
local InsertService = game:GetService "InsertService"
local HttpService = game:GetService "HttpService"
local ScriptContext = game:GetService "ScriptContext"
pcall(function()
ContentProvider:SetBaseUrl(baseUrl)
@ -16,8 +18,11 @@ pcall(function()
InsertService:SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%d")
end)
game:GetService("HttpService").HttpEnabled = true
game:GetService("ScriptContext").ScriptsDisabled = true
HttpService.HttpEnabled = true
ScriptContext.ScriptsDisabled = true
print(baseUrl, thumbnailKey, renderType, assetId)
print(
"["
.. game.JobId
@ -41,6 +46,8 @@ local player = game:GetService("Players"):CreateLocalPlayer(0)
player.CharacterAppearance = baseUrl
.. "/Asset/CharacterFetch.ashx?userID="
.. assetId
.. "&serverId=-1&t="
.. tick()
player:LoadCharacter(false)
-- Raise up the character's arm if they have gear.
@ -50,10 +57,10 @@ if gear then
player.Character.Torso["Right Shoulder"].CurrentAngle = math.rad(90)
end
local click = ThumbnailGenerator:Click("PNG", 1024, 1024, true)
local click = ThumbnailGenerator:Click("PNG", 420, 420, true)
local result = '{"Status": 2, "Click": "' .. tostring(click) .. '"}'
print result
print(result)
print("[" .. game.JobId .. "] Successfully rendered, moving on...")
while true do
@ -66,8 +73,7 @@ while true do
.. game.JobId,
result,
true,
"text/plain",
true
"text/plain"
)
end)
if not ok then

View File

@ -1,12 +1,16 @@
-- Avatar v1.1.0
-- This is the thumbnail script for R6 avatars. Straight up and down, with the right arm out if they have a gear.
local baseUrl: string, thumbnailKey: string, renderType: string, assetId: number =
...
local baseUrl = _BASE_URL
local thumbnailKey = _THUMBNAIL_KEY
local renderType = _RENDER_TYPE
local assetId = _ASSET_ID
local ThumbnailGenerator = game:GetService "ThumbnailGenerator"
local ContentProvider = game:GetService "ContentProvider"
local InsertService = game:GetService "InsertService"
local HttpService = game:GetService "HttpService"
local ScriptContext = game:GetService "ScriptContext"
pcall(function()
ContentProvider:SetBaseUrl(baseUrl)
@ -14,8 +18,10 @@ pcall(function()
InsertService:SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%d")
end)
game:GetService("HttpService").HttpEnabled = true
game:GetService("ScriptContext").ScriptsDisabled = true
HttpService.HttpEnabled = true
ScriptContext.ScriptsDisabled = true
print(baseUrl, thumbnailKey, renderType, assetId)
print(
"["
@ -50,10 +56,10 @@ if gear then
player.Character.Torso["Right Shoulder"].CurrentAngle = math.rad(90)
end
local click = ThumbnailGenerator:Click("PNG", 1024, 1024, true)
local click = ThumbnailGenerator:Click("PNG", 420, 420, true)
local result = '{"Status": 2, "Click": "' .. tostring(click) .. '"}'
print result
print(result)
print("[" .. game.JobId .. "] Successfully rendered, moving on...")
while true do