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: Splitting up uneven numbers in a fraction pattern

Previous Thread :: Next Thread 
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 02:48 AM
Sorry Im tired if that sounded funky.


So I have like a Worm object.

Like slither.io.

But I want half of it to be ... say blue. and the other half yellow.

Then there are lets say.... 8 circles that I need to color.

It would easily be 4 circles blue and 4 circles yellow.
But what if its an uneven number? How would I work that out?
And, what If I want to split it into 3 colors instead? Heres what I got.


local colors = {"Bright blue", "Bright yellow"}
local Num = #game.Workspace.TheCoderOfLuaEel:GetChildren()
local fractions = Num/#colors
for i = 1, #game.Workspace.TheCoderOfLuaEel:GetChildren(), fractions do
game.Workspace.TheCoderOfLuaEel:GetChildren()[i].BrickColor = BrickColor.new(colors[1])
end
for i = fractions, #game.Workspace.TheCoderOfLuaEel:GetChildren(), fractions*2 do
game.Workspace.TheCoderOfLuaEel:GetChildren()[i].BrickColor = BrickColor.new(colors[2])
end


Yeah so Thats rudimentary I know I could make improvements but what about rounding, how would I do that?

Thanks for help guys I know its late




Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
05 Jun 2016 02:50 AM
I'd totally help you but you're a brat who thumbs down my games for no reason, so have fun.


Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 02:50 AM
so 9/2 would be 5 and 3


and 11/4

would be

4, 4, 3


Remembe I want as many numbers as I can equal to eachother so its a true split
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 02:51 AM
DevVince Im sorry if you feel that way.
Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
05 Jun 2016 02:53 AM
Once again you're acting dumb.

You asked for help I joined to help test I left because you where afk and I couldn't move then you thumbs down all my games because I tried to help you.

So yes that's it there is no feel it's a fact.


Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 02:54 AM
im not dumb. You came to test, left after like 30 seconds and thumbs it down. I know you did.
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 03:01 AM
It needs some sort of trial and error algorithm i think
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 03:04 AM
And DevVince I know why you really arent helping. Its cause your ego is to high to say that you dont know how
Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
05 Jun 2016 03:07 AM
Sorry but you won't ever receive help form me again.
I joined your game to help you test it you where afk I played for a few minuets and left because I was stuck on a spawn and you where gone, then you assume I thumbs it down and thumbs down all my places.

And yes I did 15 about minuets ago because you tried to act like it never happened.


Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 03:10 AM
As I said, you dont know how to do this therefore I dont need your help.
Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
05 Jun 2016 03:12 AM
So arrogant it's starting to become funny how low of an IQ you have. xD

#It'sSoStupidIt'sFunny


Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 03:12 AM
Flux_Capacitor where are you!

just to clarify.

11/4

3,3,3,2



13/5


3,3,3,2,2


18/4

5,5,4,4
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 03:13 AM
I think its funny that you laugh at that sort of thing.
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 03:16 AM
i think I figured it out.
and DevVince I really dont want to fight with you.
I think we can both admit we thumbed eachothers places down.
And we can both undo it if we want.
Report Abuse
DarthStrantax is not online. DarthStrantax
Joined: 31 May 2011
Total Posts: 2610
05 Jun 2016 03:40 AM
every integre is devisable by 2,3,5,7 so you split it according to those
Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
05 Jun 2016 03:41 AM
Shh don't tell him about prime numbers..


Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 03:45 AM
I used a system like this:

13/5

math.floor(13/5+.5)
>3


3*5

or

3+3+3+3+3


then I found diffrence

15-13

and made a loop subtract 1 from each

:)
if there is faster way let me know
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
05 Jun 2016 04:13 AM
local colors = {"Bright blue", "Bright yellow"}
for i, v in ipairs(game.Workspace.TheCoderOfLuaEel:GetChildren()) do
v.BrickColor = BrickColor.new(colors[i%colors+1])
end
Report Abuse
AutoCarrot is not online. AutoCarrot
Joined: 24 Oct 2013
Total Posts: 5588
05 Jun 2016 04:25 AM
Why not

sets = {group1 = {},
group2 = {},
group3 = {}}

x = 1
for i,v in pairs(whatever)do
table.insert(sets[x], v)
x = x > 4 and x + 1 or 1
end






WolfgangVonPrinz // Private Drive - Residents Only
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
05 Jun 2016 04:27 AM
x = x <=#sets and x + 1 or 1

You hardcoded x>4 which won't work if OP changed the number of groups
Report Abuse
AutoCarrot is not online. AutoCarrot
Joined: 24 Oct 2013
Total Posts: 5588
05 Jun 2016 04:32 AM
Silly me. That was why I put them in a group of sets in the first place :P

Thanks for catching that though


WolfgangVonPrinz // Private Drive - Residents Only
Report Abuse
DarthStrantax is not online. DarthStrantax
Joined: 31 May 2011
Total Posts: 2610
05 Jun 2016 04:33 AM
"Shh don't tell him about prime numbers.."
????
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
05 Jun 2016 01:58 PM
Well are those systems better then mine
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
05 Jun 2016 02:01 PM
get remainder and make it color of first chain circle color

for example

9 circles, first one yellow
remainder of 1, 4 sets of yellow blue

so it would go y,b,y,b,y,b,y,b and the last one would yellow since it starts with yellow


Report Abuse
AutoCarrot is not online. AutoCarrot
Joined: 24 Oct 2013
Total Posts: 5588
05 Jun 2016 05:35 PM
My system is probably best cuz less hard coding


WolfgangVonPrinz // Private Drive - Residents Only
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