The Ultimate Guide to Derma - Everything there is to know about Derma
217 replies, posted
Whens that comin' out. Sounds fancy.
[QUOTE=AustinM]I think you can,PC Camp is a nice guy,but ask him first. :P
Does anyone know what lines to put in to make a command to open/close the derma?Of course you can enter the command into console.[/QUOTE]
I used
[lua]
function NameYourFunction()
//Derma Goes Here
End
concommand.Add("opensesame", NameYourFunction) -- The bit in the quote marks is your console command you want to create The bit not in the quote marks is the function name. So typing opensesame in console opens your derma.
[/lua]
[b] FIXED [/b]
Whats the best way to open this with a key though.
[QUOTE=nofearkid]Whens that comin' out. Sounds fancy.[/QUOTE]
When it's done.
[QUOTE=MASTERDMR]I used
[lua]
function NameYourFunction()
//Derma Goes Here
End
concommand.Add("NameYourFunction", opensesame) -- The bit in the quote marks is your function name. The bit not in the quote marks is the console command you want to add So typing opensesame in console opens your derma.
[/lua]
Whats the best way to open this with a key though.[/QUOTE]
[lua]
function NameYourFunction()
//Derma Goes Here
end -- case sensitive
concommand.Add("opensesame", NameYourFunction) -- swap around
[/lua]
that's what i get for naming commands the same as my functions.
i had better change that.
the case sensitive thing was a silly mistake. I'm new to lua and i forget.
For some reason, I can't get my derma panel to show up. Apparently, there is no such command as "menutest" Also, I put it in lua\autorun\client.
Code:
[lua]function OpenPanel()
local Mpanel = vgui.Create ("DFrame")
Mpanel:SetPos(50,50)
Mpanel:SetSize(500,700)
Mpanel:SetTitle("Player List")
Mpanel:SetVisible( true )
Mpanel:SetDraggable( true )
Mpanel:ShowCloseButton( true )
Mpanel:MakePopup()
local DLView = vgui.Create("DListView")
DLView:SetParent(Mpanel)
DLView:SetPos(25,50)
DLView:SetSize(450,550)
DLView:SetMultiSelect(false)
DLView:AddColumn("Name")
DLView:AddColumn("Kills")
DLView:AddColumn("Deaths")
DLView:AddColumn("SteamID")
for k,v in pairs(Player:GetAll()) do
DLView:AddLine(v:Nick(),(v:Frags(),(v:Deaths(),(v:SteamID())
end
concommand:Add("menutest", OpenPanel) [/lua]
Not enough
[lua]
end[/lua]
the function wasn't ended
correct me if im wrong
[lua]
function OpenPanel()
local Mpanel = vgui.Create ("DFrame")
Mpanel:SetPos(50,50)
Mpanel:SetSize(500,700)
Mpanel:SetTitle("Player List")
Mpanel:SetVisible( true )
Mpanel:SetDraggable( true )
Mpanel:ShowCloseButton( true )
Mpanel:MakePopup()
local DLView = vgui.Create("DListView")
DLView:SetParent(Mpanel)
DLView:SetPos(25,50)
DLView:SetSize(450,550)
DLView:SetMultiSelect(false)
DLView:AddColumn("Name")
DLView:AddColumn("Kills")
DLView:AddColumn("Deaths")
DLView:AddColumn("SteamID")
for k,v in pairs(Player:GetAll()) do
DLView:AddLine(v:Nick(),(v:Frags(),(v:Deaths(),(v:SteamID())
end
end
concommand:Add("menutest", OpenPanel)
[/lua]
Nope, still says menutest isn't a command.
you are using Mpanel.not Dermapanel
try
[lua]
function OpenPanel()
local Dermapanel = vgui.Create ("DFrame")
Dermapanel:SetPos(50,50)
Dermapanel:SetSize(500,700)
Dermapanel:SetTitle("Player List")
Dermapanel:SetVisible( true )
Dermapanel:SetDraggable( true )
Dermapanel:ShowCloseButton( true )
Dermapanel:MakePopup()
local DLView = vgui.Create("DListView")
DLView:SetParent(Mpanel)
DLView:SetPos(25,50)
DLView:SetSize(450,550)
DLView:SetMultiSelect(false)
DLView:AddColumn("Name")
DLView:AddColumn("Kills")
DLView:AddColumn("Deaths")
DLView:AddColumn("SteamID")
for k,v in pairs(Player:GetAll()) do
DLView:AddLine(v:Nick(),(v:Frags(),(v:Deaths(),(v:SteamID())
end
end
concommand.Add("menutest", OpenPanel)
[/lua]
It's concommand.Add, not concommand:Add.
Did not spot that.
edited my code above.
i tried both of your things, and it still doesn't show up.
Post your current code.
[QUOTE=Joerdgs]Post your current code.[/QUOTE]
Ok
[lua]function OpenPanel()
local Dermapanel = vgui.Create ("DFrame")
Dermapanel:SetPos(50,50)
Dermapanel:SetSize(500,700)
Dermapanel:SetTitle("Player List")
Dermapanel:SetVisible( true )
Dermapanel:SetDraggable( true )
Dermapanel:ShowCloseButton( true )
Dermapanel:MakePopup()
local DLView = vgui.Create("DListView")
DLView:SetParent(Dermapanel)
DLView:SetPos(25,50)
DLView:SetSize(450,550)
DLView:SetMultiSelect(false)
DLView:AddColumn("Name")
DLView:AddColumn("Kills")
DLView:AddColumn("Deaths")
DLView:AddColumn("SteamID")
for k,v in pairs(Player:GetAll()) do
DLView:AddLine(v:Nick(),(v:Frags(),(v:Deaths(),(v:SteamID())
end
end
concommand.Add("menutest", OpenPanel) [/lua]
[QUOTE=Xeneon]
[lua]
DLView:AddLine(v:Nick(),(v:Frags(),(v:Deaths(),(v:SteamID())
--Parentheses->^open-----^open------^open-------^open-----^close[/lua][/QUOTE]
Could be too many parentheses.
For some reason, this one works yet it is essentially the same as mine (I got it off the wiki)
[lua]function testpanel() // Create the function
test = vgui.Create("DFrame") // Create the frame
menu1 = vgui.Create("DButton") // Create the button
test:SetPos(50,50) // set the frame's position on the screen
test:SetSize(300, 300) // set the frame size
test:SetTitle( "Test" ) // set the frame title
test:SetVisible( true ) // Make the frame visible
test:MakePopup() // make the frame popup
menu1:SetParent( test ) // parent the button to the frame
menu1:SetText( "Menu >" ) // set the button text
menu1:SetPos(150, 150) // set the button position in the frame
menu1:SetSize( 100, 20 ) // set the button size
menu1.DoClick = function ( btn ) // this will be called when the button is clicked
local menu123 = DermaMenu() // create a derma menu
menu123:AddOption("hello", function() Msg("Hello") end ) // adding options
menu123:AddOption("how", function() Msg("How") end )
menu123:AddOption("are", function() Msg("Are") end )
menu123:AddOption("you", function() Msg("You") end )
menu123:AddOption("?", function() Msg("?") end )
menu123:Open()
end // ending the doclick function
end // ending the function
concommand.Add("testmenu", testpanel) // adding the console command
[/lua]
It's not Player:GetAll()
It's player.GetAll()
[QUOTE=PC Camp]It's not Player:GetAll()
It's player.GetAll()[/QUOTE]
Either way works.
[b]Edit:[/b]
Nevermind, I didn't notice the capital P.
It appears that your guide is gone.
[img]http://i26.tinypic.com/xmk8kp.png[/img]
Yeah it's the same for me too.
Anyways,in this thing,The Derma Goes Here thing,what is that?
# function NameYourFunction()
#
# //Derma Goes Here
#
# End
#
# concommand.Add("NameYourFunction", opensesame) -- The bit in the quote marks is your function name. The bit not in the quote marks is the console command you want to add So typing opensesame in console opens your derma.
Yea look at my code again because what i had before is wrong.
Basically the Derma goes here part is what ever you make with your derma.
The function bit is simply a way to view your derma.
There may be a better way but for just testing it, this seems fine.
[QUOTE=Darkflamers]It appears that your guide is gone.
[img]http://i26.tinypic.com/xmk8kp.png[/img][/QUOTE]
What the flying fuck!? It was there the other day. :(
I wonder if Garry didn't like it or something.
[b]DID SOMEONE KEEP A COPPY OF IT?[/b] I kinda never saved it. :(
can't you just rip it from the wiki?
Assuming you used the same information etc.
[QUOTE=MASTERDMR]Yea look at my code again because what i had before is wrong.
Basically the Derma goes here part is what ever you make with your derma.
The function bit is simply a way to view your derma.
There may be a better way but for just testing it, this seems fine.[/QUOTE]
It didn't work,here's the code.If anyone else can help me with this code,please do.Thanks!
[lua]function AustinDerma()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanelSetSize ( 1000, 90 )
DermaPanel:SetTitle( "Austin's Derma" )
DermaPanel:SetVisible ( true )
DermaPanel:SetDraggable ( true )
DermaPanel:ShowCloseButton ( true )
DermaPanel:MakePopup()
local DermaButton = vgui.Create ( "DButton" )
DermaButton:SetParent( DermaPanel )
DermaButton:SetText ( "Kill yourself" ) -- the name of the button we'll have
DermaButton:SetPos ( 25,50 )
DermaButton:SetSize (150, 50 )
DermaButton:DoClick = function ()
RunConsoleCommand( "kill" ) -- just some kill thing
end
local CheckBoxThing = vgui.Create ( "DCheckBoxLabel", DermaPanel )
CheckBoxThing:SetPos ( 10,50 )
CheckBoxThing:SetText ( "God Mode" )
CheckBoxThing:SetConvar ( "sbox_godmode" )
CheckBoxThing:SetValue( 1 )
CheckBoxThing:SizeToContents( 50 )
local NumSliderThingy = vgui.Create( "DNumSlider", DermaPanel )
NumSliderThingy:SetPos( 125,50 )
NumSliderThingy:SetSize( 150, 100 ) -- Keep the second number at 100
NumSliderThingy:SetText( "Max Props" )
NumSliderThingy:SetMin ( 0 )
NumSliderThingy:SetMax( 256 )
NumSliderThingy:SetDecimals( 0 )
NumSliderThingy:SetConVar( "sbox_maxprops") --- the convar,change the lua around with this so you aren't stupid
end
concommand.Add("AustinDerma", openDerma) -- The bit in the quote marks is your function name. The bit not in the quote marks is the console command you want to add So typing opensesame in console opens your derma.[/lua]
Forum bug strikes again?
[QUOTE=AustinM]It didn't work,here's the code.If anyone else can help me with this code,please do.Thanks!
[lua]
concommand.Add("AustinDerma", openDerma) -- The bit in the quote marks is your function name. The bit not in the quote marks is the console command you want to add So typing opensesame in console opens your derma.[/lua][/QUOTE]
Why do so many people get this function wrong. FUNCTIONS ARE VARIABLES.
[lua]
concommand.Add("openderma", AustinDerma)
[/lua]
[QUOTE=Joerdgs]Forum bug strikes again?[/QUOTE]
Extremely sad as it is, yes. :(
Aww, I was hoping to use this too. :(
[QUOTE=Vicis]Why do so many people get this function wrong. FUNCTIONS ARE VARIABLES.
[lua]
concommand.Add("openderma", AustinDerma)
[/lua][/QUOTE]
Apologies,many.But I am still learning this fascinating code :)
:lol: You don't have to be sorry. Just learn from what your taught. That's what we are here for. :eng101:
Sorry, you need to Log In to post a reply to this thread.