Derma stuff won't update

I tried many times to update my inventory menu or labels, but I always have to push my “refresh” button that simply makes the derma not visible to update it.

Is there another way to update the menu without closing it?

No

x1 Disagree

What are you trying to refresh? It’s possible.

You could set them manually? what are you setting.

I’m setting nwints and health(), but the label won’t update, it still says I’ve got “100” hp instead of 101. Also, when I add an item to my inventory
[lua]
if ply:GetNWInt(“milk”) >= 1 then
local icon = vgui.Create( “SpawnIcon”, Inventory )
icon:SizeToContents()
icon:SetModel( “models/props_junk/garbage_milkcarton002a.mdl” )
icon:SetToolTip(“Regens 15 HP”)
Inventory:AddItem( icon )
icon.DoClick = function( icon )
surface.PlaySound( “ui/buttonclickrelease.wav” )
ply:EmitSound(“player/pl_scout_dodge_can_drink_fast.wav”)
ply:SetHealth(ply:Health() + 15)
if ply:Health() >= ply:GetNWInt(“newhp”) then
ply:SetHealth( ply:GetNWInt(“newhp”) )
end
ply:SetNWInt(“milk”, ply:GetNWInt(“milk”) - 1)
end
[/lua]
it won’t show until I “refresh” the frame by hitting a button that simply makes it not visible.

theres probbably an error as your are doing stuff that needs to be done serverside on the clientside

How can I create derma skins serverside? It can’t be an error like that.

You cant create derma stuff serverside, derma is clientside and what you try to do with health needs to be serverside, use console commands

I’m not trying to modify health clientside, I’m trying to show your health clientside. It works on HUDs but it doesn’t on a derma panel.

[editline]01:32PM[/editline]

Ok got the solution for the labels, the problem is now the menu. Whenever I increase my NetWorkedInteger “name”, the icon is supposed to show but it won’t show until I update the frame.
The solution for the labels is:[lua]
local LabelSolution = vgui.Create( “DPanel”, MainPanel )
LabelSolution:SetPos( 25, 25 )
LabelSolution:SetSize( MainPanel:GetWide() - 25, MainPanel:GetTall() - 25 )
LabelSolution.Paint = function()
surface.SetFont( “default” )
surface.SetTextColor( 255, 255, 255, 255 )
surface.SetTextPos( 25, 125 )
surface.DrawText( “Current Health: “…LocalPlayer():Health()…”/”…LocalPlayer():GetNWInt(“newhp”)…"%" )
end[/lua]

Come on, you can’t give up like that. I really need this thing, otherwise, my hard work would simply fall!

So what do y need help with?

Read the thread.

Yes but you don’t explain…

@ Cubar

@Busymonkey.

:bandwagon:

Lets get back on topic and build this man an autorefreshing derma panel, come on guys, I’m sure lots of people would like this finished.

-snip-

Just realised you said without opening it.

Why not set everything in a different function such as PerformLayout?

And then just use “MyButton.DoClick = function() self:PeformLayout() end”

Mmmh, sounds good. Testing it now.

[editline]f[/editline]
Nope, it doesn’t work.
I’m using it in the DoClick function as you said, I changed self into my icon’s name because it was a nil value.
Oh well, my menu is a Q-Menu style one. So I added a ConCommand to start it then I make the player say the command when he closes the menu. The only problem is that it returns to the first tag, Char Menu… but that’s not a bad problem.
So in the end, you don’t need to close the menu by a button but simply when you stop holding the key to open it.