Difference between revisions of "User:Ama Omega/archive/lsl hacks"
< User:Ama Omega | archive
Jump to navigation
Jump to search
Kelly Linden (talk | contribs) (→Forms) |
Kelly Linden (talk | contribs) |
||
Line 3: | Line 3: | ||
=== llSetPrimMediaParams === | === llSetPrimMediaParams === | ||
* Use llSetPrimMediaParams to set the url and various parameters on the face of a prim via LSL. | * Use llSetPrimMediaParams to set the url and various parameters on the face of a prim via LSL. | ||
// | <lsl> | ||
default | |||
{ | |||
state_entry() | |||
{ | |||
llSetPrimMediaParams(0, // Side to display the media on. | |||
[PRIM_MEDIA_CURRENT_URL,"http://google.com", // The url if they hit 'home' | |||
PRIM_MEDIA_HOME_URL,"http://google.com", // The url currently showing | |||
PRIM_MEDIA_HEIGHT_PIXELS,512, // Height/width of media texture will be | |||
PRIM_MEDIA_WIDTH_PIXELS,512]); // rounded up to nearest power of 2. | |||
} | |||
} | |||
</lsl> | |||
=== data: urls === | === data: urls === | ||
* There is a special url type: "data:" that lets you send the html *in the url*. | * There is a special url type: "data:" that lets you send the html *in the url*. |
Revision as of 15:45, 26 February 2010
One step at a time .......
llSetPrimMediaParams
- Use llSetPrimMediaParams to set the url and various parameters on the face of a prim via LSL.
<lsl> default {
state_entry() { llSetPrimMediaParams(0, // Side to display the media on. [PRIM_MEDIA_CURRENT_URL,"http://google.com", // The url if they hit 'home' PRIM_MEDIA_HOME_URL,"http://google.com", // The url currently showing PRIM_MEDIA_HEIGHT_PIXELS,512, // Height/width of media texture will be PRIM_MEDIA_WIDTH_PIXELS,512]); // rounded up to nearest power of 2. }
} </lsl>
data: urls
- There is a special url type: "data:" that lets you send the html *in the url*.
// data:text/html,This%20is%20a%20test // TODO: how to make that work as a link in wikipedia?
llSetPrimMediaParams for data: urls
- Thus you can build arbitrary html in your LSL script and display it on the face of the prim
// example LSL
HTTP-In
- Scripts can become web servers via HTTP-In(link)
llSetPrimMediaParams for data: urls that link back to HTTP-In
- Which means you can make web pages that trigger other page views via http-in links
// example LSL
Forms
- You can put forms in data: urls
// data:text/html,<form action="http://google.com" method="GET">Search:<input type="text" name="search"><input type="submit" value="Submit"></form>
The Magic
- You can set the script HTTP-In url as the form action to get the results of the form sent back to the script
// example LSL
The Limits
- 1024 bytes per url
- llEscapeURLs means non-alphanumeric characters are 3 bytes (ouch)
- Must force another page view after form submission since HTTP-In can't generate HTML
The Tricks
- <base href="<http-in-url>/">
- Tiny urls