Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 13 14 15 16 17 18 Next »
[BUG/Needs optimization]VGUI
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pages (2): 1 2 Next »
Threaded Mode
[BUG/Needs optimization]VGUI
30-06-2015, 07:49 PM,
#1
SuperPlayer Offline
TSCM Super Member
****
Posts: 234
Threads: 30
Joined: Oct 2014
[BUG/Needs optimization]VGUI
Hello!
Today i looked into the world of VGUI's. It very cool but after a few times connecting myself to the hud my Gmod is crashing. I dont know if it is a bug or i am just too stupid to find the error in my code, i dont know. Also the DoClick function doesnt work. Maybe thats the problem? Thats the code i am using:

--@name MAINFRAME_HUD
--@author SuperPlayer
--@requirecl lib/string.txt
--@updater STEAM_0:0:74694146
--@shared

if SERVER then

else
local BackTex = render.getTextureID("Boba_Fett/textures/atlantiswall_blue")
--A player has linked to us.
hook( "hudlink", "bleh", function( Ply )

local BackTex = render.getTextureID("Boba_Fett/textures/atlantiswall_blue")

local Frame = vgui.create( "DFrame" )
Frame:SetSize( 1000, 600 )
Frame:Center()
Frame:MakePopup()
Frame:SetText("Mainframe HUD")
Frame:ShowCloseButton(true)
Frame:replaceMethod( "Paint", function( self, W, H )
render.setTexture(BackTex)
render.setColor( 255, 255, 255 )
render.drawTexturedRect( 0, 0, W, H )
end )
local CloseButton = vgui.create( "DButton" ,Frame)
CloseButton:SetPos( 0,0 )
CloseButton:SetSize( 90, 45 )
CloseButton:SetText( "Close" )
CloseButton:SetTextColor( Color( 255, 255, 255 ) )
CloseButton:replaceMethod( "Paint", function( self, W, H )
render.setTexture(BackTex)
render.setColor( 255, 255, 255 )
render.drawTexturedRect( 0, 0, W, H )
end)
CloseButtonBig GrinoClick( function()
Frame:remove()
end)




end )
hook( "hudunlink", "bleh", function( Ply )

end )
end

Find
Reply
30-06-2015, 07:53 PM,
#2
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: [BUG/Needs optimization]VGUI
You're trying to draw a material designed for a 3D lit model on a 2D surface. That's why it's crashing.

As for DoClick, you're calling DoClick with a function argument, i.e. you're doing nothing.

You already have the replacement for Paint, DoClick is the same thing:
CloseButton:replaceMethod( "DoClick", function( self )
Frame:Remove()
end )
Find
Reply
30-06-2015, 07:55 PM,
#3
SuperPlayer Offline
TSCM Super Member
****
Posts: 234
Threads: 30
Joined: Oct 2014
RE: [BUG/Needs optimization]VGUI
Hmm. What can i use instead? Is there another material i can use or just no material? And how das DoClick() works?
Find
Reply
30-06-2015, 07:57 PM,
#4
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: [BUG/Needs optimization]VGUI
Why do you need a material? If you want to draw with no material, then use render.drawRect().

DoClick is called whenever you click the button. The argument passed is the button object.
Find
Reply
30-06-2015, 07:59 PM,
#5
SuperPlayer Offline
TSCM Super Member
****
Posts: 234
Threads: 30
Joined: Oct 2014
RE: [BUG/Needs optimization]VGUI
I like how material look. Ok so i just wont use it. Thx for the fast help!
Find
Reply
30-06-2015, 08:15 PM,
#6
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: [BUG/Needs optimization]VGUI
Hmm, just double checked the SF VGUI code and there is one typo which might also cause problems. I'm restarting #2 with the fix, but #1 can't load it until it restarts.
Find
Reply
30-06-2015, 08:24 PM, (This post was last modified: 30-06-2015, 08:27 PM by SuperPlayer.)
#7
SuperPlayer Offline
TSCM Super Member
****
Posts: 234
Threads: 30
Joined: Oct 2014
RE: [BUG/Needs optimization]VGUI
Ok i will try it. Because on Server #1 if i press use when the VGUI is on my screen i crash every second time.

Ok it doesnt crash anymore but if I am linked to the hud once and i get unlinked or linked, whenever i press use wherever i aim.
Find
Reply
30-06-2015, 09:57 PM,
#8
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: [BUG/Needs optimization]VGUI
Not sure what you mean by that last part. It only links/unlinks when you press use on it or sit in/get out of a linked chair.
Find
Reply
01-07-2015, 06:04 AM,
#9
SuperPlayer Offline
TSCM Super Member
****
Posts: 234
Threads: 30
Joined: Oct 2014
RE: [BUG/Needs optimization]VGUI
I mean if I spawn an HUD and i am close to it it doesnt matter where i look/aim i get linked/unliked by the hud when i press USE. Also if i spawn a SF-Screen next to it The VGUI opens for some reasons.
Find
Reply
01-07-2015, 11:29 AM,
#10
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: [BUG/Needs optimization]VGUI
You're using the standard model? The use events are controlled by the Source engine code so there's little I can do about them being overly sensitive.
Find
Reply
« Next Oldest | Next Newest »
Pages (2): 1 2 Next »


  • View a Printable Version
Forum Jump:


Users browsing this thread:
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.