|
| 19 Jun 2012 01:08 PM |
How could I make a function that: function returnPos(num) return ... end
returnPos(2 or 1) -- Both returns 0.1 returnPos(3 or 4) return 0.2 Cannot work out the formula :P -[ RS ]- |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 19 Jun 2012 01:10 PM |
| What's the point of the formula you're trying to work with? |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2012 01:14 PM |
So if i have table randomhellos = {"Hello","Hi","hio"} It is suppost to create 3 buttons, Size of 0.5 for X Each row hold 2. So it should create the gui buttons like: Hello Hi hio
-[ RS ]-
|
|
|
| Report Abuse |
|
|
| |
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 19 Jun 2012 01:25 PM |
| So you want to return the positions of those buttons? |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2012 01:27 PM |
Return the position the buttons NEED to be in :P
-[ RS ]- |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 19 Jun 2012 01:28 PM |
| So you give the sizes and it's supposed to give the positions? |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2012 01:30 PM |
No, the sizes doesnt matter. I just need the formula for the function So if 1 or 2 were put in you would get 0.1 So if 3 or 4 were put in you would get 0.2 So if 5 or 6 were put in you would get 0.3 So if 7 or 8 were put in you would get 0.4 -[ RS ]- |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2012 01:32 PM |
function returnPos(num) -- 2 or 1 should be 0.1 numo = num % 2 if numo == 0 then num = num + 1 end print(num/2/10) return num/2/10 end
That works but it does this: Hello Hi hio
-[ RS ]- |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2012 01:37 PM |
| Oh, I know what you're talking about! I did this before, it wasn't hard. |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 19 Jun 2012 01:39 PM |
| I really don't get the point then sorry. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2012 02:04 PM |
I think he's trying to do this(example):
for i,v in pairs(game.Players:GetChildren()) do t = Instance.new("TextLabel",script.Parent) t.Name = "PlrName" t.Text = v.Name end
|
|
|
| Report Abuse |
|
|
|
| 19 Jun 2012 03:00 PM |
*facecliff* I have a table of names: names = {"John","Kate","Bob"}
I have a GUI: Each label has a name in and is 0.5 x 0.08 Each row holds 2 labels.
For John his label should be in the position: 0,0,0,0 For Kate her label should be in the position: 0.5,0,0,0 For Bob his label should be in position( new row ) 0,0,0,0.1
I need a function that returns the position of the Gui. So the function would be: function returnPosition(posInTable) Formula return output end
|
|
|
| Report Abuse |
|
|
|
| 19 Jun 2012 03:31 PM |
| Add it manually, and there's no formula for it. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2012 01:14 AM |
| I really don't feel like 120 buttons. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 20 Jun 2012 01:18 AM |
| What I can tell you now is, that you will need UDim2 but if you can give them THAT order, I'm not sure about. I know that you can put them all in a row down, but not in that order, you want it to be. |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2012 01:19 AM |
| I don't need them in order. I just need the position. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 20 Jun 2012 01:21 AM |
It is in an order (actualy):
Label1 Label3 ... Label2 Label4 ...
Like that? |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2012 01:38 AM |
Label1 Label2 Label3 Label4 |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
| |
|
|
| 20 Jun 2012 01:43 AM |
But if you do the one you said I could use that one if you can do the formula
|
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 20 Jun 2012 01:48 AM |
I thought of maybe defining it in a for loop so it would look something like this:
table = {"Hi", "Hello", "HIO"}
i = 1 => Hi i = 2 => Hello i = 3 => HIO
So you can check if it's even or odd. And how you would do this is like that:
if i % 2 == 0 then --positioning frame here end
This is to define, if the word is in the right or left column. I'm trying to figure out how to put them under eachother without a gap now.
More infos about even and odd: http://wiki.roblox.com/index.php/Odd |
|
|
| Report Abuse |
|
|
| |
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 20 Jun 2012 10:23 AM |
>Each label has a name in and is 0.5 x 0.08 Each row holds 2 labels.
For John his label should be in the position: 0,0,0,0 For Kate her label should be in the position: 0.5,0,0,0 For Bob his label should be in position( new row ) 0,0,0,0.1
Shouldn't Bob be at 0,0,0,0.08? |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2012 10:27 AM |
| Yes but I want a gap inbetween them :P |
|
|
| Report Abuse |
|
|