generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: This. would. be. so. cool!

Previous Thread :: Next Thread 
thelastbunny is not online. thelastbunny
Joined: 07 Aug 2009
Total Posts: 2879
04 Aug 2011 09:09 PM
If there was a script that could export a GUI to it's Instance.new() data.

Example:

>Default Frame
>>Default Frame

-----------------------------

gui={}
gui[1]=Instance.new("Frame")
gui[1].Name="Frame"
gui[2]=Instance.new("Frame",gui[1])
gui[2].Name="Frame"

Accept with ALL the properties.


⅟½⅓¾⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
04 Aug 2011 09:15 PM
I forgot what it was called, starts with an a or something and code igniter loves them aparently.


function doit(obj,ary)
local a=Instance.new(obj);
for i,v in pairs(ary) do
if pcall(function() return obj[i]; end) then
obj[i]=v;
end end
return a;
end

gui={};
gui['Parent']=game.StarterGui.ScreenGui;
gui['Name']="Frame";
gui['Size']=UDim2.new(0.2,0,0.2,0);

doit("Frame",gui);
Report Abuse
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
04 Aug 2011 09:26 PM
I always keep one of these handy so that I can 'instance' all the gui data when the script runs, and that way it's harder for people to mess with the gui and end up breaking the tool.
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
04 Aug 2011 09:29 PM
I always code it all manually. It gives you a better organization and you can name your variables yourself, meaning you can use them later in your script to manipulate them. I really prefer coding it all manually.
Report Abuse
Snej1 is online. Snej1
Joined: 25 Jun 2008
Total Posts: 809
05 Aug 2011 04:21 AM
I've made one
Report Abuse
Snej1 is online. Snej1
Joined: 25 Jun 2008
Total Posts: 809
05 Aug 2011 04:25 AM
@JulienDethurens

I did that before but then I had a complex gui and I didn't wan't to save the gui, just the script, so I made that script. But is it possible to get all properties of an object without having to write a long table with properties for every object? Because that's what I did and I only did it for all GUI objects.
Report Abuse
Snej1 is online. Snej1
Joined: 25 Jun 2008
Total Posts: 809
05 Aug 2011 04:36 AM
Do you want it btw? I made it awhile ago so I think it's possible to make it shorter and more efficent.

--settings
gui=game.StarterGui.BuildPanel
--variables
screengui={}
screengui[1]="Name"
screengui[2]="archivable"
frame={}
frame[1]="Name"
frame[2]="Active"
frame[3]="BackgroundColor3"
frame[4]="BackgroundTransparency"
frame[5]="BorderColor3"
frame[6]="BorderSizePixel"
frame[7]="Draggable"
frame[8]="Position"
frame[9]="Size"
frame[10]="SizeConstraint"
frame[11]="Style"
frame[12]="Visible"
frame[13]="ZIndex"
frame[14]="archivable"
imagebutton={}
imagebutton[1]="Name"
imagebutton[2]="Active"
imagebutton[3]="AutoButtonColor"
imagebutton[4]="BackgroundColor3"
imagebutton[5]="BackgroundTransparency"
imagebutton[6]="BorderColor3"
imagebutton[7]="BorderSizePixel"
imagebutton[8]="Draggable"
imagebutton[9]="Image"
imagebutton[10]="Position"
imagebutton[11]="Selected"
imagebutton[12]="Size"
imagebutton[13]="SizeConstraint"
imagebutton[14]="Style"
imagebutton[15]="Visible"
imagebutton[16]="ZIndex"
imagebutton[17]="archivable"
imagelabel={}
imagelabel[1]="Name"
imagelabel[2]="Active"
imagelabel[3]="BackgroundColor3"
imagelabel[4]="BackgroundTransparency"
imagelabel[5]="BorderColor3"
imagelabel[6]="BorderSizePixel"
imagelabel[7]="Draggable"
imagelabel[8]="Image"
imagelabel[9]="Position"
imagelabel[10]="Size"
imagelabel[11]="SizeConstraint"
imagelabel[12]="Visible"
imagelabel[13]="ZIndex"
imagelabel[14]="archivable"
textbox={}
textbox[1]="Name"
textbox[2]="Active"
textbox[3]="BackgroundColor3"
textbox[4]="BackgroundTransparency"
textbox[5]="BorderColor3"
textbox[6]="BorderSizePixel"
textbox[7]="ClearTextOnFocus"
textbox[8]="Draggable"
textbox[9]="Font"
textbox[10]="FontSize"
textbox[11]="MultiLine"
textbox[12]="Position"
textbox[13]="Size"
textbox[14]="SizeConstraint"
textbox[15]="Text"
textbox[16]="TextColor3"
textbox[17]="TextTransparency"
textbox[18]="TextWrap"
textbox[19]="TextXAlignment"
textbox[20]="TextYAlignment"
textbox[21]="Visible"
textbox[22]="ZIndex"
textbox[23]="archivable"
textbutton={}
textbutton[1]="Name"
textbutton[2]="Active"
textbutton[3]="AutoButtonColor"
textbutton[4]="BackgroundColor3"
textbutton[5]="BackgroundTransparency"
textbutton[6]="BorderColor3"
textbutton[7]="BorderSizePixel"
textbutton[8]="Draggable"
textbutton[9]="Font"
textbutton[10]="FontSize"
textbutton[11]="Position"
textbutton[12]="Selected"
textbutton[13]="Size"
textbutton[14]="SizeConstraint"
textbutton[15]="Style"
textbutton[16]="Text"
textbutton[17]="TextColor3"
textbutton[18]="TextTransparency"
textbutton[19]="TextWrap"
textbutton[20]="TextXAlignment"
textbutton[21]="TextYAlignment"
textbutton[22]="Visible"
textbutton[23]="ZIndex"
textbutton[24]="archivable"
textlabel={}
textlabel[1]="Name"
textlabel[2]="Active"
textlabel[3]="BackgroundColor3"
textlabel[4]="BackgroundTransparency"
textlabel[5]="BorderColor3"
textlabel[6]="BorderSizePixel"
textlabel[7]="Draggable"
textlabel[8]="Font"
textlabel[9]="FontSize"
textlabel[10]="Position"
textlabel[11]="Size"
textlabel[12]="SizeConstraint"
textlabel[13]="Text"
textlabel[14]="TextColor3"
textlabel[15]="TextTransparency"
textlabel[16]="TextWrap"
textlabel[17]="TextXAlignment"
textlabel[18]="TextYAlignment"
textlabel[19]="Visible"
textlabel[20]="ZIndex"
textlabel[21]="archivable"
guis={}
guis["ScreenGui"]=screengui
guis["Frame"]=frame
guis["ImageButton"]=imagebutton
guis["ImageLabel"]=imagelabel
guis["TextBox"]=textbox
guis["TextButton"]=textbutton
guis["TextLabel"]=textlabel
--script
function getAllChildrens(object)
local obj={}
local obj2=object:getChildren()
for x=1,#obj2 do
table.insert(obj,obj2[x])
if#obj2[x]:getChildren()>0 then
local obj3=getAllChildrens(obj2[x])
for y=1,#obj3 do
table.insert(obj,obj3[y])
end end end return obj end
function zeroRem(cvalue)
local ret=tostring(cvalue)
if#ret>2 and string.sub(ret,1,1)=="0"then
ret=string.sub(ret,2)
end
return ret end
function getType(testobj,valuestring,testvalue)
local t=type(testvalue)
if t=="string"then
return string.char(34)..testvalue..string.char(34)
elseif t=="number"then
return zeroRem(testvalue)
elseif t=="boolean"then
return tostring(testvalue)
elseif t=="userdata"then
if testobj[valuestring]==UDim2.new(0,0,0,0)then
return "UDim2.new("..zeroRem(testvalue.X.Scale)..","..testvalue.X.Offset..","..zeroRem(testvalue.Y.Scale)..","..testvalue.Y.Offset..")"
elseif pcall(function()testobj[valuestring]=Color3.new(0,0,0)end)then
return "Color3.new("..zeroRem(testvalue.r)..","..zeroRem(testvalue.g)..","..zeroRem(testvalue.b)..")"
elseif#tostring(testobj[valuestring])>5 then
if string.sub(tostring(testobj[valuestring]),1,5)=="Enum."then
return tostring(testvalue)
end end end end
print"gui={}"
print("gui[1]=Instance.new"..string.char(34)..gui.className..string.char(34))
ex=Instance.new(gui.className)
if ex.Name~=gui.Name then
print("gui[1].Name="..string.char(34)..gui.Name..string.char(34))
ex:remove()
end
if gui.archivable==false then
print"gui[1].archivable=false"
end
gui2=getAllChildrens(gui)
for x=1,#gui2 do
print("gui["..x+1 .."]=Instance.new"..string.char(34)..gui2[x].className..string.char(34))
local ex=Instance.new(gui2[x].className)
if gui2[x]:IsA"ScreenGui"or gui2[x]:IsA"Frame"or gui2[x]:IsA"ImageButton"or gui2[x]:IsA"ImageLabel"or gui2[x]:IsA"TextBox"or gui2[x]:IsA"TextButton"or gui2[x]:IsA"TextLabel"then
for y=1,#guis[gui2[x].className]do
if ex[guis[gui2[x].className][y]]~=gui2[x][guis[gui2[x].className][y]]then
print("gui["..x+1 .."]."..guis[gui2[x].className][y].."="..getType(ex,guis[gui2[x].className][y],gui2[x][guis[gui2[x].className][y]]))
end end else
if gui2[x].Name~=ex.Name then
print("gui["..x+1 .."].Name="..string.char(34)..gui2[x].Name..string.char(34))
end
if gui2[x].archivable==false then
print("gui["..x+1 .."].archivable=false")
end end
ex:remove()
for y=1,#gui2 do
if gui2[y]==gui2[x].Parent then
found=y+1
end end
if found then
print("gui["..x+1 .."].Parent=gui["..found.."]")
found=nil
elseif gui2[x].Parent==gui then
print("gui["..x+1 .."].Parent=gui[1]")
end end
print"-- gui[1].Parent=..?"
Report Abuse
ModZuka is not online. ModZuka
Joined: 29 Jul 2011
Total Posts: 149
05 Aug 2011 04:39 AM
Not sure why you can't just design all your GUIs beforehand and clone them in when necessary. But okay, Scripters is known for extremely rump-suffering and more work than is needed.
Report Abuse
ModZuka is not online. ModZuka
Joined: 29 Jul 2011
Total Posts: 149
05 Aug 2011 04:39 AM
extreme*

derp no edit function, we're roblox and we love counterlogic
Report Abuse
Snej1 is online. Snej1
Joined: 25 Jun 2008
Total Posts: 809
05 Aug 2011 04:42 AM
I know that you could just make the GUI and save it somewhere but if you upload it as a model, it's easier if it's just a script right?
Report Abuse
ModZuka is not online. ModZuka
Joined: 29 Jul 2011
Total Posts: 149
05 Aug 2011 04:44 AM
Not really? This is why we can't have nice things.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image