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
 

Re: Color3()+Color3()?

Previous Thread :: Next Thread 
electricpretzel0 is not online. electricpretzel0
Joined: 30 Sep 2008
Total Posts: 1278
07 Oct 2015 09:12 PM
Can I obtain a simplified goal of adding two color3 values?

Color3.new(0,.5,0)+Color3.new(1,0,0)

So... I'm in no position to test it right now, but I was wondering if you can actually do this.
Report Abuse
TickerOfTime is not online. TickerOfTime
Joined: 02 Sep 2012
Total Posts: 2030
07 Oct 2015 09:13 PM
Never thought about it.
Report Abuse
FrontPocket is not online. FrontPocket
Joined: 27 Apr 2014
Total Posts: 278
07 Oct 2015 09:14 PM
Im not sure about that way,

But im positive you can add the individual values together.

Color1 = Color3.new(1,1,1)
Color2 = Color3.new(2,2,2)


Color3 = Color3.new(Color1.r+Color2.r,Color1.g+Color2.g,Color1.b+Color2.b)
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
07 Oct 2015 09:14 PM
I don't think so.

-The [Guy]
Report Abuse
electricpretzel0 is not online. electricpretzel0
Joined: 30 Sep 2008
Total Posts: 1278
07 Oct 2015 09:16 PM
Alright. I wish this Lua had some better features like C++
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Oct 2015 09:59 PM
'Alright. I wish this Lua had some better features like C++'
LFMAO you obviously don't know Lua enough, you can easily have this possible with metatables, you blame Roblox not Lua for this.
Report Abuse
electricpretzel0 is not online. electricpretzel0
Joined: 30 Sep 2008
Total Posts: 1278
08 Oct 2015 11:51 AM
'this Lua'

Sorry if you didn't notice that before. I realize ROBLOX has their own flavor.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Oct 2015 11:57 AM
You can still do it in rbx lua though, you do vec3+vec3 all the time.
It's just that roblox didn't feel like we need col3+col3
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
08 Oct 2015 12:20 PM
You can simply wrap the object.

local color3 = Color3
local Color3 = {}

Color3.new = function(...)
local c3 = color3.new(...)
local this = {}
--TODO: Make a proxy? meh..
this.Orig = c3
setmetatable(this, {
__index = this.Orig;
__newindex = function(a,b,c)
this.Orig[b] = c
end;
__add = function(a,b)
this.Orig[b] = Color3.new(this.Orig[b].R + b.R, this.Orig[b].G + b.G, this.Orig[b].B + b.G)
end
})
return this
end

May not work. I expect it not to because I half assly made it.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
08 Oct 2015 01:58 PM
Oh jeez don't simply wrap the object. You'd have to wrap all the other objects too.
If you want it 'native', there's support for it in Valkyrie's Design Library.

Otherwise, just add the individual values of the r,g,b together.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
08 Oct 2015 02:05 PM
function add(c1,c2)
local r,g,b = c1.r,c1.g,c1.b;
local r1,g1,b1 = c2.r,c2.g,c2.b;
return Color3.new(r+r1,g+g1,b+b1);
end
Report Abuse
GlacierGames is not online. GlacierGames
Joined: 22 Oct 2011
Total Posts: 1549
08 Oct 2015 02:10 PM
wow


[http://www.roblox.com/Naruto-Shippuuden-Sasuke-Theme-1-item?id=159498348]
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