• The Ultimate Guide to Derma - Everything there is to know about Derma
    217 replies, posted
That way didn't work either,I'm very fail today!
[QUOTE=AustinM]That way didn't work either,I'm very fail today![/QUOTE] [lua]function AustinDerma() local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( ScrW() / 2 - 100, ScrH() / 2 - 175 ) DermaPanel:SetSize( 200, 350 ) DermaPanel:SetTitle( "Austin's Derma" ) DermaPanel:SetVisible ( true ) DermaPanel:SetDraggable ( true ) DermaPanel:ShowCloseButton ( true ) DermaPanel:MakePopup() local DermaList = vgui.Create( "DPanelList", DermaPanel ) DermaList:SetPos( 2, 25 ) DermaList:SetSize( 196, 323 ) DermaList:SetPadding( 5 ) DermaList:SetSpacing( 5 ) DermaList:EnableHorizontal( false ) DermaList:EnableVerticalScrollbar( true ) local DermaButton = vgui.Create ( "DButton", DermaPanel) DermaButton:SetParent( DermaPanel ) DermaButton:SetText ( "Kill yourself" ) DermaButton.DoClick = function () RunConsoleCommand( "kill" ) end local CheckBoxThing = vgui.Create ( "DCheckBoxLabel") CheckBoxThing:SetParent( DermaPanel ) CheckBoxThing:SetText ( "God Mode" ) CheckBoxThing:SetConVar ( "sbox_godmode" ) CheckBoxThing:SetValue( 1 ) CheckBoxThing:SizeToContents() local NumSliderThingy = vgui.Create( "DNumSlider") NumSliderThingy:SetParent( DermaPanel ) NumSliderThingy:SetText( "Max Props" ) NumSliderThingy:SetMin ( 0 ) NumSliderThingy:SetMax( 256 ) NumSliderThingy:SetDecimals( 0 ) NumSliderThingy:SetConVar( "sbox_maxprops") NumSliderThingy:SizeToContents() DermaList:AddItem( DermaButton ) DermaList:AddItem( CheckBoxThing ) DermaList:AddItem( NumSliderThingy ) end concommand.Add("openderma", AustinDerma)[/lua] You had some minor capitalisation errors. As well as a minor setting out issue. [lua]DermaButton:DoClick = function () //You had this. DermaButton.DoClick = function () //You needed this.[/lua] I also added a DPanelList and sorted out some sizing issues, so if you run this it will be a reasonable size for the amount of things you put in, and it will be centred in the middle of the screen.
[QUOTE=PC Camp]Extremely sad as it is, yes. :([/QUOTE] Didn't you save a copy of it yourself?!
Sadly, no. :( So does [b]anyone[/b] have a copy? I bet it's in the forum server that Garry uses, so I'll ask him if he can get it for me.
[QUOTE=PC Camp]Sadly, no. :( So does [b]anyone[/b] have a copy? I bet it's in the forum server that Garry uses, so I'll ask him if he can get it for me.[/QUOTE] I got an old version, updated 4/19/08 From google; [url]http://72.14.205.104/search?q=cache:forums.facepunchstudios.com/showthread.php?t=526853[/url]
Thank you! That's good enough. I have the rest posted in seperate posts on page 2 and 3.
Don't forget to keep a local copy this time! :)
Or don't put everything into the first post in a thread. This is a forum, not a wiki.
-snipped long quote] I just got home from school,so I will try this later! :) EDIT1:I got this [img]http://img168.imageshack.us/img168/3769/gmsolarsystemv2fix0006pk7.jpg[/img] EDIT2:I had this for the size [lua]DermaPanelSetSize ( 1000, 90 )[/lua] but now I have this [lua]DermaPanel:SetSize ( 250, 250 )[/lua]
[QUOTE=garry]Or don't put everything into the first post in a thread. This is a forum, not a wiki.[/QUOTE] It's much easier to overview everything in the OP. And it wouldn't be a problem if the forum bug didn't exist...
Strange, it looks like this to me. [img]http://www.filesplurge.com/splurge/qPxWoXsbU8_austin_derma.png[/img] If you want your panel to be 250x250, then use the following [lua]function AustinDerma() local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( ScrW() / 2 - 125, ScrH() / 2 - 125 ) --Centres your panel, 125 is half of 250. DermaPanel:SetSize( 250, 250 ) --Makes your panel 250x250 DermaPanel:SetTitle( "Austin's Derma" ) DermaPanel:SetVisible ( true ) DermaPanel:SetDraggable ( true ) DermaPanel:ShowCloseButton ( true ) DermaPanel:MakePopup() local DermaList = vgui.Create( "DPanelList", DermaPanel ) DermaList:SetPos( 2, 25 ) --Places the list inwards 2 units to make a border and 25 units down so it doesn't cover the top bar of the panel. DermaList:SetSize( 246, 223 ) --Subtract 4 from 250 for the width so it has borders of 2 units both sides, and subtract 25 and 2 from 250 so you account for the top bar, aswell as a 2 unit border. DermaList:SetPadding( 5 ) DermaList:SetSpacing( 5 ) DermaList:EnableHorizontal( false ) DermaList:EnableVerticalScrollbar( true ) local DermaButton = vgui.Create ( "DButton", DermaPanel) DermaButton:SetParent( DermaPanel ) DermaButton:SetText ( "Kill yourself" ) DermaButton.DoClick = function () RunConsoleCommand( "kill" ) end local CheckBoxThing = vgui.Create ( "DCheckBoxLabel") CheckBoxThing:SetParent( DermaPanel ) CheckBoxThing:SetText ( "God Mode" ) CheckBoxThing:SetConVar ( "sbox_godmode" ) CheckBoxThing:SetValue( 1 ) CheckBoxThing:SizeToContents() local NumSliderThingy = vgui.Create( "DNumSlider") NumSliderThingy:SetParent( DermaPanel ) NumSliderThingy:SetText( "Max Props" ) NumSliderThingy:SetMin ( 0 ) NumSliderThingy:SetMax( 256 ) NumSliderThingy:SetDecimals( 0 ) NumSliderThingy:SetConVar( "sbox_maxprops") NumSliderThingy:SizeToContents() DermaList:AddItem( DermaButton ) DermaList:AddItem( CheckBoxThing ) DermaList:AddItem( NumSliderThingy ) end concommand.Add("openderma", AustinDerma)[/lua]
[QUOTE=Joerdgs] And it wouldn't be a problem if the forum bug didn't exist...[/QUOTE] Yea I'm going to fix it later this week. I'll have to make a whole new thread and have an alt account post on it so it's like three giant posts in one. Then I'll be sure to never get an overflow bug. :D
Is it possible to force a skin on a derma vgui, preventing a custom skin or the player from changing the skin midgame?
Yes, there's a gamemode function for it, I just can't remember what it is right now.
Is this it? [lua]local SKIN = {} function SKIN:PaintFrame(panel) self:DrawGenericBackground(0, 0, panel:GetWide(), panel:GetTall(), color_black) surface.SetDrawColor(0, 150, 0, 255) surface.DrawRect(0, 22, panel:GetWide(), 1) surface.DrawOutlinedRect(0, 0, panel:GetWide(), panel:GetTall()) end derma.DefineSkin("ZS", "Derma skin for Zombie Survival", SKIN, "Default") RunConsoleCommand("derma_skin", "ZS") [/lua] Also I can't find a function that closes a specific derma gui. I tried adding the visibility function to the button output but there it doesn't remove the gui.
Yeah, I used that to force my players to use the Vista-derma skin. [noparse]>:DD[/noparse]
[QUOTE=nkear5]Strange, it looks like this to me. [img]http://www.filesplurge.com/splurge/qPxWoXsbU8_austin_derma.png[/img] If you want your panel to be 250x250, then use the following [lua]function AustinDerma() local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( ScrW() / 2 - 125, ScrH() / 2 - 125 ) --Centres your panel, 125 is half of 250. DermaPanel:SetSize( 250, 250 ) --Makes your panel 250x250 DermaPanel:SetTitle( "Austin's Derma" ) DermaPanel:SetVisible ( true ) DermaPanel:SetDraggable ( true ) DermaPanel:ShowCloseButton ( true ) DermaPanel:MakePopup() local DermaList = vgui.Create( "DPanelList", DermaPanel ) DermaList:SetPos( 2, 25 ) --Places the list inwards 2 units to make a border and 25 units down so it doesn't cover the top bar of the panel. DermaList:SetSize( 246, 223 ) --Subtract 4 from 250 for the width so it has borders of 2 units both sides, and subtract 25 and 2 from 250 so you account for the top bar, aswell as a 2 unit border. DermaList:SetPadding( 5 ) DermaList:SetSpacing( 5 ) DermaList:EnableHorizontal( false ) DermaList:EnableVerticalScrollbar( true ) local DermaButton = vgui.Create ( "DButton", DermaPanel) DermaButton:SetParent( DermaPanel ) DermaButton:SetText ( "Kill yourself" ) DermaButton.DoClick = function () RunConsoleCommand( "kill" ) end local CheckBoxThing = vgui.Create ( "DCheckBoxLabel") CheckBoxThing:SetParent( DermaPanel ) CheckBoxThing:SetText ( "God Mode" ) CheckBoxThing:SetConVar ( "sbox_godmode" ) CheckBoxThing:SetValue( 1 ) CheckBoxThing:SizeToContents() local NumSliderThingy = vgui.Create( "DNumSlider") NumSliderThingy:SetParent( DermaPanel ) NumSliderThingy:SetText( "Max Props" ) NumSliderThingy:SetMin ( 0 ) NumSliderThingy:SetMax( 256 ) NumSliderThingy:SetDecimals( 0 ) NumSliderThingy:SetConVar( "sbox_maxprops") NumSliderThingy:SizeToContents() DermaList:AddItem( DermaButton ) DermaList:AddItem( CheckBoxThing ) DermaList:AddItem( NumSliderThingy ) end concommand.Add("openderma", AustinDerma)[/lua][/QUOTE] Thanks for fixing it up a bit! :)
Is there a way for it to check a certain list of Steam IDs, and if your Steam ID is not in that list, it won't open?
Yea you can make a table of SteamIDs like so: [lua] -- Create our table here YourSteamIDs = { "STEAM_0:1:543543", "STEAM_0:1:543543", "STEAM_0:1:543543", "STEAM_0:1:543543", "STEAM_0:1:543543" } -- The check on SteamIDs for K, S in pairs( YourSteamIDs ) do -- Loop through the table created if LocalPlayer():SteamID() == S then -- If the players SteamID = one of those SteamIDs in the table -- Show panel end end [/lua] That shall work great. Good luck.
[QUOTE=Tim610]Is there a way for it to check a certain list of Steam IDs, and if your Steam ID is not in that list, it won't open?[/QUOTE] SteamID checking will only work serverside. And derma menus are client side. So it would require sending over data between server and client. Check the list on the server, send over data to the client, then determine whether to open or not.
Is SteamID() really serverside only! :O Damn. :( Hold on I'll make a quick fix. ;) [b]Edit:[/b] Ok let me try this now. [b]SERVER SIDE[/b] [lua] -- Create our table here YourSteamIDs = { "STEAM_0:1:543543", "STEAM_0:1:543543", "STEAM_0:1:543543", "STEAM_0:1:543543", "STEAM_0:1:543543" } function SetNWBoolOnSpawn( ply ) ply:SetNWBool( "ShowPanel", false ) for K, S in pairs( YourSteamIDs ) do -- Loop through the table created if ply:SteamID() == S then -- If the players SteamID = one of those SteamIDs in the table ply:SetNWBool( "ShowPanel", true ) -- Set that bool true end end end hook.Add( "PlayerInitialSpawn", "WhenSpawn", SetNWBoolOnSpawn ) [/lua] [b]CLIENT SIDE[/b] [lua] if LocalPlayer():GetNWBool( "ShowPanel" ) then -- Show panel end [/lua] That shall work. :D
Well, One final question then, How do I make it take a entry from a multiple selection list and make it interact with a button? Here is what I'm saying. First, I have this [quote]local DermaListView = vgui.Create("DListView") DermaListView:SetParent(DermaPanel) DermaListView:SetPos(25, 50) DermaListView:SetSize(450, 625) DermaListView:SetMultiSelect(false) DermaListView:AddColumn("Name") for k,v in pairs(player.GetAll()) do DermaListView:AddLine(v:Nick(),v:Frags()) end [/quote] Then I have this [quote] local DermaButton = vgui.Create( "DButton" ) DermaButton:SetParent( DermaPanel ) DermaButton:SetText( "Kill" ) DermaButton:SetPos( 25, 50 ) DermaButton:SetSize( 150, 50 ) DermaButton.DoClick = function () RunConsoleCommand( "kill [player selected from list]" ) end [/quote] Would it run like this? Somehow? [quote] RunConsoleCommand( "kill .. variable_one .. " )? [/quote]
Can you add .TTF files to derma? I have a few custom fonts I want to add.
[QUOTE=grea$emonkey]Can you add .TTF files to derma? I have a few custom fonts I want to add.[/QUOTE] I haven't tried this, but I'm sure this will work. [lua] myLabel= vgui.Create("DLabel", myParent) myLabel:SetText("") myLabel.Paint = function() surface.SetFont( "BudgetLabel" ) surface.SetTextColor( 255, 255, 255, 255 ) surface.SetTextPos( 0, 0 ) surface.DrawText( "holly shitz!!!" ) end myLabel:SizeToContents() [/lua] Not tested, might work. No promises. ;)
Why is the post missing? I really want to learn LUA and it looks like you had a good tutorial here. Please fix this soon, as I am a LUA beginner and need all the pity, I mean help, I can get.
The 4/19/2008 link is on page 4,and still has the stuff you need to make a decent panel. [QUOTE=Spacetech]I got an old version, updated 4/19/08 From google; [url]http://72.14.205.104/search?q=cache:forums.facepunchstudios.com/showthread.php?t=526853[/url][/QUOTE] Anyways,I'm doing it step by step now.So I made one button,did the concommand thing,and it worked fine,but when I added another button,I tried entering in my command and it said unknown command,and it didn't do this last time.This is was PC Camp said: [lua] 1. local DermaPanel = vgui.Create( "DFrame" ) 2. DermaPanel:SetPos( 50, 50 ) 3. DermaPanel:SetSize( 500, 500 ) 4. DermaPanel:SetTitle( "Austin's Derma" ) 5. DermaPanel:SetVisible( true ) 6. DermaPanel:SetDraggable( true ) 7. DermaPanel:ShowCloseButton( true ) 8. 9. local DermaButtonOne = vgui.Create( "DButton" ) 10. DermaButtonOne:SetParent( DermaPanel ) 11. DermaButtonOne:SetText( "Kill yourself" ) 12. DermaButtonOne:SetPos( 25, 50 ) 13. DermaButtonOne:SetSize( 150, 50 ) 14. DermaButtonOne.DoClick = function () -- not :DoClick, but .DoClick 15. RunConsoleCommand( "kill" ) 16. end -- Forgot to end it 17. 18. local DermaButtonTwo = vgui.Create( "DButton" ) 19. DermaButtonTwo:SetParent( DermaPanel ) 20. DermaButtonTwo:SetText( "Clean the console" ) 21. DermaButtonTwo:SetPos( 25, 200 ) 22. DermaButtonTwo:SetSize( 150, 50 ) 23. DermaButtonTwo.DoClick = function () 24. RunConsoleCommand( "clear" ) 25. 26. end 27. 28. concommand.Add("openderma", AustinDerma)[/lua] Try now. Should work. Also,don't mind the extra numbers.It's just from a copy+paste.
To use custom fonts: [lua] surface.CreateFont( string font_name, number size, number weight, bool antialias, bool italics, string reference_name ) //So surface.CreateFont( "Times New Roman", 14, 400, true, false, "Roman" ) [/lua] [lua] ... surface.SetFont( "Roman" ) ... [/lua] More info: [url=http://wiki.garrysmod.com/wiki/?title=Surface.CreateFont]LINK[/url]
So like this? [lua] surface.CreateFont( "Times New Roman", 14, 400, true, false, "Roman" ) myLabel= vgui.Create("DLabel", myParent) myLabel:SetText("") myLabel.Paint = function() surface.SetFont( "Roman" ) surface.SetTextColor( 255, 255, 255, 255 ) surface.SetTextPos( 0, 0 ) surface.DrawText( "holly shitz!!!" ) end myLabel:SizeToContents() [/lua] Has anyone tested this out? [b]Edit:[/b] Also, I edited your link in the Wiki to the cached page so people wouldn't be linked to a blank post. I hope you're okay with that. You can change it back if you want. :)
[QUOTE=grea$emonkey] Also, I edited your link in the Wiki to the cached page so people wouldn't be linked to a blank post. I hope you're okay with that. You can change it back if you want. :)[/QUOTE] That code should work. I'm planing on just make a whole new thread with 4 reserved posts on it using an alt account. That way if I run out of room on the first post, I can extend on the second. :D
Okay, I'll try this out. I was just wondering if you were okay with me changing that one link. :D [b]Edit:[/b] [lua] surface.CreateFont( "DEATH FONT", 100, 400, true, false, "DNFont1" ) local DermaLabel = vgui.Create("DLabel", DermaPanel) DermaLabel:SetText("") DermaLabel.Paint = function() surface.SetFont( "DNFont1" ) surface.SetTextColor( 255, 255, 255, 255 ) surface.SetTextPos( 110, 100 ) surface.DrawText( "DEATHNOTE" ) end DermaLabel:SizeToContents()[/lua] It looks like regular text. I've looked in the True Type Font file and it looks way different. The TTF is in the resource/fonts folder and it still doesn't work. :( No errors. :( :( :(
Sorry, you need to Log In to post a reply to this thread.