iliveisl

 

self-contained HTML pages for Sim-on-a-Stick

17 comments

how awesome is the VW community? pretty friggin’ awesome! (yes, friggin’)  =D

Dana P. asked a scripting question to which i had no clue how to answer (if it isn’t an omega rotation or simple sit, then i am clueless!) =p

his question was how to open an HTML page in a browser from clicking an object in a Sim-on-a-Stick build. specifically, how to open a page on your machine, not one from the internet

he found out how to do it and posted how he did it and that’s another reason the VW community is awesome – people sharing what they learn =)

his solution started my little cogs to turning – this could be handy for projects where you may not want a user to get online but do want to present more detailed information, questions, activities, or whatever that may best be done in a browser

for example, our science project of Enclave Harbour could be deployed as a pre-loaded SoaS package that a student installs on their PC. then we could use Dana’s approach to launch additional info pages that were included with the Enclave-Harbour-on-a-Stick build

a specific example would be the reverse osmosis tubes in our desalination plant – there could be a “more info” icon on them that would allow a student to click and be sent to a custom HTML page or even a PDF that we create and distribute only with the stick (and thus keep fully self-contained for students)

here’s what i did:

default
{
touch_start(integer total_number)
{
llLoadURL(llDetectedKey(0), "Learn More", "http://127.0.0.1:9100/wifi/mypages/mytest.html");
}
}

the wifi folder is already defined in SoaS so i simply added a content folder for my test page. now a user could click an in-world object and launch a browser to access stick-specific files without needing an internet connection

thanks Dana! this is something to think about and certainly can add value =)

loadURL

click for full size

loadURL2

could be anything that a browser can open

Twitter Tumblr Digg Reddit Stumbleupon Delicious Facebook Plusone Pinterest Linkedin Tumblr Posterous Snailmail

written by Ener Hax

May 16th, 2013 at 11:04 am

posted in OpenSim,virtual worlds

tagged with

17 comments to 'self-contained HTML pages for Sim-on-a-Stick'

subscribe to comments with RSS or trackBack to 'self-contained HTML pages for Sim-on-a-Stick'.

  1. [...] self-contained HTML pages for Sim-on-a-Stick – may 16 supplemental non-internet HTML content [...]

  2. I’ve done something similar. In my world where I like to play I have three buttons. Two play sounds (buzzer and door bell) and the third opens my personal web site. I also have a monolith like thing that displays the current weather from weather underground.

    I want code that does a transport when touched.

    Bruce Williamson

    16 May 13 at 12:09 pm

  3. that’s pretty cool Bruce! the weather things is very clever! kind of like an active desktop =)

    by transport, do you mean like a site to site teleport within your sim? perhaps in the form of a HUD with predefined locations?

    Ener Hax

    16 May 13 at 12:23 pm

  4. Yes. I made a Stargate looking thing. I wanted it to transport within the sim to a different region. Sort of like a mass transit without clicking on the minimap or flying.

    BTW I use sim on a stick and love it thanks.

    Bruce Williamson

    16 May 13 at 12:26 pm

  5. i know that it can be done where you have various touch points on the Stargate to select where you want to go

    i have also seen them in SL where you simply walk into them and are brought to a random location (no clicking, just walk right into the gate)

    i’m no scripter but i found a few resources online (too complex for me and i’ll look a bit more)

    http://opensimulator.org/wiki/OsTeleportOwner

    http://opensim-creations.com/2011/07/06/teleporter-elevator-script/

    this next one looked interesting from reading about it anyway – a telepad system:

    http://forums.osgrid.org/viewtopic.php?f=5&t=3629&p=15999&hilit=teleport#p15999

    Ener Hax

    16 May 13 at 1:21 pm

  6. I’m truly happy that folks are picking up on this little solution for accessing Web pages on the stick, and I think more people will run with it. That’s what I’m now doing: combining a book of mine (XHTML/JavaScript) with its setting (OpenSim) that I’m building on the stick. The next step is getting a browser with a custom plugin installed on the stick so that a reader of the book on the stick can do a SLURL equivalent straight into the sim on the stick. Right now there’s chatter about having an opensim:// name to use for that, but I’m barely getting started on this angle. I’m not there just yet, and I welcome any insights!

    Add that feature to the one I found, and one will be able to go back and forth between book (on the browser) and setting (on the viewer). Shiny.

    Dana Paxson

    16 May 13 at 2:12 pm

  7. your application of OpenSim is very interesting

    also of note (or synchronicity) is that you write about science as well (even desalination) – what a small world indeed! =)

    i am deep in the throes of laying out our workbook in InDesign and, ugh, it would be so much easier if i could do it all as eLearning (i do html5, js, jquery, css, xml in Notepad for my day job)

    your application does help push the envelope and serve as an example of outside-the-box thinking for OpenSim

    that’s what Beacara did with her art catalogue on a stick

    when you get to a point where you may have some imagery and a thumbnail description of what you are doing, i would be honoured to share that with readers here

    good luck! =)

    Ener Hax

    16 May 13 at 2:42 pm

  8. Actually, each prim has the capability to serve its own webpages, even some javascript. I had a tutorial on it that was pretty popular on the old baddabean.com (not there now lol). I’ll find it, dust it off, and put it up somewhere in the next few days.

    ELQ

    16 May 13 at 8:57 pm

  9. you are correct ELQ – media on a prim (MoaP) works on SoaS if you use a suitable viewer (Imp 1.3.2 won’t work)

    this could be very handy too, if you can serve up pages that are on the stick or installed with SoaS. i have not ried it, but i suppose if you just use a URL such as

    http://127.0.0.1:9100/wifi/mypages/mytest.html

    then it will work (Apache in MoWeS needs to be running)

    so you could do something like i have in this post, but rather than point outward, you’d point to local files

    http://iliveisl.com/in-world-information-kiosks/

    Ener Hax

    17 May 13 at 8:20 am

  10. Actually, no, not MOAP – just serving it straight to the browser from the prim :)

    It works in all standard viewers, too!

    ELQ

    17 May 13 at 10:42 am

  11. dust off your old tut ELQ! i wanna see what you are talking about =)

    you’re saying you have a different technique than the one in the post?

    does it first open in the viewer browser or does yours always target a real web browser? that would be very handy

    Ener Hax

    17 May 13 at 2:17 pm

  12. oh yeah, the one in the post loads code external to the virtual world. It’s not difficult, though, it’s mainly a concept of using llLoadURL() and instead of using an http:// or file: uri, you use a data: uri. Example:

    string url; /*here we are setting the normal variables*/
    string form;
    default
    {
    state_entry()
    {
    llRequestURL(); /*when the script starts, it gets a url of its own*/
    }
    http_request(key id, string method, string body)
    {
    if (method == URL_REQUEST_GRANTED)
    {
    url = body;
    }
    else if (method == "POST")
    {
    llSay(0,"Received page request.");
    llHTTPResponse(id,200,"OK");
    }
    else if(method == "GET")
    {
    llHTTPResponse(id,200,body);
    }
    }
    touch_start(integer num) /*Touch it!*/
    {
    form = "data:text/html,";
    /*Above, we're setting the form variable to an html string, a simple form, with the action being the URL our script just got from the server in the state_entry()*/

    /* Below, is the loading of our html (or javascript, xml, ...) into the toucher's browser*/
    llLoadURL(llDetectedKey(0),"Open form?",form);
    }
    }

    And no, there isn’t a way that I know of to force the use of either browser, scripts just go by the viewer’s preferences. :)

    ELQ

    17 May 13 at 9:00 pm

  13. Tried to edit that post and i was too slow typing lol. I wanted to say that this is the same method (llLoadURL) but it’s doing something fundamentally different, in that the script itself is sending the code directly to the avatar. It’s not better, I myself use external code all the time because there are fewer constraints on string length. However, this comes in very handy when you want to do something like have a customer fill in a quick form and let your script write the setup notecard for a product ;)

    ELQ

    17 May 13 at 9:09 pm

  14. and of course, I just now noticed that the comments system took out the string that was the html for the form in the form variable lol

    ELQ

    18 May 13 at 4:44 pm

  15. very nice – thanks for the code and explanation! =)

    weird that the comment stripped out something in a code tag – i’ll check that out

    Ener Hax

    20 May 13 at 1:50 pm

  16. Hey, im building a museum with SOAS and I want people to be able to click on something and have information come up about it, but I have no idea how to do it? I can build objects/items etc quite easily but cant find any info on the scripting. Thanks

    Rtioact

    3 Apr 14 at 2:35 am

  17. Have you ever considered creating an e-book or guest authoring on other blogs?

    I have a blog centered on the same topics you discuss and would love to have you share some stories/information. I know my readers would enjoy your
    work. If you’re even remotely interested, feel free
    to shoot me an e mail.

    stocks to buy

    14 Oct 14 at 3:49 pm

leave a reply - add your thoughts

you can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>