Simple Question

I have my derma menu etc

Now What code do i use when i want to have a random text in my dframe?

so if i want a big long text inside this frame : what do i do?


local DermaPanel = vgui.Create( "DFrame" )
		DermaPanel:SetPos( 50,50 )
		DermaPanel:SetSize( 400,500 )
		DermaPanel:SetTitle( "I want a big text in this frame" )
		DermaPanel:SetVisible ( true )
		DermaPanel:SetDraggable( true )
		DermaPanel:ShowCloseButton( true )
		DermaPanel:MakePopup()

You could try something like this.

[lua]function TextGenerator(length)
local chars = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”
local ret = “”
for i=1,length do
local n = math.random(1,string.len(chars))
ret = ret … string.sub(chars,n,n)
end
return ret
end[/lua]

That will return a random string of however long the length you want it to be. You could use a DLabel to display the text.

hmmm yes , but with the Dlabel.

Could u make me a example of a multi line text?

Just put
characters in the DLabel’s text, and make sure that it is sized in height to accommodate the extra vertical lines.

can you make me a example

This is newbie questions lol

Just because it’s the newbie questions section doesn’t mean you don’t have to use your brain.

“This is the Dlabel’s text.”

“This is
DLabel’s text with a new line after ‘is’ and before ‘DLabels’”

Did you look at the link Entoros so kindly gave you? If you did you would have seen this line in the example:

[lua]myLabel:SetText(“I Love Gmod”)[/lua]

The method SetText obviously sets the DLabel’s text. My statement:

“Just put
characters in the DLabel’s text”

was quite clear.

If you were confused about

“and make sure that it is sized in height to accommodate the extra vertical lines.”

then, doing DLabelName:SizeToContents() will take care of that for you, if you didn’t gather that by merely reading the name of the method, which is “SizeToContents”.

And to whatever retard rated me dumb and the question useful… you’re a retard.

Well , i did used the link they gave me.

But i’m dutch so it’s not that easy for me to understand all the englisch sentences in their correct way.

I tested the myLabel example , The problem was when i used the example there was this text “I love Gmod” in the left upper corner of my screen and I wasn’t able to “close the text” , It was not linked to my frame i posted in my first post .

And with the /N Character … I’m new to lua , so my question about it is , how i use it … So with the /n Character if you could make me a simple example would be sweet.

It’s not /n, it’s
.

If you put that anywhere in any text, it means do a new line, like hitting the enter key in a text field.

To parent a DButton to a DFrame, just put the name of the DFrame after a comma in the parentheses after vgui.Create like this

local dbuttonname = vgui.Create(“DButton”, nameOfParentPanelHere)

Ah , great thanks