The Ultimate Guide to Derma - Everything there is to know about Derma
217 replies, posted
The words that I am going to post now: I LOVE YOU!!!
Oh my god this is so useful!
Put this in your tutorial too:
[url]http://code.garrysmod.com/?into=garrysmod/addons/derma/lua/vgui[/url]
On this site you can see how the derma controls are made. This can be extremely useful(I use it a lot too)
Nice tutorial. This should help a lot of people.
There is a downside though,
The noobs who read this will spam the Lua releases forums with only simple derma VGUIs!
Just like what happened to that swep creator
That might be, but at least they are trying to learn VGUI and put their scripts to use. :)
I hate LUA but man is this cool.
Try lua some time. I enjoy coding more then playing the game for some reason. :lol:
Try using loops next time, that's terrible copy-pasta rape right there.
And there's a lot more to know about Derma, for example how most of that can be done with normal VGUI.
You should tell more about the differences.
I will later on. All I want to do now is post every Derma library and how it's used. After that I will get into raw VGUI stuff and how Derma was created using raw VGUI.
And what do you mean by "loops"? What's wrong with copy and pasting my code?
I love you.
Maybe tommorow, could you teach us on how to put this on a STool or one of those tabs? (like utilities or options)
I could do that. Remember this is only a couple of the Derma items. There is a shit load more.
I can give you a quick example of a Derma listview. If you need it.
Yes, I learned to use derma in a new gamemode I am doing and it is quite helpful in making it easier to do a good looking vgui.
And you can make everything really sexy by making a Derma skin.
No thank you SuperU. I know pretty much the whole Derma library. Just need to type it all out.
[QUOTE=jA_cOp]Try using loops next time, that's terrible copy-pasta rape right there.
[/QUOTE]
It's actually typically smarter to do that, as people who don't know how to code Lua will simply paste the code for the button without including the code for the main Derma panel, and wonder why it doesn't work. Or try to stick one inside the other, for some reason.
Nice work.
Loops make VGUI much more manageable, you should really edit some of those examples to make use of them.
Very nice guide, Very useful!
----
This is a good example how to use loops.
This is a kind of copy>paste>snipping stuff from my WIP gamemode.
[lua]
Bonusweapons = {}
Bonusweapons["Annabelle"] = "weapon_bb_annabelle"
Bonusweapons["Grenade"] = "weapon_frag"
Bonusweapons["Slam"] = "weapon_slam"
Bonusweapons["None"] = ""
DonatorBonusses = vgui.Create( "DPanelList" )
DonatorBonusses:SetSize( 400, 362 )
DonatorBonusses:EnableHorizontal(false)
DonatorBonusses:EnableVerticalScrollbar(true)
for k,v in pairs( Bonusweapons ) do
DonatorBonussesWeapon = vgui.Create("DButton", DonatorBonusses )
DonatorBonussesWeapon:SetText(k)
DonatorBonussesWeapon.DoClick = function()
surface.PlaySound( "buttons/combine_button1.wav" )
RunConsoleCommand( "bb_selectweaponbonus", v )
end
DonatorBonusses:AddItem( DonatorBonussesWeapon )
end
[/lua]
(untested)
[QUOTE=maurits150]Very nice guide, Very useful!
----
This is an good example how to use loops.
This is a kind of copy>paste>snipping stuff from my WIP gamemode.
[lua]
Bonusweapons = {}
Bonusweapons["Annabelle"] = "weapon_bb_annabelle"
Bonusweapons["Grenade"] = "weapon_frag"
Bonusweapons["Slam"] = "weapon_slam"
Bonusweapons["None"] = ""
DonatorBonusses = vgui.Create( "DPanelList" )
DonatorBonusses:SetSize( 400, 362 )
DonatorBonusses:EnableHorizontal(false)
DonatorBonusses:EnableVerticalScrollbar(true)
for k,v in pairs( Bonusweapons ) do
DonatorBonussesWeapon = vgui.Create("DButton", DonatorBonusses )
DonatorBonussesWeapon:SetText(k)
DonatorBonussesWeapon.DoClick = function()
surface.PlaySound( "buttons/combine_button1.wav" )
RunConsoleCommand( "bb_selectweaponbonus", v )
end
DonatorBonusses:AddItem( DonatorBonussesWeapon )
end
[/lua]
(untested)[/QUOTE]
This is exactly the kind of thing I am talking about.
It makes it more managable, easier to read, easier to add to, shorter, and prettier :)
FYI, DCollapsibleCategory is really designed to be used in a DPanelList (as seen in the map selection/toolbar/etc).
Also, good work - hope this all makes it into the wiki.
Holy shit.
I never knew Derma was this easy, thanks man :D
[QUOTE=garry]FYI, DCollapsibleCategory is really designed to be used in a DPanelList (as seen in the map selection/toolbar/etc).
Also, good work - hope this all makes it into the wiki.[/QUOTE]
I started to make a full derma tutorial series on friday see the first here: [url]www.garrysmod.com/wiki/?title=Derma_Tutorial1[/url]
and ill add another today
Ah, very useful! I'm not a newbie with Derma but I'm not familiar with all elements just yet. Keep up the good work! :)
Lua kinged by the way.
Handy stuff, thanks!
You should teach people how to create their own custom panels. It looks a lot cleaner.
[QUOTE=conman420]You should teach people how to create their own custom panels. It looks a lot cleaner.[/QUOTE]
kogitsune already made a tutorial on this a few weeks ago, but the thread died right away :/
Explain how to run functions when clicking/changing values of controls instead of console variables.
I agree with jA_cOp, you don't have to use loops but it would be a good idea to show how its done. I secretly can't stand multiple blocks of code which look the same.
Good tutorial and images and everything.
Very extensive tutorial, nice job.
@jA_cOp - That was over two months ago, but here's the thread: [url=http://forums.facepunchstudios.com/showthread.php?t=491084]LINK[/url]
Nice tutorial.
[QUOTE=Kogitsune]Very extensive tutorial, nice job.
@jA_cOp - That was over two months ago, but here's the thread: [url=http://forums.facepunchstudios.com/showthread.php?t=491084]LINK[/url][/QUOTE]
Probably died since it didn't have any fun pictures
Bookmarked, good tutorial.
Sorry, you need to Log In to post a reply to this thread.