Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Business Script

Bella Beleza
Registered User
Join date: 28 Jan 2007
Posts: 23
06-09-2007 22:55
Hello everyone. I have recently started a business, and I do not use vendors at the moment. Instead, I have individual "boxes" for everything I own, which are simply stands where you can buy a single item. At the moment, this is over 70 boxes. If I want to make a simple script change, I will need to change the scripts in every single one of those boxes... Which would take quite a while. Is there any way for a script to access a universal script and run that? Or is there a way to easily edit multiple scripts?
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-10-2007 02:28
Might need a little more info on the functionality of the scripts you're discussing, but some general observations:

Certainly "satellite" scripts can talk to one or more "server" scripts by various means (llRegionSay(), perhaps, if they're all in the same sim), so any changes to the "server" script functionality won't have to be made on all the "satellites." (One thing to keep in mind in the selling scenario you describe is that the money() event must be handled in the object for which you want the buyer to Pay--the "satellite" scripts in the boxes, in this case.)

You can script an object to retain only the "latest" version of a script, but depending on what a script is doing at the time of updating, you might not want that process automated. That concern applies to automated script distribution in general--anything using llRemoteLoadAccessPin()--but if your scripts have some quiescent state where it's safe to be updated, then such an approach can work.
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
06-10-2007 08:28
An alternative approach is to have the scripts updated by code.
Use llSetRemoteScriptAccessPin(SCRIPT_PIN) in the target scripts and
llRemoteLoadScriptPin (prim_key, SCRIPT_TO_UPDATE, SCRIPT_PIN, TRUE, 0);
in the base unit.
Usual caveats apply.
Bella Beleza
Registered User
Join date: 28 Jan 2007
Posts: 23
Thank You! One More Question, Though...
06-10-2007 12:03
Thanks to both of you! It turns out llRemoteLoadScriptPin was exactly what I needed. I did a test where I had a box (A) with a script that allows it to take scripts (llSetRemoteScriptAccessPin) and another (B) that had a script that would change the object's color black when clicked. Box B had a script that would give Box A that color changing script. When I clicked on Box A, it worked! Now, I know you need the key of an item to put a script into it... so how would I do this for some 70 boxes? Do I need to get the key of every one of them? Or is there an easier way to do this?
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
06-10-2007 12:16
From: Bella Beleza
Thanks to both of you! It turns out llRemoteLoadScriptPin was exactly what I needed. I did a test where I had a box (A) with a script that allows it to take scripts (llSetRemoteScriptAccessPin) and another (B) that had a script that would change the object's color black when clicked. Box B had a script that would give Box A that color changing script. When I clicked on Box A, it worked! Now, I know you need the key of an item to put a script into it... so how would I do this for some 70 boxes? Do I need to get the key of every one of them? Or is there an easier way to do this?

Unfortunately there is no way to load the SCRIPT_PIN except manually one at a time. Sad but at least after that you are home and dry, You think you have problems with 70 scripts I tried to update 121 manually and nearly gave up before I found a way of generating my prims by llRezObject ( they were all the same )
Bella Beleza
Registered User
Join date: 28 Jan 2007
Posts: 23
I think I've found a way!
06-10-2007 13:14
I see your point, but I think I just found a way to do it. First, I click on the Updater box. This box will use llRegionSay to tell all the other boxes they are going to update. All these boxes E-mail the Updater with the Subject being "Update" or some other key word. The Updater then uses llRemoteLoadScriptPin with the Address of the box that sent the E-mail as the target. The boxes will then recieve the new scripts and delete the old ones.
Jeff Kelley
Registered User
Join date: 8 Nov 2006
Posts: 223
06-10-2007 15:58
If the updater uses llRegionSay, the other boxes can use it too, and you can get rid of email.
Bella Beleza
Registered User
Join date: 28 Jan 2007
Posts: 23
Answer to Jeff
06-10-2007 16:28
Yes, Jeff, I thought of that, however, there was one problem... What if somebody says something while the update is going on? The Updater will try to give the script to that person or object, which would cause an error. The E-mail also has another sense of security: The Subject. If the Subject is "Update", then it goes on and gives the objects the script. This is in the long run actually easier than just listening for things said by objects.
Jeff Kelley
Registered User
Join date: 8 Nov 2006
Posts: 223
06-10-2007 19:24
From: Bella Beleza
The E-mail also has another sense of security: The Subject. If the Subject is "Update", then it goes on and gives the objects the script.

I assume you use a non-public, negative channel. If chat on channel -455371 is "UPDATE", there are high chances that this is one of your objects requesting an update. Chances are still higher if you encode the destination key in the message (ex: 66864f3c-e095-d9c8-058d-d6575e6ed1b8,UPDATE) and check it against receiver's key.
Jim Guyot
Tinkerer
Join date: 21 Apr 2007
Posts: 38
06-10-2007 19:44
From: Bella Beleza
Yes, Jeff, I thought of that, however, there was one problem... What if somebody says something while the update is going on? The Updater will try to give the script to that person or object, which would cause an error. The E-mail also has another sense of security: The Subject. If the Subject is "Update", then it goes on and gives the objects the script. This is in the long run actually easier than just listening for things said by objects.


Actually, using a filter in the listen event handler would also allow you to do the same type of thing.

The listen command takes a name, a key and a msg as part of its parameters. Simply filtering the listen command accordingly would alleviate use of the email calls, which tend to be a bit time delayed. For instance:

In the updater prim you would have a listen command as follows:

llListen( _SOMECHANNEL, "", NULL_KEY, "Update" );

listen( integer iChannel, string sName, key kID, string sMSG )
{
if ( llGetOwnerKey( kID ) == llGetOwner() )
{
do updates here
}
}
And then in the prim that needs an update to the script, you would put the following:

llRegionSay( _SOMECHANNEL, "Update" );

Just don't forget to put your remote data load pieces in and you are all set.
Bella Beleza
Registered User
Join date: 28 Jan 2007
Posts: 23
You're right
06-10-2007 21:31
Yes, I suppose I could do that, and I see no good reason why I shouldn't. Except I've already done the E-mail version, and it worked fine, however, your idea is just as plausible and should work just as good. Thank you all for ideas! If you'd like the scripts I have, IM me in game :) Thanks again everyone!