Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Two scripts in one prim: which one sees the on_rez event?

Lee Ludd
Scripted doors & windows
Join date: 16 May 2005
Posts: 243
12-03-2005 20:49
If you have two scripts in one prim, it appears that only one of the two scripts will respond to the on_rez() event. Does anybody know how to control the choice of which script will respond?
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
12-03-2005 21:05
on rez llMessage linked
other script linked_message (ect) do stuff
Ethan Cinquetti
Registered User
Join date: 5 Jul 2005
Posts: 24
12-03-2005 21:07
Hi!

That didn't sound right, so I just did a quick check...I get on_rez from every script that has an event handler in the current state, when I drag a one-prim multiple-script object from inventory.

I haven't tried rezzing such a thing from inside another object, however...

- Ethan
Lee Ludd
Scripted doors & windows
Join date: 16 May 2005
Posts: 243
12-04-2005 05:54
Thanks Ethan. I was NOT getting both scripts to respond when I dragged the prim from my inventory. However, I have found a work-around, so I think I'm just not going to try to figure out why it wasn't working for me.
SiRiS Asturias
Chaotic Coder
Join date: 27 Sep 2005
Posts: 93
Easy tester...
12-04-2005 06:12
Add llOwnerSay("Triggered 1";); to one script llOwnerSay("Triggered 2";); to the other, etc...

Each placed within the on_rez event. When you then rez the object you will get a verbal confirmation as to which states triggered successfully.

Also, check the run check box, bottom left of the script when it's open to be sure it is checked. If not, then obviously no events will be triggered from the script.

Hope this helps you in future testing. :D
_____________________
Proud founder of:
S3 - Self Storage Systems
S3storage.net (Coming Soon!)

SLBoutique.com
SLExchange.com - Find What You Need, When You Need It.

"Light travels faster than sound. This is why some people appear bright, until you hear them speak."
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
12-04-2005 07:44
Both. All scripts act as if they are the only script.
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
12-04-2005 10:02
From: Lee Ludd
Thanks Ethan. I was NOT getting both scripts to respond when I dragged the prim from my inventory.


This coudl be because one of the scripts was busy in another event, and didn't give the on_rez event a chance to fire. Events only happen one at a time... so if you have a state_entry that has a loop that goes on forever, no other events will fire.
Lee Ludd
Scripted doors & windows
Join date: 16 May 2005
Posts: 243
12-04-2005 12:26
Ah. Yes.


The script that didn't respond spends the first few moments of it's life reading lines from notecards.
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
12-04-2005 13:09
From: Lee Ludd
Ah. Yes.


The script that didn't respond spends the first few moments of it's life reading lines from notecards.
Multiple states to the rescue!
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
12-04-2005 21:07
A (tangent) note of caution:


When using on_rez with recursive object rezzing or repeated llRemoteLoadScriptPin children, occasionally on_rez WILL BREAK.

Example: an object inside an object inside an object inside... you get the idea


I've never managed to track down the bug, but I suspect it has something to do with the way a sim handles individual script states. Be advised that it does happen when stacking items past three iterations or 7-ish simultaneous llRemoteLoadScriptPin operations.

Though they may have fixed it by now.
_____________________
---