• Print

Author Topic: Adding Silkicons to Ulx MOTD Tabs (DPropertySheet.AddSheet)  (Read 5379 times)

0 Members and 1 Guest are viewing this topic.

Offline Hollistupid

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Adding Silkicons to Ulx MOTD Tabs (DPropertySheet.AddSheet)
« on: February 20, 2014, 05:25:05 am »
I'm confused with adding icons to the tabs in my !motd via motdmenu.lua. I've referred to this help wiki but to no avail: http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa201-2.html
I cannot seem to add the silkicons so that they show up; when trying to add "gui/silkicons/user" to lines 50-52 they either don't show up or have an error. Forgive me I'm a total noob  :P
Code: Lua
  1. ulx.motdmenu_exists = true
  2.  
  3. local isUrl
  4. local url
  5.  
  6. function ulx.showMotdMenu()
  7.         local url1 = "http://griefland.enjin.com/forum/m/20991107/viewthread/11171832-vanilla-ttt-rules"
  8.         local url2 = "http://griefland.weebly.com/donate.html"
  9.         local url3 = "http://griefland.enjin.com/forum/m/20991107/viewthread/11173322-staff-roster/page/1"
  10.        
  11.         local window = vgui.Create( "DFrame" )
  12.         if ScrW() > 640 then -- Make it larger if we can.
  13.                 window:SetSize( ScrW()*0.9, ScrH()*0.9 )
  14.         else
  15.                 window:SetSize( 640, 480 )
  16.         end
  17.         window:Center()
  18.         window:SetTitle( "ULX MOTD" )
  19.         window:SetVisible( true )
  20.         window:MakePopup()
  21.        
  22.         local tabmenu = vgui.Create( "DPropertySheet", window )
  23.  
  24.  
  25.         local html1 = vgui.Create( "HTML" )
  26.         local html2 = vgui.Create( "HTML" )
  27.         local html3 = vgui.Create( "HTML" )
  28.  
  29.         local button = vgui.Create( "DButton", window )
  30.         button:SetText( "Close" )
  31.         button.DoClick = function() window:Close() end
  32.         button:SetSize( 100, 40 )
  33.         button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
  34.        
  35.         tabmenu:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 )
  36.         tabmenu:SetPos( 10, 30 )
  37.  
  38.         html1:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
  39.         html1:SetPos( 15, 50 )
  40.         html1:OpenURL( url1 )
  41.        
  42.         html2:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
  43.         html2:SetPos( 15, 50 )
  44.         html2:OpenURL( url2 )
  45.        
  46.         html3:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
  47.         html3:SetPos( 15, 50 )
  48.         html3:OpenURL( url3 )
  49.        
  50.         tabmenu:AddSheet( "Rules", html1, _, false, false, _)
  51.         tabmenu:AddSheet( "Donate", html2, _, false, false, _)
  52.         tabmenu:AddSheet( "Staff List", html3, _, false, false, _)
  53. end
  54.  
  55. function ulx.rcvMotd( isUrl_, text )
  56.         isUrl = isUrl_
  57.         if not isUrl then
  58.                 ULib.fileWrite( "data/ulx_motd.txt", text )
  59.         else
  60.                 if text:find( "://", 1, true ) then
  61.                         url = text
  62.                 else
  63.                         url = "http://" .. text
  64.                 end
  65.         end
  66. end


Offline Eccid

  • Full Member
  • ***
  • Posts: 115
  • Karma: 11
  • Hey, come on... We just met...
    • Terror Abound! Steam Group
Re: Adding Silkicons to Ulx MOTD Tabs (DPropertySheet.AddSheet)
« Reply #1 on: February 20, 2014, 07:27:53 pm »
On your addsheets, the first _ is the emoticon and the second _ is the tooltip. So, to add the exclamation point icon and make the tooltip say "these are rules" you would do this:
Code: [Select]
tabmenu:AddSheet( "Rules", html1, "icon16/exclamation.png", false, false, "These are rules!")
This is very useful when messing with derma.
« Last Edit: February 20, 2014, 07:30:10 pm by Eccid »

Offline Hollistupid

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Adding Silkicons to Ulx MOTD Tabs (DPropertySheet.AddSheet)
« Reply #2 on: February 20, 2014, 07:40:58 pm »
On your addsheets, the first _ is the emoticon and the second _ is the tooltip. So, to add the exclamation point icon and make the tooltip say "these are rules" you would do this:
Code: [Select]
tabmenu:AddSheet( "Rules", html1, "icon16/exclamation.png", false, false, "These are rules!")

Solved! Thank you so much now my motd looks nicer than ever!

  • Print