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
 

[ Content Deleted ]

Previous Thread :: Next Thread 
BCGames is not online. BCGames
Joined: 30 Dec 2010
Total Posts: 8182
11 Feb 2012 11:25 PM
I like it, but would be awesome if it had a third parameter like so:

local hat = Instance.new("Hat", game.Workspace, "TestHat") --third is name of object

Report Abuse
Aaaboy97 is not online. Aaaboy97
Joined: 05 Apr 2009
Total Posts: 6612
11 Feb 2012 11:27 PM
   do
      local a = Instance.new
      Instance.new = function(b, c, d) local e = Instance.new(b, c) e.Name = d end
   end
Report Abuse
LastDreamer is not online. LastDreamer
Joined: 17 Nov 2010
Total Posts: 433
11 Feb 2012 11:29 PM
What Aaaboy said.

But it would still be a useful update.
Report Abuse
BCGames is not online. BCGames
Joined: 30 Dec 2010
Total Posts: 8182
11 Feb 2012 11:29 PM
Yes, but 1 < 4.
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
11 Feb 2012 11:33 PM
My "Create" function which looks like this:

local part = Create'Part'{
Name = 'Blah',
Parent = game.Workspace,
Anchored = true,
...
}

Is going to be in the next release, in the utility-library. You can use that for much the same syntax and more.
Report Abuse
BCGames is not online. BCGames
Joined: 30 Dec 2010
Total Posts: 8182
11 Feb 2012 11:35 PM
@Stravant

So it would work like this:

local stats = Create("IntValue"){Name = "leaderstats", Parent = player}

?
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
11 Feb 2012 11:37 PM
Yes, and you can even layer objects too:

Create'IntValue'{
Name = 'leaderstats',
Parent = player,
Create'IntValue'{ Name = 'Stat1', },
Create'IntValue'{ Name = 'Stat2', },
Create'IntValue'{ Name = 'Stat3', },
}

To build an object hierarchy without any intermediate variables.
Report Abuse
LastDreamer is not online. LastDreamer
Joined: 17 Nov 2010
Total Posts: 433
11 Feb 2012 11:41 PM
That's some pretty cool syntax, Stravant.

Your coding style is so strange, though.
Report Abuse
BCGames is not online. BCGames
Joined: 30 Dec 2010
Total Posts: 8182
11 Feb 2012 11:42 PM
In other words....


game.Players.PlayerAdded:connect(function(player)
    local stats = Create("IntValue"){Name = "leaderstats", Parent = player, Create("IntValue"){Name = "Points"}}
end)

Points leaderboard in three lines? Very nice.
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
11 Feb 2012 11:42 PM
[ Content Deleted ]
Report Abuse
BCGames is not online. BCGames
Joined: 30 Dec 2010
Total Posts: 8182
11 Feb 2012 11:43 PM
@Ox

*facepalm*
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
11 Feb 2012 11:45 PM
[ Content Deleted ]
Report Abuse
BCGames is not online. BCGames
Joined: 30 Dec 2010
Total Posts: 8182
11 Feb 2012 11:47 PM
Create ~= edit
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
11 Feb 2012 11:47 PM
"Create(game.Workspace.Part){}"

In my own code I have a function like this, I call it "Modify" though, since it doesn't make much sense for a "creation" function to not actually create anything.
Report Abuse
LocalChum is not online. LocalChum
Joined: 04 Mar 2011
Total Posts: 6906
11 Feb 2012 11:48 PM
@stravant

OMG. That's a function that I always add to code where I create lots of objects. I think I'll really like this utility library :D
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
11 Feb 2012 11:50 PM
[ Content Deleted ]
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
12 Feb 2012 12:17 AM
@stravant;

Cool. I made a create function that has similar syntax to yours. Its probably not as complex but I'm working on expanding it so I can use it in some of my other scripts. The syntax goes like:

local Brick = createObj.Create("Part"){
["Parent"] = Workspace,
["Name"] = "Brick",
["Size"] = Vector3.new(10, 10, 10),
["Position"] = Vector3.new(10, 10, 10);
--[[You can even set fake values into the part and create psuedo methods]]
["_changePos"] = function(self, vec) self.Position = vec end,
["_randomTab"] = {"Trololol", "Ohaider", "ok"}
};

Part:changePos(Vector3.new(10, 25, 10))


It has some other features but I plan on publishing it when I finish adding everything I want to it.
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
12 Feb 2012 12:20 AM
"Yes, and you can even layer objects too:

Create'IntValue'{
Name = 'leaderstats',
Parent = player,
Create'IntValue'{ Name = 'Stat1', },
Create'IntValue'{ Name = 'Stat2', },
Create'IntValue'{ Name = 'Stat3', },
}

To build an object hierarchy without any intermediate variables."

I never thought about it but I think I could also do something very similar to this with my code ._.
*Edits scripts*
Report Abuse
belial52 is not online. belial52
Joined: 10 Oct 2009
Total Posts: 8074
12 Feb 2012 01:03 AM
I personally like aaaboy's function that's like that...
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
12 Feb 2012 03:34 AM
> My "Create" function which looks like this ... Is going to be in the next release

Could you maybe add support for event handlers in there as well? Something like this would be nice:

    local part = Create 'Part' {
        Name = 'Blah',
        Parent = game.Workspace,
        Anchored = true,
        Touched = function(self, other)
            --This function is connected to the .Touched event
            --An extra argument of `self` is passed, since otherwise
            --we have no reference the part this is bound to
    
            self.BrickColor = other.BrickColor
        end
    }
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
12 Feb 2012 03:37 AM
I've added that to [my implementation](http://wiki.roblox.com/index.php/User:NXTBoy/Scripts/%22new%22_operator)
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
12 Feb 2012 01:49 PM
"Could you maybe add support for event handlers in there as well? Something like this would be nice:"

I can't do it in a nice way without either using pcall when assigning every single property, which is provibitively expensive, or mainting an up-to-date list of every single event name. And what if there's something which is an event in one object, type, and a property in another? Then I'd really be in trouble!

The only option is to use a less elegant syntax (Which the code that's going out already includes!):

Create'IntValue'{
Name = 'TestEvents',
[Create.E'Changed'] = function(val)

end,
}

And you can also make in-line arbitrary construction code too:

Create'IntValue'{
Name = 'TestCtors',
[Create] = function(self)
someGlobalVar = self
updateStuff()
end,
}
Report Abuse
booing is not online. booing
Joined: 04 May 2009
Total Posts: 6594
12 Feb 2012 04:27 PM
His style isn't strange, it's just classic C.

"It looks nice, but I sense a disturbing lack of Rainbow Dash and Fluttershy."
Report Abuse
ENET is not online. ENET
Joined: 01 Jan 2010
Total Posts: 4820
12 Feb 2012 04:29 PM
AAboy forgot a return...

do
local a = Instance.new
Instance.new = function(b, c, d) local e = a(b, c) e.Name = d
return e; end
end
Report Abuse
nightname is not online. nightname
Joined: 10 Jun 2008
Total Posts: 8960
12 Feb 2012 05:30 PM
This is how I would add a third parameter to Instance.new();

local instance = Instance.new
local Instance = {
new = function(obj, par, name)
obj = instance(obj, par)
obj.Name = name
return obj
end
}
Instance.new("Part", workspace, "Heee");

---------
I was supposed to post this well over 2 hours ago, but I forgot. Once I came back, I clicked post, but I found out I got logged off because I received a warning. So this post is well over 2 hours and a few minutes late.

Heh.
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