Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Working on multiple levels

Teriki Tigerpaw
Registered User
Join date: 24 May 2008
Posts: 2
02-13-2009 20:08
Is it possible to make scripts that tell the main script what to do? (In linden script, I know you can do it in C++ XP) And if it is, HOW?

LET ME EXPLAIN

The main script has these variables:

Y - (This controls the time that it will Spin)

Y's Default is 30 seconds, so it'll spin for 30 seconds

---------------------

+Main Item+
|
Contents
|
+2 Secondary items+
|
Both have a script in the contents


Now, lets say I'm plopping in an item that has a script that says to add 30 more seconds to the spin time. So, because the timer is a variable, I can easily say "Y += 30" or pretty much, "Y = Y + 30"

Now I can take out that script and add that script at any time, and doing so will say whether I want this object to spin for 30 seconds or 60 seconds.

BUT

I want it to be an item (Not just a script that can sit in the main contents), so that I can also have the secondary script spit out new prims (temporarily) So now lets say the other script in this example does such (spits out new prims to mess up everyone)

So now, the main script says "Hey I'm in "spin-mode"!" which tells the secondary script (in the inventory on the object) That it can spit out prims randomly... This way it doesn't spit out prims when it's not spinning.

---------------------

Again, I want these scripts interchangeable, so it means I can easily take off and put in scripts when I need to. I know you can get items linked to the main prim to talk to each other, but can you get scripts on items within the main prim to talk to each other... That is the question.

--------------------

I can easily say "check the first five inventory items ... excluding this one, and that's the 5 scripts that exist" in the main script (so if someone wanted to add 10, it wouldn't matter because the first 5 are the only ones to work)

And I can also cap off numbers, so if someone added 5 +30 seconds to the spinning, it would cap off at 120 seconds (only 3 would work)

I know how to do that, but it's the whole Main item -> secondary item + script thing where I need some help on. Because I'm not sure if I can get an item's script to contact the main script when its in an item within the main prim. (That's... a mouthful...)

I'm gonna try and show what I'm getting at again... hard to do this with text.

Main item
(Main script) --- I am item --- I am item
.............................|................|
......................... Script ......... Script
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
02-13-2009 20:33
llMessageLinked will send messages from one linked object to another linked object. All you have to do is specify which linked object to send the message to. Note that the last linked object (the root) is link number 1. So, if you only have one prim then it will be link number 1. Send messages via llMessageLinked to LINK_THIS (the same prim).

An easier way would be to just check to see how many of an inventory item type (object, notecard, etc.) there are and multiple * 30 (i.e. llGetInventorNumber(INVENTORY_OBJECT)). Simpler yet, just have the owner change the description of the prim to how many seconds you want to the delay to be and access the setting via llGetObjectDesc().

There are numerous ways to do what you want, just have to find what suits your needs.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-14-2009 09:17
But scripts in objects that are currently inside the inventory of another prim do NOT run and you cannot change their state, if that's what you were asking about. Once you rez them you can start communicating via chat and such, but not while they're dormant, so to speak.
Teriki Tigerpaw
Registered User
Join date: 24 May 2008
Posts: 2
02-14-2009 13:57
From: Hewee Zetkin
But scripts in objects that are currently inside the inventory of another prim do NOT run and you cannot change their state, if that's what you were asking about. Once you rez them you can start communicating via chat and such, but not while they're dormant, so to speak.


Yes, exactly what I was wondering about. Alright then, well noted, I'll get the scripts to work without needing the glamor then. Either that or get 2 different items to interact with each other (An HUD item to change a car's details for example... I have a working example of that...) Thanks for letting me know, didn't want to go searching the web for something that wasn't even possible X3