ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 06:06 PM |
Is there a way to automatically break text when it reaches the end of a GUI? This is important because I was making a Shop GUI on my other computer which uses a TV screen for a monitor, and when I went to a computer with a small monitor the text was way off of the screen.
if TextLabel.Position ~= Frame.Position then TextLabel.Text = TextLabel.Text\n end
Something along the lines of that would work if I centered it, right? But of course, the second line would not work. |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 18 Aug 2012 06:19 PM |
string.sub(TextLabel.Text,1,n) -- As long as n is a variable. You can not divide a string by a number. |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 06:23 PM |
I thought \n breaks a line. Like this:
Line1\n\Line2
Or is that wrong? In my last thread that is what somebody else said. |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 06:44 PM |
| ANybody? How would I make it break in the text when it hits the end on the frame? |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 18 Aug 2012 06:47 PM |
Oh, you wanted a line break.
TextLabel.Text = TextLabel.Text.."\nBreak" TextLabel.TextWrapped = true |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 06:49 PM |
| Ok, thanks. Now how do I detect if the text is outside of the frame? |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 18 Aug 2012 06:51 PM |
Use scale.
if(TextLabel.Position.Y.Scale>=1 or TextLabel.Position.X.Scale>=1)then print("ESCAPEY!!!") end |
|
|
| Report Abuse |
|
|
LuaCookie
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 27 |
|
|
| 18 Aug 2012 06:57 PM |
First of all, 1Topcop's script wouldn't work because a TextLabel's size and position are unrelated to its text. Second, the TextWrapped property already makes a line break when it runs out of room. Just set it to true and you're done.
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 06:58 PM |
| On last thing, how do I tell which words are out of the frame? Like I use your if statement, then inside do TextLabel.Text = TextLabel.Text\nI don't know where to break :( |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 06:59 PM |
| Oops, late post... And why did you put ElectricBlaze's wiki profile in your post? |
|
|
| Report Abuse |
|
|
LuaCookie
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 27 |
|
|
| 18 Aug 2012 07:03 PM |
Who's ElectricBlaze?
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 07:03 PM |
| Eh, I turned TextWrapped on and it still goes off the screen. |
|
|
| Report Abuse |
|
|
LuaCookie
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 27 |
|
|
| 18 Aug 2012 07:05 PM |
By off-screen do you mean outside of the TextLabel or outside of the the actual monitor?
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 07:06 PM |
| Outside of the frame and monitor. |
|
|
| Report Abuse |
|
|
LuaCookie
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 27 |
|
|
| 18 Aug 2012 07:06 PM |
Can you show me it?
http://wiki.roblox.com/index.php/User:ElectricBlaze |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 18 Aug 2012 07:08 PM |
Go to my place:
http://www.roblox.com/RPG-place?id=90133396 |
|
|
| Report Abuse |
|
|