Showing posts with label LSL. Show all posts
Showing posts with label LSL. Show all posts

Tuesday, August 12, 2008

Touch me Baby!

I've talked about Gwyn before, she's incredible, but she shows how scripting will change soon and become even more low prim. Yay low prim.... I love this coming down the pipe.

Tuesday, July 15, 2008

Library Scripts - Anim Smooth

So back to scripting, the first script we're going to look at in the library, which is what everyone has in Second Life, is anim Smooth. This was written by Doug Linden at Linden Labs and it's a clever little script that has more uses then are first apparent. It's a simple script, basically it does one thing as soon as you rez the object or implement the script and that is to animate the texture on all the sides of the prim making it scroll across them. Here's the script:

// anim SMOOTH Script

// By Doug Linden
//
// If you are interested in scripting, check out
// the Script Help under the help menu.
// The double slash means these lines are comments
// and ignored by the computer.
// All scripts have a default state, this will be
// the first code executed.
default
{

     // state_entry() is an event handler, it executes
     // whenever a state is entered.
      state_entry()
     {


     // llSetTextureAnim() is a function that animates a texture on a face.
     llSetTextureAnim(ANIM_ON SMOOTH LOOP, ALL_SIDES,1,1,1.0, 1,0.25);
     // animate the script to scroll across all the faces.


     }
}
So this script basically does the one function llSetTextureAnim. Taking a look at the lsl wiki, or hovering our mouse over the command in the script window if you are in Second Life gives us the arguments for the function:

llSetTextureAnim(integer mode, integer side, integer x_frames, integer y_frames, float start, float length, float rate);
So, we can do some interesting things with this, the first part that I messed with was the rate, which in the script of the library is the final 0.25 number. Changing that to .05 and using a water texture gives a very nice effect of waves moving across the prim, very basic but effective. Changing the ALL_SIDES parameter lets you choose which side of your prim actually has animation which can also be extremely helpful. So right away we have some decent uses for this script, but what about exploring further into possibilities. If you look at the wiki it give you all sorts of options. You can rotate the script, which is great for a steaming culdron effect and I've used to make witches pots over fires for halloween. You can make it zoom in and out. If you're really clever you can even make true animations by using the old flip book trick. This is much more advanced requiring you to make a texture divided into multiple parts with each frame of animation right above one another and I'm not going to get into it here. My point is that the resources for very advanced content creation is given to all of us if we explore a bit.
 
Other parts of the library can be equally as fun, check it out yourself.

Tuesday, July 8, 2008

Explorations in the Library.... scripts.


So I thought it'd be a good idea to take a look at the default stuff Linden Labs includes when you first start Second Life as a brand new avatar. They occasionally change and update this stuff but everyone has it. It's called the library and it's a seperate folder in your inventory underneath your main inventory. You can't change anything in it but you can make a copy and make changes to that and save it in your main inventory. The part that most people in the blogosphere (Geez, what a word.) have neglected to talk about is the scripts. Maybe that's because there are only three. However they are incredibly useful little scripts, especially from the standpoint of seeing how certain things happen. In fact, remember when I couldn't find the merry-go-round that I wanted to point to as an example of how I got the Codex Scope to spin? The rotation script in the library is how you do that. Over the next few posts I hope I get a chance to look at these scripts in a bit more detail and show how they apply to what you can build. However, it's a great idea to really look at everything in the library because it's a great starting point, it's a bit basic sure, but you get to see how things have been built and there's no reason not to learn from people who've already invented the wheel.

Wednesday, May 14, 2008

Codex the second Chapter...

So where were we before I got my car wrecked and life happened? O yes, telescopes... Up above you can see what I finally ended up with. I had discovered that making the telescope actually take over the client viewer wasn't going to be very workable, possible, but not workable. So I kept looking. For inspiration I was looking at Hubble Telescope images and I thought, wouldn't it be cool if this is what you saw when looking through the scope? So I set out to discover a scripted way of making the pictures on a prim cycle. I'd seen this done before so I knew it was possible. This is when I discovered the lsl wiki.

What'dya know, there's a script funtion that does exactly that called llSetTexture. The example in the wiki does all sides of the object, well, that won't work because I don't want the back of the cylinder inside the telescope to show the stars, I want it mostly transparent so that if someone is being silly and looking through the wrong end they can see who's looking up at the stars. So, since ALL_SIDES is the variable that obviously controls that, let's try telling it which side to rotate textures on... trial and error time.

I finally figured it out and created a workable slide show frame! I put that in my back pocket and I sell it in my shop as a photo frame. It takes the inventory of the object and cycles through the textures. I uploaded a bunch of images from NASA that are in the public domain and built the 'lens' of my scope. After that it was just a matter of building a cool looking telescope around the frame. I used textures I really like, made em shiny and had a working telescope. Time to put it in a dome for the building. Which I did with the 'small scope' first. Well, yeah, that worked... but I really want a scope that rotates, so that it would look cooler.... how do I go about that? I think I saw a merry go round.....

Next time: no carousel horses for me... Who names a horse Tom?

Wednesday, April 23, 2008

Codex the first Chapter

It was a dark and stormy night.... when our story begins....

Wait....

At the time I started building the Codex I was in a bit of a funk, I'd done the castles, I'd messed around with some modern buildings and variations of my castles by doing Tapestry and Sandra's Place. But I hadn't done anything I wanted for me for awhile. I was in a creative funk. Yes I'd found some amazing design partners and the 'group' part of my business name was finally something of a reality but I wasn't sure what I wanted to do next creatively. So I decided again not to worry about my customer's or percieved market placement and to just design what I wanted to live in. No worry about prim limits because at that point I had nearly a half sim in land holdings, no worry about pleasing anyone else with trade offs between quality and practicality, this was going to be a build for me.

One of the problems with creative people, and me especially is we are super hard on ourselves. Remember that graphic tablet I got for my birthday? (Two months ago now.) Know why you don't see me selling clothing yet? It's because I keep throwing my efforts out as not being high enough quality wise. One of my jobs as the 'manager' of IDG is to convince our designers that it's "good enough to release" and in turn have them tell me the same thing. It's part of why I like having the loose confederation of really good people that I've got. Besides the fact that many of them have become family.

So why the aside? Because this build is really about making it so I didn't see anything that jumped out at me as needing 'fixing.' Now this is truly impossible, but most of my builds, even the ones everyone loves, when I put them down, my eye jumps to something I need to 'fix' or improve upon, even if nobody else will notice. This build I was going to take my time on and not worry about any deadlines or anything else, it was going to be realistically 'perfect.' I didn't know what I really wanted to build but my favorite genres of writing have always been sci-fi and fantasy, (No they aren't the same thing.) and one of the series that off and on I think about is one that puts a naturalist (early scientist) in a fantasy setting. (The name of the series escapes me at the moment and I'm not near my storage facility with my books so you're all out of luck.) This appealed to me and I thought about a mix of science and magic. Maybe something along the lines of the early alchemists? I was at the time also reading QuickSilver by Stephenson (Amazing series, highly recommended.) which influenced my thoughts I'm sure.

So an early alchemist would be interested in the stars and formations and such. So they would be using telescopes. I started looking on SLX for telescopes and to my surprise there were not many, and none were functional. Aha, an opportunity! I started messing around with LSL to see if it was possible to take control of the camera and zoom it far away when someone sat on something as a proof of concept for the telescope. Turns out it is, but you have to know the region coordinates of the place you want to zoom to, and since I didn't know where I was going to rez this that wasn't workable... o what to do what to do?

Turn in tomorrow to hear part 2.... dum dum dum.


(That's what we call a cliffhanger. Snoopy would be proud.)

Friday, April 11, 2008

I'm a Scriptwriter! I work on my computer....

Work sucks. Seriously, I can't do anything except write blog posts, respond to email, look busy when the boss walks by.... you know, sucks. But this helps right here...



So what you and I need as enterprising young scripters, willing to slave long and hard to make a name for ourselves in this brand new world building bots and things and widgets and guns and swords and ghosty doors and stuff. Is the ability to do it without having to be in Second Life at all. Why? Well, for one thing Second Life can be highly distracting, friends, beautiful avatars, (and victims) nice scenery.... (Although if you're going to have this problem you probably won't be saved with this tool.) And secondly it allows us to do this in an environment that is not subject to other people's equipment. Look, I love Second Life and I think they do pretty well, but if your PC goes down it's your problem, if SL goes down, you can't fix it. This allows the scripting portion of things to move offline to be worked on even if the grid comes down. In the author's own words:


"LSL-Editor is a standalone LSL (Secondlife) script editor and run-time
environment for Windows and compiles and executes LSL scripts. No SecondLife
viewer is needed nor connection to the SecondLife grid.The program is updated on
regular intervals. When the project emerges, more and more code can be compiled,
debugged, and tested outside SecondLife world."


If you're an lsl scripter this is a great tool, the ability to make scripts outside of second life with full access to the lsl wiki and the examples there? This will help you learn scripting.

Just be careful when the first life boss walks by.

Monday, April 7, 2008

Use their own tools to make a statement...

OK, I said HTML on a Prim was put to bed, and to a degree that's true. The script that I'm open sourcing is here on this blog and is open for you to use as you see fit as long as you don't take away the credit from me or sell it for yourself.

However having done that I made an improvement for those of us who aren't scripters. Many thanks to a scripter friend who I don't want flooded with project requests so I'm not giving her name but she's amazing and special and deserves major down time for the crap I give her. Together we came up with a website viewer that will click through to every site listed on the notecard in the viewer. It's a simple and effective way of showing all the blogs that you like to see. You can get it in world at my store here.

It'll cost you 1L. That's 1/3rd of a penny in real money. Why am I selling it so low? Because I want it all over SL. I want you to put your favorite Second Life sites in it and show the grid how much we help promote and sustain the metaverse world we all love, love to hate, and can't stay away from. Let's use the tools LL has given us to show them just how misguided this new trademark policy could be. We now have less then 90 days before many of our favorite sites go dark due to percieved or actual policy changes. You can read about it at NWN, or Gwyn's blog (I so wish I could write like she did, she writes what I think sometimes.) Or imagine losing SLExchange or OnRez.... this is technically possible. I've written before that I don't think they will take it this far, but they could and it's wise to show them how much it could change.

I'm not good at making funny ear-rings, or tshirts, sometimes logos are my thing. This is my stand right here... my chance to give us tools to protest in a productive, quietly insistent way. I hope you help do this with those of us who think it's nessecary. And if not, it's a damn cool little toy that I hope you enjoy.

Friday, April 4, 2008

HTML on a Prim Revisited and Put to Bed!


OK, I'm a true geek..... as you can see. I'm posting to blogger from within SL. That's me and a friend looking at this website with blogger open below, my big screen tv and video players, Tiny Empires Hud in the left.
I got my Prim script to work and I love it, but you have to be very careful with permissions, the script itself does not warn about permissions at all so you are warned.
integer site = 1;
string site1 = "http://ingmanndesign.com"; //replace with your site
string site2 = "http://slfashionality.blogspot.com"; //replace with your second site
string site3= "http://lunajubilee.blogspot.com"; //replace with your third site

default
{ // beginning of state
state_entry()
{ // stuff between this set of brackets happens when script first loads.
// or the script gets reset.
//Currently set to display the 'main' site.
llParcelMediaCommandList
([
PARCEL_MEDIA_COMMAND_URL, site1,
PARCEL_MEDIA_COMMAND_TYPE, "text/html",
PARCEL_MEDIA_COMMAND_PLAY
]);
}

touch_start(integer total_number)
{ //start of touch stuff
if ( site == 1.0 )
{ // bracket to start doing stuff if the site is 1.0
llParcelMediaCommandList
([
PARCEL_MEDIA_COMMAND_URL, site1,
PARCEL_MEDIA_COMMAND_TYPE, "text/html",
PARCEL_MEDIA_COMMAND_PLAY
]);
llSay(0, "Site 1");
site = 2;
} // bracket to end the first if statement

else if ( site == 2 ) // “else if” is what you use for the script to keep
// checking stuff in case that first if statement
// isn’t valid
{ // bracket starts the else if stuff
llParcelMediaCommandList
([
PARCEL_MEDIA_COMMAND_URL, site2,
PARCEL_MEDIA_COMMAND_TYPE, "text/html",
PARCEL_MEDIA_COMMAND_PLAY
]);
llSay(0, "Site 2");
site = 3;
} // end this else if stuff

else if ( site == 3)
{
llParcelMediaCommandList
([
PARCEL_MEDIA_COMMAND_URL, site3,
PARCEL_MEDIA_COMMAND_TYPE, "text/html",
PARCEL_MEDIA_COMMAND_PLAY
]);
llSay(0, "Site 3");
site = 1;
}
} // end of touch stuff
} // end of state


// Please note I am not responsible for anything you choose to display using this script, it is entirely possible to display items offensive or against the TOS, if you modify this script to do so know that I did not design it as such.

Thursday, April 3, 2008

HTML on a Prim Revisited.

OK, so I can't figure out why this isn't working at the moment, but they seem to have changed some things that aren't quite documented yet. It works sometimes, sometimes it dosen't. I'm revisiting the script and should have an update in a few days. Thanks for being patient everyone.

Friday, March 7, 2008

HTML on a Prim cycling web pages - perfect for blogs.

Linden Labs did a small first step towards making shared browsing in our 3d world yesterday. To do it you'll need to download the new release client, which is running pretty well on my machine. Afterwards you can do some neat stuff as a landowner that wasn't possible before, such as putting a webpage on a prim!

Here I have created a script which allows you to set up three sites, when you touch the prim it cycles to the next site. Perfect for your blogs or other things. Remember to replace the http addresses at the top of the script with your own. Happy browsing.


integer site = 1;
string site1 = “http://ingmanndesign.com”; //replace with your site
string site2 = “http://site2.com”; //replace with your second site
string site3= “http://site3.com”; //replace with your third site
default{ // beginning of state
state_entry()
{ // stuff between this set of brackets happens when script first loads.
// or the script gets reset.
//Currently set to display the 'main' site.
llParcelMediaCommandList
([
PARCEL_MEDIA_COMMAND_URL, site1,
PARCEL_MEDIA_COMMAND_TYPE, “text/html”
]);
}

touch_start(integer total_number)
{ //start of touch stuff
if ( site == 1.0 )
{ // bracket to start doing stuff if the site is 1.0
llParcelMediaCommandList
([
PARCEL_MEDIA_COMMAND_URL, site1,
PARCEL_MEDIA_COMMAND_TYPE, “text/html”
]);
site = 2;
} // bracket to end the first if statement

else if ( site == 2 ) // “else if” is what you use for the script to keep
// checking stuff in case that first if statement
// isn’t valid
{ // bracket starts the else if stuff
llParcelMediaCommandList
([
PARCEL_MEDIA_COMMAND_URL, site2,
PARCEL_MEDIA_COMMAND_TYPE, “text/html”
]);
site = 3;
} // end this else if stuff

else if ( site == 3)
{
llParcelMediaCommandList
([
PARCEL_MEDIA_COMMAND_URL, site3,
PARCEL_MEDIA_COMMAND_TYPE, “text/html”
]);
site = 1;
}
} // end of touch stuff
} // end of state



// Please note I am not responsible for anything you choose to display using this script, it is entirely possible to display items offensive or against the TOS, if you modify this script to do so know that I did not design it as such.