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 » Scripting Helpers
Home Search
 

Re: ???

Previous Thread :: Next Thread 
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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 is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
19 Jun 2012 01:22 PM
Bump

-[ RS ]-
Report Abuse
su8 is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
19 Jun 2012 01:27 PM
Return the position the buttons NEED to be in :P

-[ RS ]-
Report Abuse
su8 is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
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 is not online. 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
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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
flappydavid is not online. flappydavid
Joined: 03 May 2009
Total Posts: 5893
19 Jun 2012 03:31 PM
Add it manually, and there's no formula for it.
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
20 Jun 2012 01:14 AM
I really don't feel like 120 buttons.
Report Abuse
Cheater is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
20 Jun 2012 01:19 AM
I don't need them in order. I just need the position.
Report Abuse
Cheater is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
20 Jun 2012 01:38 AM
Label1 Label2
Label3 Label4
Report Abuse
Cheater is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
20 Jun 2012 01:42 AM
Oh, right. ^^
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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 is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
20 Jun 2012 10:03 AM
Bump.
Report Abuse
su8 is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
20 Jun 2012 10:27 AM
Yes but I want a gap inbetween them :P
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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