Panel.SetSkin Question

Hi.

Can anybody tell me how to use Panel.SetSkin function ?

[lua]
function Derma_Test()

Derma = vgui.Create(“DFrame”)
Derma:SetSize(100,100)
Derma:Center()
Derma:SetSkin(“TESTSKIN”)

end
[/lua]

I put the TESTSKIN.lua, to garrysmod/lua/skins

Try putting that in the lua autorun folder, not the derma skin folder. The folder should be garrysmod/lua/autorun if its not there create it yourself. Then to run the function type lua_run_cl Derma_Test() into the console while playing. That should get it working if its coded correctly.

Thanks i give a try

[editline]31st December 2010[/editline]

It don’t work. It use the default derma skin. Not the modified.

Where did you put the file containing the skin? It should be in the garrysmod/lua/skins folder you originally stated, and the function should be in autorun. Sorry if I caused any confusion.

-snip-

The derma skin is in garrysmod/lua/skins
My derma.lua which has the code thaht i wrote is in garrysmod/lua/autorun

It needs to be in lua/autorun/client unless you wanted to AddCSLuaFile it in a if SERVER else check. Otherwise it’s not actually getting called.

[editline]31st December 2010[/editline]

As in for the derma.lua

It makes the dframe, but with the default skin.

Did you even read what I said?

c-unit is an idiot.

Garry intentionally broke derma skins so only the standard one works, you should take a look on
http://www.garrysmod.org/img/?t=dll&id=103807
.

Otherwise you gotta overwrite each panels paint function.

SetSkin works fine, however the skin has to be included on the client (like any other cl script) otherwise it won’t work.

eg:
[lua]
//Init.lua
AddCSLuaFile(“myskin.lua”)

//cl_init.lua
include(“myskin.lua”)
[/lua]
C-Unit had the right idea, it just needed extending.

Oh God Thank You !
Happy New Year to Everyone.
Thanks for help