|
| 03 Apr 2013 05:56 PM |
| Does anyone have a plugin or script that quickly gathers all the vectors and position of the bricks in a certain model and puts it in a neat notepad or file? |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:14 PM |
Hehe run in command bar and copy them from the output.
local Model = Workspace.Thing
local Banana = print() local Vec = {}; for_,n in next,Model:GetChildren() do if n:IsA("Part") then table.insert(Vec,n.Name.." "..v.Position) end end for _,n in next,Vec do print(n) end |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Apr 2013 06:27 PM |
| Um kind of confused which parts do I edit? |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:28 PM |
16:28:52.131 - Error in script: '=' expected near 'in' |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:33 PM |
Thats odd...Delete the banana line...it is not needed.
Hmm whats the problem |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:33 PM |
| All you have to change is the variable Model |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:34 PM |
local Banana = print() local Vec = {} for_,n in pairs(game.Workspace:GetChildren()) do -- This will return any parts in workspace, if you are looking for parts in a model, use game.Workspace.ModelName instead-- if n:IsA("Part") then table.insert(Vec,n.Name.." "..v.Position) end end for _,n in next,Vec do print(n) end |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:34 PM |
Ahaha i forgot a space in it.
local Model = Workspace.Thing
local Vec = {}; for _,n in next,Model:GetChildren() do if n:IsA("Part") then table.insert(Vec,n.Name.." "..v.Position) end end for _,n in next,Vec do print(n) end |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:35 PM |
| dog all you did is steel my script and change one line...not fixing the error. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:36 PM |
| and using pairs is not different than using next. They perform the same thing just different functions. Actually pairs uses next as its iterator. So technically using next is more efficient :P |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:37 PM |
Output 16:36:29.547 - local Model = Workspace.Model
local Vec = {}; for _,n in:8: attempt to index global 'v' (a nil value) 16:36:29.548 - Script "local Model = Workspace.Model
local Vec = {}; for _,n in", Line 8 16:36:29.548 - stack end |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:38 PM |
Sorry another stupid mistake.
local Model = Workspace.Thing
local Vec = {}; for _,n in next,Model:GetChildren() do if n:IsA("Part") then table.insert(Vec,n.Name.." "..n.Position) end end for _,n in next,Vec do print(n) end |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:42 PM |
| I don't think I 'stole' your script. I tried to make it easier to understand. And my preferred way is using pairs. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:43 PM |
16:43:38.916 - local Model = Workspace.Model
local Vec = {}; for _,n in :7: attempt to concatenate field 'Position' (a userdata value) 16:43:38.917 - Script "local Model = Workspace.Model
local Vec = {}; for _,n in ", Line 7 16:43:38.917 - stack end |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Apr 2013 06:48 PM |
| Also, line 8 is erroring because you can't turn a Vector3 value into a string value. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:50 PM |
That is not the problem. The problem is that i am trying to concentrate a Vector3 value not a string.
local Model = Workspace
local Vec = {}; local Format = "%s %d,%d,%d" for _,n in next,Model:GetChildren() do if n:IsA("Part") then table.insert(Vec,Format:format(n.Name,n.Position.X,n.Position.Y,n.Position.Z)) end end for _,n in next,Vec do print(n) end |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:50 PM |
Fixed it. This script will find any parts in workspace. local Model = Workspace
local Vec = {}; for _,n in next,Model:GetChildren() do if n:IsA("Part") then table.insert(Vec,n.Name.."is at ("..n.Position.X.. ", " ..n.Position.Y.. ", " ..n.Position.Z..")") end end for _,n in next,Vec do print(n) end
|
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:50 PM |
| dog why is it that you have been around since 2008 and i know more scripting than you? |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:51 PM |
| ^^ Oops, didn't refresh page. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:51 PM |
| I just fixed it...Sigh...and usuing :IsA("BasePart") is NOT needed. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:52 PM |
| Well, I've only started scripting in january. Also, I haven't really looked into string manipulation. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:53 PM |
Alrighty, this thread is done. I posted my script after yours because I hadn't refreshed the page, so your reply wasn't there when I posted mine. You know more than me because you've been scripting longer. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2013 06:53 PM |
I love string matching/patterns and manipulation :D
local msg = "#BOO This shall not print!!!" print(msg:match("^#.-%w) |
|
|
| Report Abuse |
|
|