Derma Help/request

Alright sooo i currently need someone to script some derma for my darkrp menu.

Currently i have a tab made already all i need to do is fill that spefific tab, i’ve checked some tutorials but i couldn’t find out how to do it myself.

So basically what i’m asking is if someone could code it so it shows about 5 buttons(Darkrp style please), that direct you to a link whilst in-game. No need to add specfic button names or links, but instead just put “buttonanme” or “linkhere” so i can fill it in.
This would be a major help, thanks.

5$ and i will do it.

I would pay, but i don’t own a paypal right now so i can’t.

You are talking about browserlinks correct?

In case you do, you just need to create a button and add a function

function BUTTON:OnClick()
gui.OpenURL(URLHERE);
end

[lua]Button.DoClick = function()
gui.OpenURL(“UrlString”)
end
[/lua]
Learn your functions.

If thats it, then i’m sure i can try and make it myself.
ill post back if i need any help.

Im typing this from in the thread so just give it a try

[lua]function OpenMenuURL(url)
if (type(url) != “string”) then return false end
local Panel = vgui.Create(“DFrame”)
Panel:SetSize(ScrW()-100,ScrH()-100)
Panel:Center()
Panel:SetTitle(tostring(url))
Panel:SetVisible(true)
Panel:ShowCloseButton(true)
Panel:MakePopup()

local HTML = vgui.Create(“HTML”, Panel)
HTML:SetSize(Panel:GetWide()-20,Panel:GetTall()-50)
HTML:SetPos(10,25)
HTML:OpenURL(url)
[/lua]

Then simply make a button that does something like this.
[lua]
Button.DoClick = function()
OpenMenuURL(“facepunch.com”)
end
[/lua]

Tried that and coudln’t get it to open the url, also the button is all disfigured.
Heres what i did with what you posted.
[lua]
function MyMenu()
local MyMenuTab = vgui.Create(“DPanelList”)
function MyMenuTab:Update()
self:Clear(true)
local MyMenuTab = vgui.Create(“DButton”)
MyMenuTab:SetText(“Visit The Servers Website”)
MyMenuTab:SetSkin(“DarkRP”)

function OpenMenuURL(url) 
    if (type(url) != "string") then return false end
    local Panel = vgui.Create("DFrame") 
    Panel:SetSize(ScrW()-100,ScrH()-100) 
    Panel:Center() 
    Panel:SetTitle(tostring(url)) 
    Panel:SetVisible(true) 
    Panel:ShowCloseButton(true) 
    Panel:MakePopup() 

    local HTML = vgui.Create("HTML", Panel) 
    HTML:SetSize(Panel:GetWide()-20,Panel:GetTall()-50) 
    HTML:SetPos(10,25) 
    HTML:OpenURL(url)
	
Button.DoClick = function() 
OpenMenuURL("facepunch.com")

end	

end	

end
return MyMenuTab
end
[/lua]
Heres one i did, the button works with opening the page but it opens it up with steam one, also the button is disfigured.
[lua]
function MyMenu()
local MyMenuTab = vgui.Create(“DPanelList”)
function MyMenuTab:Update()
self:Clear(true)

local MyMenuTab = vgui.Create("DButton")
	MyMenuTab:SetText("Visit The Servers Website")
	MyMenuTab:SetSkin("DarkRP")
	MyMenuTab:SizeToContents() 
MyMenuTab.DoClick = function()
	gui.OpenURL("http://www.facepunch.com/threads/")

end	

end
return MyMenuTab
end
[/lua]

And when i say disfigured button i mean its out of place(Top left of the screen) and doesn’t even show full size of the button and text.

Because your not setting its pos

Yeah i was firgured it was something like that, but i’m just looking at the how the oter buttons are being ran in the menu in darkrp, i can’t find how they set up the position.

Let me try and fix that real quick and i’ll post back.

[lua] Button.DoClick = function()
OpenMenuURL(“facepunch.com”)[/lua]
That should be outside the function for starters and also it should be under were you set the skin, so for example.

[lua]MyMenuTab:SetText(“Visit The Servers Website”)
MyMenuTab:SetSkin(“DarkRP”)
MyMenuTab.DoClick = function()
OpenMenuURL(“facepunch.com”)[/lua]

So it should like this instead?
[lua]
function MyMenu()
local MyMenuTab = vgui.Create(“DPanelList”)
function MyMenuTab:Update()
self:Clear(true)
local MyMenuTab = vgui.Create(“DButton”)
MyMenuTab:SetText(“Visit The Servers Website”)
MyMenuTab:SetSkin(“DarkRP”)
MyMenuTab.DoClick = function()
OpenMenuURL(“facepunch.com”)

end

function OpenMenuURL(url) 
if (type(url) != "string") then return false end
local Panel = vgui.Create("DFrame") 
Panel:SetSize(ScrW()-100,ScrH()-100) 
Panel:Center() 
Panel:SetTitle(tostring(url)) 
Panel:SetVisible(true) 
Panel:ShowCloseButton(true) 
Panel:MakePopup() 

local HTML = vgui.Create("HTML", Panel) 
HTML:SetSize(Panel:GetWide()-20,Panel:GetTall()-50) 
HTML:SetPos(10,25) 
HTML:OpenURL(url)	


end

end
return MyMenuTab
end
[/lua]
correct me if im wrong lol.

It should be, but as i said i typed it from in thread so its not been tested.
Try and find out.

tested and it works perfectly, only issue now is the postion of the button. ive also noticed the other buttons in the menu move accordingly when the menu is dragged,
But my button doesn’t even move it’s acting as if its not even part of it because i see it at the top left still , even if the menu isn’t open. (want a screenie just say so)

I understand that i needed to set the postion, i even changed it but the button still doesnt seem to act like its “in” the menu like the other ones do.

[editline]17th May 2011[/editline]

Heres a screenie anyway.

[img_thumb]http://img850.imageshack.us/img850/6835/unledmwy.jpg[/img_thumb]

It needs to be patented to something.

So do:
[lua]vgui.Create(“DButton”, ParentHere)[/lua]

Thanks so much, that fixed everything!

last question though, i made a CollapsibleCategory, and made it so the dbutton should be underneath it but that doesnt work. the bother seem to collide with each other (the DCollapsibleCategory is on the bottom and the button takes place on the top)

heres some of the code…
[lua]
function MyMenu()
local MyMenuTab = vgui.Create(“DPanelList”)
function MyMenuTab:Update()
self:Clear(true)
local MyCatergory = vgui.Create(“DCollapsibleCategory”, MyMenuTab)
MyCatergory:SetLabel(“Website Links”)
MyCatergory:SetSize(740,23)
MyCatergory:SetSkin(“DarkRP”)

local MyMenuTab1 = vgui.Create("DButton", MyCatergory)
MyMenuTab1:SetText("Visit The Servers Website")
MyMenuTab1:SetSize(740,23)

[/lua]

Don’t just stock things were they go.
Everything should have a SetPos(x,y)

You really should be setting size and position using advanced arithmatics.
But that’s more advanced so just use the SetPos function.

[editline]19th May 2011[/editline]

And everything should be patented to one thing so it’s easy to position.

Well fuck, I have better things todo than knowing every single metafunction or object hook.

Also OnClick is a way more common in programming languages than DoClick, eg. Javascript.

Also have a box :3:

Alright I’ll do that then, thanks for the help science. i think i can manage finishing this on my own now.

Actaully, I’ve noticed one thing.

How can i go about adding another button right under the first one?
Whenever i do that it seems to mess it up entirely.

[lua]
local MyMenuTab1 = vgui.Create(“DButton”, MyMenuTab)
MyMenuTab1:SetText(“Visit The Servers Website”)
MyMenuTab1:SetSize(740,23)
MyMenuTab1:SetPos(5,25)
MyMenuTab1:SetSkin(“DarkRP”)
MyMenuTab1.DoClick = function()
OpenMenuURL(“facepunch.com”)

local MyMenuTab2 = vgui.Create("DButton", MyMenuTab)
MyMenuTab2:SetText("Test")
MyMenuTab2:SetSize(740,23)
MyMenuTab2:SetPos(5,15) 
      MyMenuTab2:SetSkin("DarkRP") 
MyMenuTab2.DoClick = function()
OpenMenuURL("www.google.com")

[/lua]
Menu will run if i didnt have MyMenuTab2 there, but if i do have it , everything breaks(the entire menu).

[lua]local MyMenuTab1 = vgui.Create(“DButton”, MyMenuTab)
MyMenuTab1:SetText(“Visit The Servers Website”)
MyMenuTab1:SetSize(740,23)
MyMenuTab1:SetPos(5,25)
MyMenuTab1:SetSkin(“DarkRP”)
MyMenuTab1.DoClick = function()
OpenMenuURL(“facepunch.com”)
end
local MyMenuTab2 = vgui.Create(“DButton”, MyMenuTab)
MyMenuTab2:SetText(“Test”)
MyMenuTab2:SetSize(740,23)
MyMenuTab2:SetPos(5,15)
MyMenuTab2:SetSkin(“DarkRP”)
MyMenuTab2.DoClick = function()
OpenMenuURL(“www.google.com”)
end
[/lua]

All functions need a end after you finish.