User:ArceusInator/Sandbox: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>ArceusInator
will finish later
>ArceusInator
will finish
Line 1: Line 1:
Something I don't want to forget...
Some useful functions...
 
<pre>
<pre>
local psky={}
function shared:RealType(v)
 
psky.Name="PlayerSky"
psky.className="PlayerSky"
psky.archivable=false
psky.Parent=nil
psky.LinkedPlayer=nil
psky.StarCount=3000
psky.CelestialBodiesShown=true
psky.SkyBoxBk=""
psky.SkyBoxDn=""
psky.SkyBoxFt=""
psky.SkyBoxLf=""
psky.SkyBoxRt=""
psky.SkyBoxUp=""
 
function psky:clone()
  local n=Instance.new("PlayerSky")
  -- copy all properties
  return n
end
 
funciton psky:FindFirstChild( name, recursive )
  return nil
end -- because an object's Parent can't be set to PlayerSky
 
funciton psky:GetChildren()
  return nil
end
 
function psky:GetFullName()
  return psky.Name
end
 
function psky:IsA( s )
  if s == "PlayerSky" or s == "Sky" or s == "CustomInstance" then return true end return
end
 
function psky:IsAncestorOf( instance )
  return
end
 
function psky:IsDescendantOf( instance )
  return
end
 
function psky:Remove()
  psky.LinkedPlayer = nil
end


-- now the metacode
  local libraries = {Axes, BrickColor, CFrame, Color3, Faces}


local ab=Instance.new("Part")
  if type(v) == "userdata" then
ab.Size=Vector3.new(1,1,1)
     
ab.CanCollide=false
      for _,i in pairs(libraries) do
ab.Anchored=true
        if v == i then
ab.Locked=true
             return string.lower(tostring(i))
ab.Position=Vector3.new()
ab.Name="PlayerSky_ANCHORBRICK"
 
local b=Instance.new("BillboardGui")
assert(coroutine.resume(coroutine.create(function()
  while true do
      if psky.LinkedPlayer then
        b.Parent=psky.LinkedPlayer.PlayerGui
        if psky.LinkedPlayer.Character.Torso then
             b.Adornee = psky.LinkedPlayer.Character.Torso
        else
            b.Adornee=ab
         end
         end
       end
       end
      wait()
  end
end)))


-- will finish this later...</pre>
      if pcall(function() i = v:IsA("Instance") end) then
        return "object"
      elseif pcall(function() x = v.X end) then
        if pcall(function() z = v.Z end) then
            if Axes.new(v.X, v.Y, v.Z) == v then
              return "axes"
            elseif pcall(function() comp = v:components() end) then
              return "coordinateframe"
            else
              return "vector3"
            end
        elseif Vector2.new(v.X, v.Y) == v then
            return "vector2"
        elseif pcall(function() xo =
        end
      elseif pcall(function() r = v.r end) then
        if BrickColor.new(v.r, v.g, v.b) == v then
            return "brickcolor"
        elseif Color3.new(v.r, v.g, v.b) == v then
            return "color3"
        end
      elseif pcall(function() top = v.Top) then
        if Faces.new(v.Back, v.Bottom, v.Front, v.Left, v.Right, v.Top) == v then
            return "faces"
        end
      elseif pcall(function() connect = v.connected end) then
        return "rbxscriptconnection"
      elseif pcall(function() conn = v:connect(function()end)end) then
        return "rbxscriptsignal"
      elseif pcall(function() origin = v.Origin end) then
        return "ray"
      elseif pcall(function() cf = v.CFrame end) then
        return "region3"

Revision as of 16:06, 30 March 2011

Some useful functions...

function shared:RealType(v)

   local libraries = {Axes, BrickColor, CFrame, Color3, Faces}

   if type(v) == "userdata" then
      
      for _,i in pairs(libraries) do
         if v == i then
            return string.lower(tostring(i))
         end
      end

      if pcall(function() i = v:IsA("Instance") end) then
         return "object"
      elseif pcall(function() x = v.X end) then
         if pcall(function() z = v.Z end) then
            if Axes.new(v.X, v.Y, v.Z) == v then
               return "axes"
            elseif pcall(function() comp = v:components() end) then
               return "coordinateframe"
            else
               return "vector3"
            end
         elseif Vector2.new(v.X, v.Y) == v then
            return "vector2"
         elseif pcall(function() xo = 
         end
      elseif pcall(function() r = v.r end) then
         if BrickColor.new(v.r, v.g, v.b) == v then
            return "brickcolor"
         elseif Color3.new(v.r, v.g, v.b) == v then
            return "color3"
         end
      elseif pcall(function() top = v.Top) then
         if Faces.new(v.Back, v.Bottom, v.Front, v.Left, v.Right, v.Top) == v then
            return "faces"
         end
      elseif pcall(function() connect = v.connected end) then
         return "rbxscriptconnection"
      elseif pcall(function() conn = v:connect(function()end)end) then
         return "rbxscriptsignal"
      elseif pcall(function() origin = v.Origin end) then
         return "ray"
      elseif pcall(function() cf = v.CFrame end) then
         return "region3"