Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
| |
|
|
| 12 Oct 2011 07:02 PM |
You can change the max items for it.
Regards, ~Scarfacial |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
EMAN381
|
  |
| Joined: 27 Nov 2007 |
| Total Posts: 4300 |
|
|
| 12 Oct 2011 07:50 PM |
Is Debris even used today?
I don't use it and never did,
What is it's purpose anyway? |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2011 08:03 PM |
| yes. Its used for survive the disasters. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Oct 2011 08:31 PM |
"Is Debris even used today?"
Of course,
print("Hello World!") game.Debris:AddItem(nub,123) print("Hello World! PS. Nate890 is awesome")
that wouldn't wait 123 seconds before it printed "Hello World! PS. Nate890 is awesome" and 'nub' will be deleted in 123 seconds
print("Hello World!") wait(123) nub:remove() print("Hello World! PS. Nate890 is awesome")
that would wait 123 seconds to remove 'nub', like the the debris method, but it would also wait 123 seconds to execute the rest of the script, thus waiting 123 seconds to print "Hello World! PS. Nate890 is awesome"
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
EMAN381
|
  |
| Joined: 27 Nov 2007 |
| Total Posts: 4300 |
|
| |
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 12 Oct 2011 08:52 PM |
| function addItem(item,lifeTime)pcall(game.Debris.AddItem,game.Debris,lifeTime or 10,item)end |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Oct 2011 08:55 PM |
function addItem(item, lifeTime) pcall(delay, lifeTime or 10, function() item.Parent = nil end) end
--Code created by oysi, edited by nate890.
<'+1 Post. Ujelly?'>
|
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 12 Oct 2011 08:56 PM |
| dang dang dang dang dang reverse the number and item arguments in mine dang dang dang dang dang |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2011 08:59 PM |
My collector library, not debugged, but it gives an example:
-- Could've used tail calls to save stack space, decided not to. Tail calls require you to put 'return' everywhere. It increases efficiency, but also makes the code more ugly.
--[===[ Variables prefixes: nVar: new tVar: template cVar content of 'var' ]===]
local collector = newproxy(true) -- The collector library.
function import() getfenv(0).collector = collector end
function add(item, lifetime) -- Removes or disconnects an item after a certain ammount of time. -- The item can be an object or a connection. assert(tonumber(lifetime), "bad argument #2 to 'add' (number expected, got " .. type(lifetime) .. ")") -- I use 'tonumber(lifetime)' to know if the value provided can be converted to a number, but there is no need to convert it manually, that is done automatically. if pcall(function() item:GetChildren()) then -- If the item is an object, then... delay(lifetime, function() item:Remove() -- I hate how we can't give arguments to the delay function. end) elseif pcall(function() assert(item.connected == true) end) then -- Else, if the item is a connection, then... delay(lifetime, function() item:disconnect() end)) else error("bad argument #1 to 'add' (object or RBXScriptConnection expected, got" .. type(item) .. ")") end end
function create() -- Creates a collector that will collect everything you tell it to collect and that will destroy it all when you terminate tbe collector. -- It keeps a list of every item added to it. When you terminate the collector, every item of that list is removed/disconnected. local self = newproxy(true) local items = {} -- The list of all the items that were collected by the collector. getmetatable(self).__index = { terminate = function(self2) -- The self defined here is the same as the one defined up there. They just have different names so we can compare them and throw an error if they're not identical. assert(self == self2, "Expected ':' not '.' calling member function terminate") for _, item in pairs(items) do pcall(item.Remove, item) pcall(item.disconnect, item) end end; add = function(self2, item) assert(self == self2, "Expected ':' not '.' calling member function add") assert(pcall(function() item:GetChildren() end) or pcall(function() assert(item.connected == true) end), "bad argument #1 to 'add' (object or RBXScriptConnection expected, got " .. type(item) .. ")") table.insert(items, item) end; }
-- Since I'm a nice person, I allow both camelCase and PascalCase for my methods. =) local alias = getmetatable(self).__index alias.Terminate = alias.terminate alias.Add = alias.add end
getmetatable(collector).__index = { import = import; add = add; create = create; }
_G.collector = collector -- Export the library.
|
|
|
| Report Abuse |
|
|
|
| 12 Oct 2011 08:59 PM |
| To use in a script, just call _G.collector.import(), the content of the library will then be stored in the environment in a variable called 'collector'. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Oct 2011 09:12 PM |
"-- Since I'm a nice person, I allow both camelCase and PascalCase for my methods. =)"
WAIULEAVESTUPIDCOMMENTS?
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2011 09:17 PM |
@nate890
WAIUSAYSTUPIDTHINGSTHATMAKENOSENSE? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Oct 2011 09:19 PM |
WAIUNOREADWITHLOGICALTHINKING?
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
| |
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 12 Oct 2011 09:23 PM |
WAIUSUCHAHYPOKRIT
inb4combobreaker
~ I'm a unicorn ~ |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Oct 2011 09:23 PM |
"-- Since I'm a nice person, I allow both camelCase and PascalCase for my methods. =)"
DAT WAS USELESS.
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 12 Oct 2011 09:24 PM |
@Julien: WAIUEARLYTOAST!??!?!?!?
floodcheck x1
~ I'm a unicorn ~ |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 12 Oct 2011 09:26 PM |
"DAT WAS USELESS."
I r betr cuz my comments are only somewhat useless. (somewhat == 95% useless)
~ I'm a unicorn ~ |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2011 02:09 PM |
WAISOSERIOUS
Lets put a smile on that face.
--I cant wait for B:AC-- |
|
|
| Report Abuse |
|
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
| |
|