Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

HELP: How can I make a non-physical object push another?

Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-22-2005 00:49
Hello there,

Thanks to all, I learnd and became able to make a simple up-and-down object.
/54/27/38963/1.html
Now I want to be on the next stage.

What is a simple up-and-down object?
1.If you tauch A, it moves up 1m.
2.If you touch A again, it moves down 1m.
CODE

1[ A ]
==> ==>
[ A ] 2[ A ]

Now I prepare the same two objects, A and B. And A is on B.
CODE

[ A ]
[ B ]

1.If you touch A, it moves up normaly.
2.And thereafter if you tocuh B, it also moves up normaly.
3.But both A and B are in up state, if you touch A, the both must move down.
4.Of course, you touch B at first, the both must move up.
CODE

1[ A ] [ A ] [ A ]
2[ B ] 4[ B ]
==> ==> ==> ==>
[ A ] 3[ A ]
[ B ] [ B ] [ B ]

I looked through the Wiki to work out above and found the Collision event.
But it seems to be available if those objects are physical. I think those
movings are not for physical though.
And even if Collision event is available, I have no idea how to make both of
two objects move. How should I think to accomplish this?
Anyone, please help me.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-22-2005 01:04
There are many ways to do what it is you're asking. Here are two examples of functions that would be of use to you:

http://secondlife.com/badgeo/wakka.php?wakka=llListen
http://secondlife.com/badgeo/wakka.php?wakka=llVolumeDetect
_____________________
---
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-25-2005 17:11
Thank you Jeffrey all the time.


hmm... lllisten.
I guess you wanted to say that the two objcets should have a
conversation with each other.
"Excuse me, but I'd like to move there. Can you step back 1m?"
"Sure."
I'll try it after solving the following problem.


hmm... llVolumeDetect.
I'm sticking with this function.

llVolumeDetect(TRUE);
llSay(0, llDetectedName(0) + " bumped me!";);

The objects didn't say anything when they were knocked together,
but they said, "Seagel Neville bumped me!", when I tackled them.

hmm... I thought that I needed more experiment.
I wrote a script which the objcet moved for keeps because I wanted
to put llVolumeDetect's activity to the test. But I encounterd
another problem...:D

/54/89/39979/1.html#post429648
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
03-26-2005 11:45
i did something simular with a prize grabbing machine,
i used volumedetect and say detectedkey on collision then in the listen
if (msg==llGetKey()) {prize=TRUE;}
this way the said collision key matches the getkey of itself
-LW
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
04-20-2005 09:02
Hello there,

I disinterd my old thread from the soil and came back here ;)
Lightwave, thanks for your response :)
I realized, however, that I couldn't use not only collision event
but also llVolumeDetect for my purpose. So I decided to make them
always announce when each object moved.

First, I want to line up objects like this
CODE

[a3][b3][c3]
[a2][b2][c2]
[a1][b1][c1]

And my script is like this
CODE
integer on = TRUE;

default
{
state_entry()
{
llListen( 0, "", NULL_KEY, "" );
}
touch_start(integer total_number)
{
if(on)
{
llSay(0, llGetObjectName() + " up");
//I end up changing this channel
llSetPos(llGetPos() + (<0,0,1> * llGetRot()));
on = FALSE;
}
else
{
llSay(0, llGetObjectName() + " down");
//I end up changing this channel
llSetPos(llGetPos() - (<0,0,1> * llGetRot()));
on = TRUE;
}
}
listen( integer channel, string name, key id, string message )
{
if(on == FALSE)
{
if( message == "a3 down" ) //This script is confined to object "a2"
{
llSetPos(llGetPos() - (<0,0,1> * llGetRot()));
on = TRUE;
}
else
{
}

}
else
{
if( message == "a1 up" ) //This script is confined to object "a2"
{
llSetPos(llGetPos() + (<0,0,1> * llGetRot()));
on = FALSE;
}
else
{
}
}
}
}
Well...this script is confined to each object as you see because
I can't deal with above and below objects' names well. At least, I want
to use the same script on lines, that is, the same script on [a1], [b1],
and [c1]. Does anyone have any idea? I appreciate any help.