Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking for script that rotates when touched

Neven Hexicola
Registered User
Join date: 19 Mar 2009
Posts: 4
03-19-2009 04:51
Hello! I'm a complete noob at scripting so I'd really appreciate it if you guys could help me with this!

I've made a bunch of tiles. I want a tile to turn 90 degrees every time I touch it, so that it changes between north, west, east and south. And I still want to be able to move the tiles.

Is there a script that can do this? I've been searching on the forums but I haven't found anything (nothing that I understand anyway)
I'm willing to pay for a script that does this.

EDIT: I managed to get it rotating, but I'm not able to move the tiles around.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
03-19-2009 05:06
Are you talking about the texture on the tile or the tile itself?
Both is possible, see:
http://wiki.secondlife.com/wiki/LlRotateTexture
http://wiki.secondlife.com/wiki/LlSetRot
_____________________
From Studio Dora
Neven Hexicola
Registered User
Join date: 19 Mar 2009
Posts: 4
03-19-2009 05:15
I was thinking of turning the tile, but turning the texture works much better for what I had in mind. Thanks!

But how can I make it moveable and touchable at the same time?
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
03-19-2009 05:42
You have to be much more specific:) Mind reading is not my best.
This time, do you want to move the texture ore the prim? and what did you think should trigger that?
_____________________
From Studio Dora
Neven Hexicola
Registered User
Join date: 19 Mar 2009
Posts: 4
03-19-2009 06:11
I've made some progress thanks to Idiot Winn now. But there's still a small problem. I'll try to be more specific :)

I have one large, flat prim. It contains a script that makes it turn 90 degrees every time I touch it.

Now I want to be able to move that large prim, so I put four smaller prims on every side of the larger prim and linked them together. When I touch the prim that's on the left, I want the whole thing to move one step west. So I put a script in the smaller prims that does this

llSetPos(llGetPos() + <-0.780,0,0>;);

The problem is that when I touch the small prim, nothing happens. I assume it's because it's not the "primary prim". How do I fix this?
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
03-19-2009 06:50
try this:
CODE

default
{
touch_end(integer num_detected)
{
if ( llDetectedLinkNumber(0) == 2 ) llSetPos(llGetPos() + <0.780,0,0>);
else if ( llDetectedLinkNumber(0) == 3 ) llSetPos(llGetPos() + <0,0.780,0>);
else if ( llDetectedLinkNumber(0) == 4 ) llSetPos(llGetPos() + <-0.780,0,0>);
else if ( llDetectedLinkNumber(0) == 5 ) llSetPos(llGetPos() + <0,-0.780,0>);
}
}
Put this script in the root and nothing in the child prims.
When you touch one of the four linked prims the linked set will move in the corresponding direction.
The order of linking you must do so the directions match what you want:)
_____________________
From Studio Dora
Neven Hexicola
Registered User
Join date: 19 Mar 2009
Posts: 4
03-19-2009 07:09
Awesome! That's exactly what I wanted! Thanks :D

One final question though;

I had this in the root script

llSetRot(llEuler2Rot(<90 * DEG_TO_RAD, 0, 0>;) * llGetRot());

It's what made the root prim turn. Where can I put it so that it doesn't interfere with the rest of the script? When I touch it now, it turns before it moves, which is a little annoying.

EDIT: I figured it out. :D