Results 1 to 12 of 12
  1. #1
    abb1995's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    27
    Reputation
    10
    Thanks
    1
    My Mood
    Bored

    Help with script

    Hey guys, so im working on a web browser script just to practice with lua and ive run into a problem.
    I tried to make a back button but when i click on the button it gives me this error -
    [ERROR] lua/webbrowser.lua:60: attempt to call method 'HTMLBack' (a nil value)
    I looked at the gmod lua wiki and the method it showed for going to the previous page was Panel:HTMLBack(), yet it still give me this error
    Here is my code for the main frame, html page, and the back button.

    Code:
            local Web = vgui.Create( "DFrame" )
    	Web:SetPos( 50, 50 )
    	Web:SetSize( ScrW() - 90, ScrH() - 90 )
    	Web:SetTitle( "Web Browser" )
    	Web:SetVisible( true )
    	Web:SetDraggable( true )
    	Web:ShowCloseButton( true )
    	Web:MakePopup()
    
    	HTMLTest = vgui.Create( "HTML", Web )
    	HTMLTest:SetPos( 25, 50 )
    	HTMLTest:SetSize(ScrW() - 125, ScrH() - 150 )
    	HTMLTest:OpenURL( HomePage )
            
            BackButton = vgui.Create( "DButton", Web )
    	BackButton:SetSize( 50, 24 )
    	BackButton:SetPos( 24, 24 )
    	BackButton:SetText( "Back" )
    	BackButton.OnMousePressed = function()
    		HTMLTest:HTMLBack()
    	end
    If anyone could help with this it would be much apprieciated.

  2. #2
    Wasps's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Posts
    11
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    Generally when you get nil value errors its because something doesn't exist.
    Last edited by Wasps; 06-29-2013 at 10:28 AM.

  3. #3
    abb1995's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    27
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    No, i made HTMLTest a vgui and then used that for the HTMLBack. Should'nt it work just like HTMLTest:SetPos and the other ones?

  4. #4
    Wasps's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Posts
    11
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    Obviously not.
    To be honest I don't know exactly why it's not working, I have never bothered making a web browser within gmod apart from a generic webpage that redirects.

    But that error basically says that HTMLBack() doesn't exist.
    And it doesn't help that you are using the maurits wiki to learn outdated forms of web stuff for gmod.
    Last edited by Wasps; 06-29-2013 at 10:49 AM.

  5. #5
    abb1995's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    27
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    well its one of the methods listed here:
    maurits [DOT] tv/data/garrysmod/wiki/wiki.garrysmod [DOT] com/index01b1 [DOT] html
    the only reason i can think its not working, is that the method was changed in gmod13 like some other things and the wiki hasnt updated it yet.

  6. #6
    Wasps's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Posts
    11
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    Maurits will never be updated, it's a cache of the old wiki.
    And you are out of luck if that's the case, the new wiki doesn't even mention HTMLBack()

    To be honest if you want to learn Lua i'd suggest sticking to simpler things.

  7. #7
    MeepDarknessMeep's Avatar
    Join Date
    Aug 2012
    Gender
    female
    Posts
    725
    Reputation
    22
    Thanks
    922
    Could always store the webpages you have visited in a table. ;P

  8. #8
    abb1995's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    27
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    yea thats what im going to do, i just need to do some more reading on tables they are a bit confusing to me atm

  9. #9
    LordOfGears2's Avatar
    Join Date
    Jun 2013
    Gender
    male
    Location
    /home/lord/
    Posts
    278
    Reputation
    32
    Thanks
    55
    My Mood
    Inspired
    Quote Originally Posted by MeepDarknessMeep View Post
    Could always store the webpages you have visited in a table. ;P
    That would make sense, but the method to get URLs I think is broken too, and the new wiki is shit. It doesn't list the methods you can use.

    Edit: To clarify, is doesn't list the Panel.Html methods (That I can find)

  10. #10
    tyguy550's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    74
    Reputation
    10
    Thanks
    11
    My Mood
    Happy
    Just store the web pages in a table, when the back button is clicked, go to the last item in the table?

  11. #11
    LordOfGears2's Avatar
    Join Date
    Jun 2013
    Gender
    male
    Location
    /home/lord/
    Posts
    278
    Reputation
    32
    Thanks
    55
    My Mood
    Inspired
    Quote Originally Posted by tyguy550 View Post
    Just store the web pages in a table, when the back button is clicked, go to the last item in the table?
    And please, tell me how to get the current URL. The method listed in the old wiki does not work (That I can manage) and the new wiki doesn't list the methods

  12. #12
    abb1995's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Posts
    27
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    Quote Originally Posted by LordOfGears2 View Post
    And please, tell me how to get the current URL. The method listed in the old wiki does not work (That I can manage) and the new wiki doesn't list the methods
    I made a variable called CurrentPage and whenever you enter a url and click go or hit enter, it gets the value of the text box and stores it into CurrentPage, it also sets the CurrentPage whenever you click the home button to return your homepage.

Similar Threads

  1. Help with scripts
    By zkkaiser in forum DayZ Discussion
    Replies: 15
    Last Post: 01-21-2013, 11:50 PM
  2. Need A little help with Scripting, bot
    By kagome in forum Vindictus Help
    Replies: 4
    Last Post: 07-23-2011, 08:23 AM
  3. Help with scripts
    By Deceber in forum RuneScape Discussions
    Replies: 5
    Last Post: 11-17-2010, 04:41 PM
  4. help with script
    By rangg in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 8
    Last Post: 11-04-2010, 09:36 AM
  5. Help with script.
    By Joshcarr2006 in forum Visual Basic Programming
    Replies: 2
    Last Post: 03-24-2010, 11:43 AM