Results 1 to 14 of 14

Thread: Set Tablet URL

  1. #1

    Set Tablet URL

    Does the tablet support setting it's page with code? My code is currently:

    Code:
    function spawn_rules(button, player)
        for i, object in pairs(rule_spawns[player].getObjects()) do
            if object.tag == "Tablet" then
                return 0
            end
        end
        local tablet = spawnObject({type='Tablet', position=rule_spawns[player].getPosition(), rotation=rotations[player],
                        callback='set_page', callback_owner=Global})
    end
    
    function set_page(tablet)
        tablet.setCustomObject({PageURL='http://onelivesleft.com/hexed'})
    end
    I got PageURL from looking at the tablet JSON in the save file, but before that I tried url, URL, page, etc. Nothing seems to work.

  2. #2
    It's tablet.setValue('http://onelivesleft.com/hexed')

  3. #3
    Thanks!

  4. #4
    Are there any added benefits to set the tablet's URL via scripting?

  5. #5
    Well, in this instance I'm using the tablet to display the game's rules which are on a web site. I don't want a tablet (or tablets) cluttering up the table, so I have a button that any player can hit to spawn a tablet showing the rules. My first option was to put the tablet in a bag, and pull out a clone when the button is hit, but tablets don't go into bags. My second option was to do this: spawn a tablet and then set its url. When I couldn't get that to work I put a tablet under the table, already displaying the rules, and cloned it when the button was hit; the problem with this solution is that the game asks each user if they will allow an invisible tablet to browse to an arbitrary website whenever they load the game.

    With the answer above I got the second option working. Now the game will prompt when the button is hit, which is much more acceptable.

  6. #6
    Quote Originally Posted by onelivesleft View Post
    tablets don't go into bags
    What? Of course they do. I do have one on my table :P

  7. #7
    You can put in and take out tablets from standard bags

    and you can load a tablet into an infinite bag and draw them back out.

    what you can't do is put a drawn tablet back into an infinite bag as once you've pulled it and it loads up the page (start or otherwise) The infinite bag will no longer recognise it.

    if your supper quick when you draw it will go back in but once It loads up whatever its set to display. . . its out for good.

  8. #8
    Just a side note, when I was messing around with tablet, I noticed that

    1. The "open this page" popup is annoying as hell
    2. Loading pages automatically - especially pages with sound/autoplay like Youtube - should be a criminal offense

    So whipped up this little script for my tablets spawned when you choose some option on the table:

    Code:
    function onLoad(save_state)
        self.setValue('')
        local button = {
            position = {0, 0.2, 7},
            label = 'Open tutorial video',
            click_function = 'openVid',
            function_owner = self,
            width = 4500,
            height = 550,
            font_size = 500
        }
        self.createButton(button)
    end
    
    function openVid()
        local tutURL = 'http://www.youtube.com/watch?v=PuhwSma960Y'
        self.setValue(tutURL)
        self.clearButtons()
    end
    Obviously you can easily adjust that to your needs, but most importantly it doesn't load anything on its own on load and lets players open the pre-set page whenever they want. I think it is a sane solution.

  9. #9
    Quote Originally Posted by dzikakulka View Post
    Just a side note, when I was messing around with tablet, I noticed that

    1. The "open this page" popup is annoying as hell
    2. Loading pages automatically - especially pages with sound/autoplay like Youtube - should be a criminal offense

    So whipped up this little script for my tablets spawned when you choose some option on the table:

    Code:
    function onLoad(save_state)
        self.setValue('')
        local button = {
            position = {0, 0.2, 7},
            label = 'Open tutorial video',
            click_function = 'openVid',
            function_owner = self,
            width = 4500,
            height = 550,
            font_size = 500
        }
        self.createButton(button)
    end
    
    function openVid()
        local tutURL = 'http://www.youtube.com/watch?v=PuhwSma960Y'
        self.setValue(tutURL)
        self.clearButtons()
    end
    Obviously you can easily adjust that to your needs, but most importantly it doesn't load anything on its own on load and lets players open the pre-set page whenever they want. I think it is a sane solution.
    I'm not sure if I'm doing this right, but I added that script to the GLOBAL section, and hit SAVE & PLAY but it didn't work. What am I doing wrong? I don't see the button anywhere. I have tried messing with the position values and still can't find the Open tutorial video button.

  10. #10
    @lavie
    Put that script directly on a tablet

  11. #11
    Thanks that works great!
    Last edited by lavie; 07-01-2017 at 04:10 PM.

  12. #12
    So if a player clicks on this, would other players be able to see/hear it as well? Or just you?

    Also is there a way to add to this script. Let's say I want to have multiple youtube links. I want to be use this as a music jukebox device... so everytime you hit the button, it will automatically and randomly select one of the youtube links to play from... how would you modify this script to do that? Kind of like a shuffle play...

  13. #13
    Quote Originally Posted by lavie View Post
    Are there any added benefits to set the tablet's URL via scripting?
    Most definitely. If you can set the URL then you can do things like TTS. I working on this right now. I have a framework which has multiple macro buttons from the characters. When one is clicked, I am going to get the speech associated with that macro and switch the URL on the tablet to a Text-To-Speech website which allows provision of the text as part of the URL. This way I don't need to pre-record audio for all my macros and I can change the speech content at will.

  14. #14
    Here is the Text To Speech Workshop based on setting the tablet URL...

    [url]https://steamcommunity.com/sharedfiles/filedetails/?id=1830643762[/url]

Similar Threads

  1. Tablet sound
    By Stoerfaktor in forum Suggestions
    Replies: 1
    Last Post: 05-23-2017, 09:25 AM
  2. Tablet Volume
    By Mark in forum Suggestions
    Replies: 3
    Last Post: 06-08-2016, 05:36 PM
  3. Tablet without a bezel
    By BrashFink in forum Suggestions
    Replies: 2
    Last Post: 01-17-2016, 02:00 PM
  4. Tablet geo-ip bug
    By FurbyFubar in forum General Discussion
    Replies: 0
    Last Post: 09-13-2015, 08:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •