Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

[Newbie] - Creating, and then removing the created objects

Lola Leeeroy
Registered User
Join date: 6 Apr 2009
Posts: 6
04-06-2009 13:30
I have relatively decent knowledge in Java and C, however I'm quite new to LSL, having only done a few crach course tutorials earlier today. I'm at the point where if an avatar touches an object, the object will spawn several objects in the inventory above the original object using llRezObject.

However, this is where the simple tutorials tend to disappear and become harder to find. I'm working on a simple multiplayer game, and I want the objects to be spawned (or rezzed), and then be removed from the world one by one every time the user touches that object; this is so I can get started on converting my Java created game into LSL.

It's a simple problem, however after hours of tinkering, I'm yet to find a way of doing it.

Can anyone help?

Many thanks.

EDIT: Sorted it, thanks for the help everyone!
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
04-06-2009 13:41
Use llDie() in a touch event
See;
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llDie
and:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=touch_start
_____________________
From Studio Dora
Lola Leeeroy
Registered User
Join date: 6 Apr 2009
Posts: 6
04-06-2009 13:46
I did look into using llDie, except I couldn't really find a way of getting it to delete just one instance of an object. Wouldn't you need to use a parameter, or am I just overlooking something horribly obvious.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-06-2009 13:49
if it's all linked you might want to break the link to the specific piece and llDie it in the changed event (CHANGED_LINK & (llGetNumberOfPrims() = 1))
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
04-06-2009 13:50
i guess lola wants the spawned objects to disappear when the original object is touched. In this case, you'd use a chat message and have the spawned objects listen to these messages and then use llDie() within them.
Means: new object is spawned -> init llListen -> original object is touched -> original object says "object 1 die" -> object 1 hears the message and llDies....
Lola Leeeroy
Registered User
Join date: 6 Apr 2009
Posts: 6
04-06-2009 14:23
Thanks for the input guys, I'll give it another look in a few minutes.
Lola Leeeroy
Registered User
Join date: 6 Apr 2009
Posts: 6
04-06-2009 15:35
I looked into using the llSay and llListen commands, it seems to make the most sense to use these, except for some reason they won't work at all for me. Can anyone point out if I'm doing anything wrong?


Original object:

state_entry()
{
llRezObject("object1", llGetPos() + <0.0,-1.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
}
touch_start(integer total_number)
{
llSay(100, "deleteObject1";);
}

object1:

state_entry()
{
llListen(100, NULL_KEY, "", "deleteObject1";);
}
listen(integer channel, string name, key id, string message)
{
llDie();
}

I got the code from another tutorial, but I'm half expecting the LSL to have been updated/changed since then.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
04-06-2009 16:01
From: Lola Leeeroy
I looked into using the llSay and llListen commands, it seems to make the most sense to use these, except for some reason they won't work at all for me. Can anyone point out if I'm doing anything wrong?


Original object:

state_entry()
{
llRezObject("object1", llGetPos() + <0.0,-1.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
}
touch_start(integer total_number)
{
llSay(100, "deleteObject1";);
}

object1:

state_entry()
{
llListen(100, NULL_KEY, "", "deleteObject1";);
}
listen(integer channel, string name, key id, string message)
{
llDie();
}

I got the code from another tutorial, but I'm half expecting the LSL to have been updated/changed since then.
Thats not the complete codes I take it?
But I think your llListen argument is wrong, I would prefer:
llListen(100, "", NULL_KEY, "deleteObject1";);

see: http://www.lslwiki.net/lslwiki/wakka.php?wakka=llListen
_____________________
From Studio Dora
Lola Leeeroy
Registered User
Join date: 6 Apr 2009
Posts: 6
04-06-2009 16:32
Yes you're right, that's not the complete code.

Thanks for the help and the link, I'll give it another whizz.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-06-2009 16:38
heh yup, name THEN key... and "" takes up less memory in script than NULL_KEY so it could actually be
llListen( 100, "", "", "deleteObject1" );

when in doubt of the order just hover over the function name to get the format
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Lola Leeeroy
Registered User
Join date: 6 Apr 2009
Posts: 6
04-06-2009 17:22
Whopee. I got it working like a dream.

Thanks for the help guys!