oEl3V3No
|
  |
| Joined: 09 Apr 2014 |
| Total Posts: 14 |
|
|
| 18 Apr 2015 10:56 AM |
Hi Im .El3V3N.. Im 23, off of work, and having some fun learning coding. I recently played around with a html/css web template, and built unofficially with Roblox last year.
Im new to coding and I need an experienced Roblox coder to tell me what can be done and what cant be done. I dont know why .lua was picked but it seems to be a decent enough environment (solid game designers use it). Im intelligent enough to put together Roblox wiki stuff and search around for some .lua code stuff, but it seems Roblox is going for a closed look at times and locks some files. Im more 90's voxels than Roblox style when I see what can be done with this enviornemt. What Im trying to make is a 1000x50x1000 boys and girls club as you Robloxians call it. I might stick to something more like a real name.
Any tips, tricks, and work arounds you have on this list PLEASE COMMENT WITH THE NUMBER AND NAME OF THE QUESTION, or mail me. If you mail me I can send you some files in a week or so, or as soon as Im set up to give you a better grasp.
1. SCALE
First and foremost I need to change the character scale to match how I see this Roblox scale. I get that this is their kids game so the calculation ended up being, 1ft=1.2x=1stud (x being what ever their enviorment scale is). Its a nice enough technique for elementry school math but i expanded it a bit.
I made this calculation.
FtF(x)=((x*1.2)*2) This is the Foot equation. The *2 on the end helps with the fact that Roblox only allows .2's which makes .2 1 inch.
It assumes x/1=x/1.2
InF(x)=((x*.1)*2) This is the Inch equation
It assumes x/1=x/.1
Now that I got that banged out I want all my chars to be 5ft 10in, so using those equations i get... 14 which i think might be studs but Im not shure.
With that in place I can bang out this real scale map with Roblox voxels, so please if you know how to script the starter player file let me know in a post.
PS: I did find this post http://www.roblox.com/Forum/ShowPost.aspx?PostID=103478842 which says to me its more of a full work around and you cant just scale character parts like you can a block.
2. SEARCH CHILDREN
Last year when I looked through the code I found a 1 line script that made a list saying what exactly is in lighting. I found some problems with the rendering and wanted to change it up. That was too deep into something Roblox locked, which gets me to question 3 but Ill cover that there. Im looking up some other things right now, so maby I can get that script quicker by asking here. As far as I remember it was...
getChildren.Lighting.print.list
or something like that.
3. ROBLOX CODE
For now this is my last question. If im trying to build a detailed, fully coded, enclosed building with functions and guis all over the place, what kinda of problems are commonly run into when doing something on a very detailed scale. Once again tips, tricks and workarounds would be appreciated. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 11:11 AM |
"What Im trying to make is a 1000x50x1000 boys and girls club"
If you coding then this requires no coding to do and is hated on by the community for supporting online dating which is against the rules
If you are 23 you should start to get better grammar since typing like this for a resume would not get you in a job which is 100% typing with lots of commenting needed |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 18 Apr 2015 11:14 AM |
^
Was hoping someone else would say it. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 11:16 AM |
"getChildren.Lighting.print.list"
GetChildren() is a method and returns a table of the item's contents.
I'm not sure I understand your last question. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 11:18 AM |
| Your overcomplicating things WAAAY too much. |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 11:18 AM |
1 http://blog.roblox.com/2012/06/testing-the-accuracy-of-roblox-physics-with-potato-cannons/
Everything you need to know
I appreciate your attempt at humor |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 11:18 AM |
| You can scale parts individually, only you would have to adjust the Motor6D joints points. |
|
|
| Report Abuse |
|
|
oEl3V3No
|
  |
| Joined: 09 Apr 2014 |
| Total Posts: 14 |
|
|
| 18 Apr 2015 12:03 PM |
Thanks for the quick posts. Yes I know my grammer is not perfect... o well.
@LegendaryAccount: Im not an idiot. Od is lame. Rp is done wrong all the time. Whatever. Not the concept Im going for. Kids will be kids. When I say real name I mean Im not marketing it for "boys" and "girls".
@affectless:
I did use GetChildren(). If just using GetChildren() worked then I wouldnt be asking. The "getChildren.Lighting.print.list" was just some mis remembered concept that didnt work for me and I knew it wasnt right.
this is my Command Bar Log...
> GetChildren(Lighting) 12:51:07.835 - GetChildren(Lighting):1: attempt to call global 'GetChildren' (a nil value) 12:51:07.836 - Stack Begin 12:51:07.837 - Script 'GetChildren(Lighting)', Line 1 12:51:07.838 - Stack End
I remember using print in there some where.
Also I did think on the resize which is why I was asking for the GetChildren() printout script. That seems easy enough for now. Atleast then I can just build the static enviornment and then make it move later. The last plan in my whole concept is to make some blender characters with someone who really knows blender and see if Roblox will allow those in the game... its probably not going to be their policy though.
@jordanNin64: Its the point... And if I truly am to complex for this, ill build till it crashes. At that point ill probably just leave. I see this more for beginner coders not 8 year old kids.
@DeviousDeviation: Thanks! I did get the real physics. I plan on making a soccer game where theres a click ball of sorts, Im not completely done with the concept. With that I think I can just set vectors and let the enviornment do its thing.
|
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
| |
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 18 Apr 2015 12:13 PM |
GetChildren() is a method.
object:GetChildren() returns a table of all children inside the object
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 12:46 PM |
You can print the entirety of a table using unpack(), or you can return all first-tier descendants of an object with :GetChildren()
Seeing as GetChildren() returns the physical object, you can't print it. If I'm assuming you want to print the names of everything, you want this.
local list = {}
for _,v in pairs(game.Lighting:getChildren()) do -- starts "for" loop going through all of game.Lighting, variable = v
table.insert(list,v.Name) -- adds the object's name to list
end
print(unpack(list)) -- prints all the names in "list" |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2015 06:38 PM |
Personally, I like to do this:
local print_out;
for _,v in next, obj:GetChildren() do print_out = print_out.." "..tostring(v) end;
print(print_out) |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 18 Apr 2015 06:41 PM |
| I think you are really over-complicating this. |
|
|
| Report Abuse |
|
|
oEl3V3No
|
  |
| Joined: 09 Apr 2014 |
| Total Posts: 14 |
|
|
| 18 Apr 2015 10:29 PM |
Ty affectless. I kinda got it but I dont know how to get anyones code to work. This is what I remember from looking up some pieces...
local print_out;
for i,v in pairs, #game.Lighting.GetChildren() do tostring(v) end;
That might be close but I remember the print being on the end. Anyone know how to search the game parents for children that way?
|
|
|
| Report Abuse |
|
|
|
| 19 Apr 2015 08:38 AM |
I'll just quickly improve your code, OP.
local print_out;
for i,v in pairs, #game.Lighting.GetChildren() do tostring(v) end;
--
Alright, I'll just quickly run you through some errors.
1) print_out is not doing anything, I imagine it's there as a blank table. In this case, I recommend you replace it with;
local print_out = {}
Which creates a blank table with variable print_out.
2) # symbol is not needed in this case. In Rbx.Lua, at least, # is used to check for an amount of objects in a table. As far as I know, you can't do this on physical tree objects (ie. Game, Lighting, Workspace, etc.) but you can certainly do it with tables.
Example:
local table1 = {"hello","hello2","hello3"}
print(#table1)
Would return 3, as there are 3 objects in the table1 table.
3) Haven't used tostring() much, but calling it will likely error, seeing as you're trying to grab a string out of an object.
To get the name of an object, you do object.Name
ie. print(game.Lighting.Part.Name)
Returns "Part".
That being said, here's what you want here.
local print_table = {} -- Creates a blank table for you to put object names in.
for i,v in pairs(game.Lighting:getChildren()) do -- creates a loop, going through every first-tier object in Lighting.
table.insert(print_table, v.Name) -- Adds the name of the object currently being parsed into the "print_table" table we made before.
end -- Ends loop.
print(unpack(print_table)) -- Prints the table. The reason we use unpack is because in Lua, you can't print a table - it will return something like "table: 17018958". You want all the names of the objects not the table ID.
--
However, I'm glad you caught onto the # operator, as it is very helpful for table loops. There are two types of for loop, Generic and Numeric.
The Generic For loop is the one we just used - it is mainly used for physical objects or folders/models, to get every object within something.
Example: Could be used for renaming every object in a folder; like so:
Lighting -Part -Part2 -Part4 -Part3 -Part5 -something else
If you ran the code:
for _,v in pairs(game.Lighting:getChildren()) do v.Name="Thing" end
All the parts in Lighting would be renamed to "Thing".
The Numeric For loop is more common in, for example, JS - and runs a loop x amount of times.
Example:
for i=1,5 do print("this is a message that will appear 5 times") print(5-i.." left before I stop!") end
Would print the message 5 times then stop, as well as a counter down to when it will stop.
You can substitute 5 for a # operator - for example:
local table1 = {"hi","hi2","hi3","hi4"}
for i=1,#table1 do print("found an object!") end
Would print "found an object!" 4 times, as there are 4 items in the table.
tl;dr: Above code is wrong, use this:
local print_table = {} -- Creates a blank table for you to put object names in.
for i,v in pairs(game.Lighting:getChildren()) do -- creates a loop, going through every first-tier object in Lighting.
table.insert(print_table, v.Name) -- Adds the name of the object currently being parsed into the "print_table" table we made before.
end -- Ends loop.
print(unpack(print_table)) -- Prints the table. The reason we use unpack is because in Lua, you can't print a table - it will return something like "table: 17018958". You want all the names of the objects not the table ID.
|
|
|
| Report Abuse |
|
|
|
| 19 Apr 2015 10:12 PM |
@Dan: Technically # returns the last integral index of a table. You could have multiple integral indexes missing (or have none at all), use #, and get a false number of constituents.
tab = {[1]="1";[2]="2"[4]="4"]
print(#tab) --> 4
tab = {foo="bar"}
print(#tab) --> 0
Also, since GetChildren() returns a table with ordinal, integral indexes, # would be perfectly valid to use with it.
From my knowledge, you can call tostring() on just about any object considering its very function is to form a comprehensive string from whatever it is called on. Usually it defaults to the object's name, given it has one.
Anyway, I liked my code better. ;) |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2015 12:18 AM |
print(unpack(workspace:getChildren()))
|
|
|
| Report Abuse |
|
|
micke3212
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 3000 |
|
|
| 20 Apr 2015 04:00 AM |
Children = game:GetService("Lighting"):GetChildren
Theirs a table...
Let's use a for statement and simplify things (Forget code above) EndingStatment=nil for _,v in pairs(game:GetService("Lighting"):GetChildren()) do EndingStatment=EndingStatment.." "..v.Name end print(EndingStatment) |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2015 07:40 AM |
| When you print an object it prints its name. So stop with the loops, just print the unpacked table. |
|
|
| Report Abuse |
|
|
oEl3V3No
|
  |
| Joined: 09 Apr 2014 |
| Total Posts: 14 |
|
|
| 21 Apr 2015 03:30 PM |
Ok guys thanks for all your help in showing me your keyword concepts. Iv been using the wiki and google. Im here now, which only returns me with i pairs, which is simple enough for my first step.
for i,v in pairs(game.Lighting:getChildren()) do for i,v in ipairs(t) do print(i, v) end
This is supposed to be a one line script to search the game files from the studio command bar and spit them out in the output. Still not working... any ideas now? |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 21 Apr 2015 03:33 PM |
| You really aren't 23. If you are, you should probably start acting like one. |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 03:41 PM |
function getdescendants(p) local descendants = {} function recurse(k) for i,v in next,to_table(k) do rawset(descendants,i,v) if #to_table(v) then recurse(v) end end end recurse(p) return unpack(descendants)-- returns a list if you want a table do, return descendants end
print(getdescendants(p)) |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
| |
|
oEl3V3No
|
  |
| Joined: 09 Apr 2014 |
| Total Posts: 14 |
|
|
| 21 Apr 2015 04:42 PM |
Ok you people over complicate things too much. Can we consider question 2 closed and Ill properly read through the wiki later on and set it up myself. I have used something as simple as the last code I posted, I just forgot how to write it.
If you could please limit your responses to question 3.
What other tips, tricks, and workarounds should I know about?
I know its vague so ill give you this...
Code I will be writing...
Gui's C-Frame Demi Rendering Velocity Vectors Custom Char Menu Custom Keystrokes OnClick Animations Decals
Are there any problems with these things? |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 21 Apr 2015 04:53 PM |
| Yes if you put that in the script. Errors will flood the output. |
|
|
| Report Abuse |
|
|