Pages

Monday, February 28, 2011

Let's Talk About Lag

Hi all :) I know it's been a while, but I'm back!

Ever been on SL and wonder why everything's so slow? Well I stumbled on this website that will now show you why everything sucks. So before you start slitting your wrists, check this out!

http://www.akamai.com/html/technology/dataviz1.html

Oh, I should mention that this only shows general network stuffs, SL could be having problems of their own, like the hamsters aren't running fast enough.

Saturday, November 27, 2010

Detecting A Name

Just had a quick question about detecting a name with a script. It's super easy to do, you only need one line:

touch_start(integer total_number)
    {
        llOwnerSay(llDetectedName(0));
    }

In this example I put it in a touch event, but it could also go in a collision event. You can also set things to be run by the owner of the object only by using the following snippet. Anything between the brackets will be owner only:

if(llDetectedKey(0) == llGetOwner()){

}

Sunday, September 19, 2010

The Sigil Stone


I have been asked a few times about how this is done so I thought I'd do a blog post (I need more stuff to blog about anyway, merp). I'm sure you've probably seen this kind of effect before, it's mostly used with cartoon avatars, to give them that black drawn outline look. Here's how it's done.

First take the prim you want to use for the inside, then copy it and make it slightly larger than the inside prim. Make it as hollow as it can get, then texture the outside invisible, so you can see the inside, and retexture the inside of the hollow prim.

You can do this with sculptie prims too but it's done slightly differently since you can't make them hollow. Create the two prims in the same way, so that one is slightly larger than the other. This time, on the larger prim, go to the "object" tab in the build menu, and under the sculptie texture input, select "inside out".

Monday, August 16, 2010

Setting up your own Open Sim

Well, a few months ago I had tried this and became deeply, deeply frustrated. It seemed nothing I did was working, and the situation was hopeless, so I stopped trying to set up my own Open Sim on my local machine. Yesterday however someone asked me if I ever got it working, and I told them no, but maybe I could look into it again.

So I did. Only to find that my first google search and attempt at setting it up again were successful. I love when things work out :)

Here are the instructions that I followed :

http://arianeb.wordpress.com/2010/04/14/setting-up-a-simple-open-sim-sandbox-on-your-hard-drive/

Saturday, August 14, 2010

Allow Inventory Drop

So I received a question today about making it so that someone else could add inventory to an object that is no-mod. The answer is really simple. llAllowInventoryDrop(). The parameters are either TRUE or FALSE. You can put it wherever you want in your script so that it will set to either true or false exactly when you want, like if you want it that way all the time, just set it to true in state_entry. Or if you only want it to be that way for a few seconds, put it in an event, set it to true on one line, use llSleep() to stop the script for a few seconds, then set it back to false after that.

If it's set to true, anyone can drop inventory in, any object type except for scripts. The exception to this is that scripts can be transferred from object to object if llAllowInventoryDrop() is true, but the scripts are transferred in a non-running state, meaning they either need to be compiled again, or the object needs to be saved and re-rezzed.

Monday, August 02, 2010

Skinning Cats

Well we all know there's more than one way to skin a cat. Or a less violent alternative, multiple directions to pet them. They all have their pro's and cons, like, petting a cat one way will give you a nasty static shock but also make the kitteh rub against you affectionately, and another will make it barf in your shoes. Or something. Anyway, enough about cats (mew).

Here are a few ways to do a click and drag thinger with a HUD. They all have their pros and cons.
1. Dragging out a selection box texture on a prim. This requires 2 prims, one for the actual box and one for an image under it (so you can see the box).
Pro: Looks cool and will drag a 2D selection box on the surface of a prim.
Con: Only affects the texture and doesn't move a prim. Well I guess that's not a con if you're into that kind of thing.

You can find the code for that at the LSL code receptacle on the wiki. http://wiki.secondlife.com/wiki/ClickAndDrag

2. Dragging a prim around using llDetectedTouchPos
Pros: Only uses one prim and can be dragged as far as you want in any direction.
Cons: Can only be dragged so fast because if you move your mouse off the surface of the prim, the touch event will stop and the prim won't move anymore. *Edit* Tahlie pointed out to me that the event doesn't actually stop, just that the prim isn't getting information on where to move anymore, and you can keep moving the prim if you move your mouse back over the prim.

//Written and given permission to duplicate by Tahlie Teskat
key owner;

// For move Function
vector LastTouchPos;

default {
// Reset Security
state_entry() {
owner = llGetOwner();
}
on_rez(integer rezzed) {
if (owner != llGetOwner()) llResetScript();
}
link_message(integer sender_num, integer num, string str, key id) {
if (num == 666 && str == "reset") llResetScript();
}
// Reset Security
touch_start(integer total) {
LastTouchPos = llDetectedTouchPos(0);
}
touch(integer total) {
vector delta;
vector touchPos = llDetectedTouchPos(0);
if (touchPos != <0.0,0.0,0.0>) delta = touchPos - LastTouchPos;
if (delta != <0.0,0.0,0.0>) llSetPos(llGetLocalPos() + delta);
if (touchPos != <0.0,0.0,0.0>) LastTouchPos = touchPos;
}
}
3. Using a the UV coordinates of the texture of an invisible prim to drag another prim.
Pros: can click anywhere and the prim will follow. Can click and drag without any limit on speed.
Cons: only works with 1 prim at a time (in this script's current state), requires 2 prims, doesn't always drag directly under where your mouse is (again probably just the way the script is now, it needs some tweeks.) Put this script in the root and make that prim invisible, stretch it to however large of an area you want, and link it to another object you want to drag and make sure it's under the root object.

//written by Valent1ne
default
{
touch(integer total_number)
{
vector offset = <.58,.45,0>; //this sort of random vector is the offset, you'll have to play with it to get it to work just right. At least until I figure out a better way.
vector pos = llDetectedTouchUV(0) - offset;
llSetLinkPrimitiveParamsFast(LINK_ALL_CHILDREN, [PRIM_POSITION,pos]);
}
}

Tuesday, July 27, 2010

Remove inventory

Sometimes the solution to your problem is the easiest or most obvious. Whenever someone asks me about a problem, the first thing I usually ask is the most obvious answer, the kind of thing that makes you *facepalm* because it's so simple or right in front of your nose.

Someone asked me tonight wanting to know how to get more than one script to delete, including itself. The answer was simple, have the other scripts delete first, then have the script self destruct. Remember LSL reads top to bottom, left to right. So if you have one function before the other, the one on the topmost line will run first.
llRemoveInventory("New Script 1");
llRemoveInventory("New Script 2");
llRemoveInventory(llGetScriptName());