• The Ultimate Guide to Derma - Everything there is to know about Derma
    217 replies, posted
[QUOTE=PC Camp]:words:[/QUOTE] Are you planning on recreating the full guide?
[QUOTE=Darkflamers]Are you planning on recreating the full guide?[/QUOTE] I believe he is
Does anyone know why the font thing isn't working? [b]Edit:[/b] I got fonts working on the label. SetFont needs to come right after SetText. The only problem is that I can't get the font to work on things like lists. :( Anyone now what I can do?
I need some help with a "simple" script I'm trying to create. I need to run two functions when I open this [i]main window[/i], but I don't know how to. Help, anybody? The main window opens when the player presses a button. [lua] function RadioInitialize() DermaButton = {} CheckBoxYell = vgui.Create( "DCheckBoxLabel", mainwindow ) CheckBoxYell:SetPos( 50,650 ) CheckBoxYell:SetParent( mainwindow ) CheckBoxYell:SetText( "Yell" ) CheckBoxYell:SetConVar( "rp_yell" ) CheckBoxYell:SetValue( 1 ) CheckBoxYell:SizeToCon10ts() CheckBoxRadio = vgui.Create( "DCheckBoxLabel", mainwindow ) CheckBoxRadio:SetPos( 150,650 ) CheckBoxRadio:SetParent( mainwindow ) CheckBoxRadio:SetText( "Radio" ) CheckBoxRadio:SetConVar( "rp_radio" ) CheckBoxRadio:SetValue( 1 ) CheckBoxRadio:SizeToContents() OrdersOpen() -- This function RequestOpen() -- And this function end end [/lua] Keep in mind this is just a sample. I have a main panel.
I don't quite understand what you want it to do
I figured it out, with some help from mahalis.
Is there a way to make a DListView that opens a drop-down panel with another list? Maybe like in the spawn menu. What's that called?
DTreeView, I think. Or maybe you're thinking of DComboBox?
I'm not sure. :( By the way, how do you call serverside commands on derma? I mean, it's clientside, but there has to be a way to make derma do stuff that isn't clientside right? Otherwise derma would be pointless.
[QUOTE=grea$emonkey]I'm not sure. :( By the way, how do you call serverside commands on derma? I mean, it's clientside, but there has to be a way to make derma do stuff that isn't clientside right? Otherwise derma would be pointless.[/QUOTE] Commands made serverside are visible client side. You can use its parameters to send data to the server. Like you click the spawn button, making the derma menu use RunConsoleCommand( "yourcustomspawncommand" ), which makes the server spawn you as defined in the command function you made for the command.
[QUOTE=grea$emonkey]I'm not sure. :( By the way, how do you call serverside commands on derma? I mean, it's clientside, but there has to be a way to make derma do stuff that isn't clientside right? Otherwise derma would be pointless.[/QUOTE] I know you can use user messages, but I'm not sure if you know what those are or how to use them. I'd be glad to help out if needed.
User messages are for server to client information. You just create a console command to alias it on the client. Take a look at commands.lua or whatever it is in the sandbox gamemode ( [url=http://code.garrysmod.com/?show=garrysmod/gamemodes/sandbox/gamemode/commands.lua]LINK[/url] ).
[QUOTE=Joerdgs]Commands made serverside are visible client side. You can use its parameters to send data to the server. Like you click the spawn button, making the derma menu use RunConsoleCommand( "yourcustomspawncommand" ), which makes the server spawn you as defined in the command function you made for the command.[/QUOTE] I thought so.
But, I believe this makes it so people can just type it into the console. Makes easy hack-like speed-passes (if used for a gamemode :ninja:)
How do I set the DoClick function's name to include a variable? Like this: [lua] z = 1 for n=1,10 do t[n] = vgui.Create("DButton") t[n] :SetParent( mainwindow ) t[n]:SetText( "stuff" ) t[n].Player = v t[n].DoClick = TableFunction .. z -- This name has to include the variable "z". How do I do that? z = z + 1 end --Jumping some lines in the code function TableFunction1() RunConsoleCommand(stuff) end end function TableFunction2() RunConsoleCommand(stuff) end end --Continuing like that. [/lua] This script works fine when I'm not trying to include the variable. It gives this error when I am: [code] autorun/client/Radiomenu_v4-2.lua:218: attempt to concatenate global 'TableFunction' (a nil value) [/code] [i]Line 218 is line 9 here.[/i]
Alright take a look at this. [lua] local yourtable = { -- Create initial table { name = "Cheese", command = "say I love cheese!" }, -- Create our options in tables inside "yourtable" table { name = "Milk", command = "say Milk is good!" }, { name = "Bone", command = "say people eat my bones!" }, { name = "Bird", command = "say I can fly like a bird!" }, { name = "Moooo", command = "say The dog says, moooo!" }, { name = "Chicken", command = "say The computer looks like a chicken!" }, } function OpenPanelz() local YourFrame = vgui.Create("DFrame") -- Create frame YourFrame:SetPos(50,50) YourFrame:SetSize(500, 525) YourFrame:SetTitle( "Your Frame Name" ) YourFrame:SetVisible( true ) YourFrame:MakePopup() y = 50 for key, value in pairs( yourtabel ) do -- Our loop YourButton[key] = vgui.Create( "DButton", YourFrame ) -- Create control and parent YourButton[key]:SetText( value.name ) -- Set text based on the value of "yourtable" name YourButton[key]:SetPos(25, 50) YourButton[key]:SetSize( YourFrame:GetWide() - 20, 25 ) YourButton[key].DoClick = function () LocalPlayer():ConCommand( value.command ) -- Run the command based on the value of "yourtable" command end y = y + 50 end end [/lua] Hope that helps a little. [b]Edit:[/b] I'll be making a whole new thread with five reserved posts so I can make the guide as long as I want. Expect it by friday! :)
How can i set a value to the row i selected in a "DListView" to the name of the row?
I'm testing how the next guide will come out: *Derma Picture* [highlight]Beginning notes:[/highlight] [i]If you have had no VGUI experience or have no idea what VGUI is, please skip to post[/i] 3. [b]Table of Contents:[/b] [list] [*]WTFs is Derma? [*]Introduction [*]Derma Controles [list] [*]DFrame [*]DButton [*]DSysButton [*]DCheckBoxLabel [*]DNumSlider [*]DPanelList [*]DCollapsibleCategory [*]DTextEntry [*]DImageButton [*]DermaMenu [/list] [*]But Really, What's VGUI? [*]Tips and Tricks [*]Skining Derma [*]Final Notes [*]Credits [/list] [u]WTFs is Derma?[/u] Derma is the greatest thing to happen to VGUI in garrysmod. Some may disagree, but I love it. Derma is a library of VGUI controls made by Garry and TAD2020 which can be used to make your gamemode/addon a lot easier to use. Some exampes of Derma controls are the those that are used on the spawnmenu (qMenu). [u]Introduction:[/u] This is a really long guide/manuel on everything there is to know about how to use every control in Derma. I will be committing everything to the wiki so there will be no missing Derma libraries. I [b]will not use loops[/b] because I made this guide to teach how to use Derma controls; not teach tables and loops. Now let's begin the guide. :) [u]Derma Controls[/u] [release] [tab]Name:[/tab]DFrame [tab]Description:[/tab]This is a panel that you can place Derma controls on. This control will be used vary often. [tab]Code:[/tab] [lua] local DermaPanel = vgui.Create( "DFrame" ) -- Creates the frame itself DermaPanel:SetPos( 50,50 ) -- Position on the players screen DermaPanel:SetSize( 1000, 900 ) -- Size of the frame DermaPanel:SetTitle( "Testing Derma Stuff" ) -- Title of the frame DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) -- Draggable by mouse? DermaPanel:ShowCloseButton( true ) -- Show the close button? DermaPanel:MakePopup() -- Show the frame [/lua] [tab]Outcome:[/tab][img]http://img219.imageshack.us/img219/1646/dbuttonnz8.png[/img] [/release] [release] [tab]Name:[/tab]DButton [tab]Description:[/tab]This creates a simple button. [tab]Code:[/tab] [lua] local DermaButton = vgui.Create( "DButton", DermaPanel ) DermaButton:SetText( "Kill Yourself" ) DermaButton:SetPos( 25, 50 ) DermaButton:SetSize( 150, 50 ) DermaButton.DoClick = function() RunConsoleCommand( "kill" ) -- What happens when you left click the button end DermaButton.DoRightClick = function() RunConsoleCommand( "say I want cheese!" ) -- What happens when you right-click the button end [/lua] [tab]Outcome:[/tab][img]http://img219.imageshack.us/img219/1646/dbuttonnz8.png[/img] [/release] [release] [tab]Name:[/tab]DSysButton [tab]Description:[/tab]This creates the same thing as DButton does, but you can place different preset images on them. [tab]Code:[/tab] [lua] local SystemButtonThingOne = vgui.Create("DSysButton", DermaPanel) SystemButtonThingOne:SetPos( 25,50 ) SystemButtonThingOne:SetSize( 50, 25 ) SystemButtonThingOne:SetType( "close" ) -- This can be "up", "down", "left", "right", "updown", "close", "grip", "tick", "question", and "none". SystemButtonThingOne.DoClick = function() Msg("You clicked the button!\n") -- What happens when you left click on it end [/lua] [tab]Outcome:[/tab][img]http://img100.imageshack.us/img100/3158/dsysbuttombe4.png[/img] [/release] [release] [tab]Name:[/tab]DCheckBoxLabel [tab]Description:[/tab]This is creates a checkbox with a label before it. [tab]Code:[/tab] [lua] local CheckBoxThing = vgui.Create( "DCheckBoxLabel", DermaPanel ) CheckBoxThing:SetPos( 10, 50 ) CheckBoxThing:SetText( "God Mode" ) CheckBoxThing:SetConVar( "sbox_godmode" ) -- ConCommand must be a 1 or 0 value CheckBoxThing:SetValue( 1 ) [/lua] [tab]Outcome:[/tab][img]http://img519.imageshack.us/img519/429/checkboxkk8.png[/img] [/release] [release] [tab]Name:[/tab]DNumSlider [tab]Description:[/tab]This creates a number slider to change a number. [tab]Code:[/tab] [lua] local NumSliderThingy = vgui.Create( "DNumSlider", DermaPanel ) NumSliderThingy:SetPos( 25, 50 ) NumSliderThingy:SetSize( 150, 100 ) -- Keep the second number at 100 NumSliderThingy:SetText( "Max Props" ) NumSliderThingy:SetMin( 0 ) -- Minimum number of the slider NumSliderThingy:SetMax( 256 ) -- Maximum number of the slider NumSliderThingy:SetDecimals( 0 ) -- Sets a decimal. Zero means it's an integer NumSliderThingy:SetConVar( "sbox_maxprops" ) -- Set the convar [/lua] [tab]Outcome:[/tab][img]http://img512.imageshack.us/img512/9955/dsliderka6.png[/img] [/release] [release] [tab]Name:[/tab]DPanelList [tab]Description:[/tab]This creates some controls in an organized list. [tab]Code:[/tab] [lua] DermaList = vgui.Create( "DPanelList", DermaPanel ) DermaList:SetPos( 25,25 ) DermaList:SetSize( 200, 200 ) DermaList:SetSpacing( 5 ) -- Spacing between items DermaList:EnableHorizontal( false ) -- Only vertical items DermaList:EnableVerticalScrollbar( true ) -- Allow scrollbar if you exceed the Y axis local CategoryContentOne = vgui.Create( "DCheckBoxLabel" ) CategoryContentOne:SetText( "God Mode" ) CategoryContentOne:SetConVar( "sbox_godmode" ) CategoryContentOne:SetValue( 1 ) CategoryContentOne:SizeToContents() -- Size it to the list's size DermaList:AddItem( CategoryContentOne ) -- Add the item above local CategoryContentTwo = vgui.Create( "DCheckBoxLabel" ) CategoryContentTwo:SetText( "Player Damage" ) CategoryContentTwo:SetConVar( "sbox_plpldamage" ) CategoryContentTwo:SetValue( 1 ) CategoryContentTwo:SizeToContents() DermaList:AddItem( CategoryContentTwo ) -- Add the item above local CategoryContentThree = vgui.Create( "DCheckBoxLabel" ) CategoryContentThree:SetText( "Fall Damage" ) CategoryContentThree:SetConVar( "mp_falldamage" ) CategoryContentThree:SetValue( 1 ) CategoryContentThree:SizeToContents() DermaList:AddItem( CategoryContentThree ) -- Add the item above local CategoryContentFour = vgui.Create( "DCheckBoxLabel" ) CategoryContentFour:SetText( "Noclip" ) CategoryContentFour:SetConVar( "sbox_noclip" ) CategoryContentFour:SetValue( 1 ) CategoryContentFour:SizeToContents() DermaList:AddItem( CategoryContentFour ) -- Add the item above local CategoryContentFive = vgui.Create( "DCheckBoxLabel" ) CategoryContentFive:SetText( "All Talk" ) CategoryContentFive:SetConVar( "sv_alltalk" ) CategoryContentFive:SetValue( 1 ) CategoryContentFive:SizeToContents() DermaList:AddItem( CategoryContentFive ) -- Add the item above local CategoryContentSix = vgui.Create( "DNumSlider" ) CategoryContentSix:SetSize( 150, 50 ) -- Keep the second number at 50 CategoryContentSix:SetText( "Max Props" ) CategoryContentSix:SetMin( 0 ) CategoryContentSix:SetMax( 256 ) CategoryContentSix:SetDecimals( 0 ) CategoryContentSix:SetConVar( "sbox_maxprops" ) DermaList:AddItem( CategoryContentSix ) -- Add the item above local CategoryContentSeven = vgui.Create("DSysButton", DermaPanel) CategoryContentSeven:SetType( "close" ) CategoryContentSeven.DoClick = function() RunConsoleCommand("sv_password", "toyboat") end CategoryContentSeven.DoRightClick = function() RunConsoleCommand("sv_password", "**") end DermaList:AddItem( CategoryContentSeven ) -- Add the item above [/lua] [tab]Outcome:[/tab][img]http://img216.imageshack.us/img216/8463/dpanellistjb3.png[/img] [tab]Extra Notes:[/tab]If you have too many items in your list, don't worry. A scroll bar will automatically appear for you. [img]http://img100.imageshack.us/img100/21/dscrollingso7.png[/img] [/release] [release] [tab]Name:[/tab]DCollapsibleCategory [tab]Description:[/tab]Creates a collapsable list of items. [tab]Code:[/tab] [lua] local SomeCollapsibleCategory = vgui.Create("DCollapsi
[QUOTE=PC Camp]*snipped HUGE post*[/QUOTE] Awesome. [b]Edit:[/b] [QUOTE=kevkev]How can i set a value to the row i selected in a "DListView" to the name of the row?[/QUOTE] A bit help with this please?
Is there some kind of text box thing which is just for writing text?
[QUOTE=superadamwo]Is there some kind of text box thing which is just for writing text?[/QUOTE] DTextEntry?
I guess, but how do you set the position of the text and the size etc? No nevermind, that's for entering text. I meant just a regular block of text, as in a description or something like that.
i can't see first post
[QUOTE=bobthe2lol]i can't see first post[/QUOTE] me too. Can't see it :( :(
Forum bug. It's gone.
[QUOTE=grea$emonkey]Forum bug. It's gone.[/QUOTE] No... Not for me :( Can someone just resend the whole tutorial? In the same thread?
[QUOTE=commander204]No... Not for me :( Can someone just resend the whole tutorial? In the same thread?[/QUOTE] What? How do you expect anyone to do that? PC Camp is trying to recreate it.
[QUOTE=grea$emonkey]What? How do you expect anyone to do that? PC Camp is trying to recreate it.[/QUOTE] it was a IDEA.
I'm making a whole new thread with an alt account so I can make 10 posts and reserve them so the forum doesn't blow up and erase it. Check the wiki for now. It's posted there.
[QUOTE=kevkev]How can i set a value to the row i selected in a "DListView" to the name of the row?[/QUOTE] Please someone help me with this.
Sorry, you need to Log In to post a reply to this thread.