Jump to content

Remote Control for Website on a prim


Lunk Portal
 Share

You are about to reply to a thread that has been inactive for 880 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Greetings, I've been building on SL for a very long time, but only recently decided to get into the scripting portion, so my knowledge is somewhat limited to the language.

My question is this, I have a prim with a website on it, what I am trying to do is have a "home" button prim next to it to send the it back to its home page.

Years ago I had a script that did this, but I have misplaced it.

Any help is greatly appreciated!

Link to comment
Share on other sites

It's worth mentioning that there is built-in functionality in the form of a media control bar that hovers over the prim's media face  when active. You can choose between two types: one with the url bar, and another without. Both cases contain a home button that will navigate the media to a home url if specified in the media params list. You can include PRIM_MEDIA_CONTROLS, PRIM_MEDIA_CONTROLS_MINI in the list to enable the control bar without a url bar. That will allow you to prevent users from navigating to arbitrary addresses, but still have access to buttons like forward, back, and home.

Or if you'd rather not use the built-in one and prefer to have prim home buttons as you stated in your OP, then you can accomplish the task by having the prim button invoke the command to set the media params again, but only specify the PRIM_MEDIA_CURRENT_URL and the accompanying home url. The wiki page for the prim media function states that any unspecified parms will not be changed, so issuing the command again with only a new current url will update only that and leave the rest intact.

Below is a short demo. Link to prims together and drop this script into it. Clicking the 2nd link will mimic a sort of home button

// Prim Media manual home button demo.
// Link 2 prims together and drop this script into the root.

default
{
    state_entry()
    {
        llSetLinkMedia(LINK_ROOT, 0,                        // Link and side to display the media on.
            [PRIM_MEDIA_AUTO_PLAY,TRUE,                     // Show this page immediately
             PRIM_MEDIA_CURRENT_URL,"http://google.com",    // The url currently showing
             PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_NONE // Set so the control bar is not visible to anyone
            ]);
    }

    touch_start(integer total_number)
    {
        if(llDetectedLinkNumber(0) == 2)
        {
            llOwnerSay("home prim button clicked");
            // sets new current url, mimicking a home button
            llSetLinkMedia(LINK_ROOT, 0, [PRIM_MEDIA_CURRENT_URL,"http://duckduckgo.com"]);   
        }
    }
}

 

Edited by Fenix Eldritch
  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 880 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...