AriosJentu Posted July 1, 2016 Author Share Posted July 1, 2016 Thank you all. But I need help with next/previous/reload page functions, I dont know, how I can realize it I will consider all your suggestions Link to comment
aka Blue Posted July 2, 2016 Share Posted July 2, 2016 You can make a table that saves the last pages you visit, like: local lastVisited = { } -- When you enter to a website table.insert ( lastVisited, guiGetText ( url ) ) -- Or lastVisited = guiGetText ( url ) And when the players clicks the last page button, set the URL to the last visited page. Keep it up, it's a very nice script Sorry for my bad English Link to comment
AriosJentu Posted July 2, 2016 Author Share Posted July 2, 2016 You can make a table that saves the last pages you visit, like: local lastVisited = { } -- When you enter to a website table.insert ( lastVisited, guiGetText ( url ) ) -- Or lastVisited = guiGetText ( url ) And when the players clicks the last page button, set the URL to the last visited page. Keep it up, it's a very nice script Sorry for my bad English Thank, Ive using tables, and inserts works correct, but not works correctly navigation from urls in table. I dont know why, bcs in theory it works good, but in practice - doesnt work Link to comment
aka Blue Posted July 4, 2016 Share Posted July 4, 2016 This sounds very stupid, but, ¿do you try to make it 'tostring'? Like... local url = guiGetText ( url ) local urlTable = tostring ( url ) table.insert ( last, urlTable ) I make this with a script that i have and it works in setting text to memo. Link to comment
AriosJentu Posted July 4, 2016 Author Share Posted July 4, 2016 This sounds very stupid, but, ¿do you try to make it 'tostring'? Like... local url = guiGetText ( url ) local urlTable = tostring ( url ) table.insert ( last, urlTable ) I make this with a script that i have and it works in setting text to memo. Again - tables works perfectly. How to make navigation with this tables? Next and previous pages, reload page. Link to comment
aka Blue Posted July 4, 2016 Share Posted July 4, 2016 I'm sorry, I did not understand very well. Now, your system works with a little memo, just save the previous url in the table and load it in the memo when you click the button I think is the easiest way to make it. Link to comment
Tails Posted July 4, 2016 Share Posted July 4, 2016 (edited) Again - tables works perfectly. How to make navigation with this tables? Next and previous pages, reload page. You can try something like this: -- define these two at the start history = {} curPos = 1 -- define these when navigating total = #history history[url] = getBrowserURL(browser) -- store the current page url -- in example function back() if curPos > 1 then curPos = curPos - 1 end setBrowserURL(browser,history[curPos]) end function forward() local total = #history if curPos < #history then curPos = curPos + 1 end end There are some mistakes here and there but you get the idea. Edited July 4, 2016 by Guest Link to comment
aka Blue Posted July 4, 2016 Share Posted July 4, 2016 Again - tables works perfectly. How to make navigation with this tables? Next and previous pages, reload page. You could try something like this: -- define these two at the start history = {} curPos = 1 -- define these when navigating total = #history history[url] = getBrowserURL(browser) -- store the current page url -- in example function back() if curPos > 1 then curPos = curPos - 1 end setBrowserURL(browser,history[curPos]) end function forward() local total = #history if curPos < #history then curPos = curPos + 1 end end Not tested sorry if I made any mistakes. Yea, something like this is what i wanna say Link to comment
AriosJentu Posted July 5, 2016 Author Share Posted July 5, 2016 Again - tables works perfectly. How to make navigation with this tables? Next and previous pages, reload page. You can try something like this: -- define these two at the start history = {} curPos = 1 -- define these when navigating total = #history history[url] = getBrowserURL(browser) -- store the current page url -- in example function back() if curPos > 1 then curPos = curPos - 1 end setBrowserURL(browser,history[curPos]) end function forward() local total = #history if curPos < #history then curPos = curPos + 1 end end There are some mistakes here and there but you get the idea. It doesnt works, i dont know why, but the same system ive created for browser, of course with browser tab navigation history, and it doesnt work. Link to comment
aka Blue Posted July 5, 2016 Share Posted July 5, 2016 ¿What doesnt work? ¿Putting the text of table or loading the page? Link to comment
Tails Posted July 5, 2016 Share Posted July 5, 2016 It doesnt works, i dont know why, but the same system ive created for browser, of course with browser tab navigation history, and it doesnt work. Well, then something is conflicting in your script or you're not doing it right. Can you show us what you have that doesn't work? Link to comment
AriosJentu Posted July 5, 2016 Author Share Posted July 5, 2016 Well, then something is conflicting in your script or you're not doing it right. Can you show us what you have that doesn't work? Main file. Line 338: Element - Cache (it is table of visited pages), element - Position (number of link in history), element - SaveInCache (when navigating from next/prev, it false, bcs no need to save link) Line 250 and 260: Event for click on buttons Next and Previous Line 445 and 448, 523 and 526: check for cache to make buttons enabled or disabled for click (like in browser) Line 462: Enabling cache saving Line 533: When loading page, insert loaded link in Cache table Line 631: Function loadWebURL have argument to saving URL in Cache Link to comment
Tails Posted July 5, 2016 Share Posted July 5, 2016 Ah, just ignore those changes on Github I wasn't paying attention to the "return false end". I will take a better look at it tonight. Apologies! Can you answer BluePie's question, though? What is it exactly that's not working in your code? Are the pages not loading or are you unable to navigate? What's happening in-game? Link to comment
AriosJentu Posted July 6, 2016 Author Share Posted July 6, 2016 Again. Doesnt work correctly moving between table links. For ex - when clicking "Back", sometimes browser thinks that previous page is first, and block this button, in forward - same. Link to comment
AriosJentu Posted July 27, 2016 Author Share Posted July 27, 2016 Maybe up this, it could be not bad. Link to comment
Tails Posted July 27, 2016 Share Posted July 27, 2016 Again. Doesnt work correctly moving between table links. For ex - when clicking "Back", sometimes browser thinks that previous page is first, and block this button, in forward - same. Yeah, I made a small test browser and I had the same issue. It seems that some of the events sometimes return more than just one page so it can make it a little difficult for you. Maybe you can look at the official webbrowser resource that comes with the MTA server, to see how they did it. Link to comment
koragg Posted October 7, 2016 Share Posted October 7, 2016 Awesome resource! Thanks so much for this Been looking for it for some time now. Link to comment
koragg Posted October 19, 2016 Share Posted October 19, 2016 So time to report bugs 1. If I go to google, I can't open any link from there (just nothing happens, I guess it's same with all external links). 2. When I open youtube and minimize MTA the sound still continues, wouldn't it be better to link it to the MTA volume and when game minimized=sound muted? 3. Maybe make it possible for each client to set his own bookmarks (admin should set one main homepage for all)? That would be cool. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now