The Ultimate Guide to Derma - Everything there is to know about Derma

<Empty imported post>

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:
http://code.garrysmod.com/?into=garrysmod/addons/derma/lua/vgui
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. :slight_smile:

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.

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)

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 :slight_smile:

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.