Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Q about custom chat channels and sim crash/resets

Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
04-23-2007 14:42
Hey hi,

In building and packaging up a scripted object, I've considered using custom chat channels for each rezzed version of the object. A friend of mine said that when his sim crashed, the script reset. If this is the case, then would a custom chat channel that gets set, and assigned to a variable, get wiped out on reset? Say if I had two objects rezzed in world, and they are talking on their custom channels. If they are next to each other, wouldn't that cause problems if the scripts reset?

Also, say I'm rezzing a house using a script to position all the pieces. And let's say that I want a controller script to communicate with all the pieces to set the channel. It seems like I would want a sleep or a delay of some sort so that it would wait until all the pieces are rezzed before it trys to set a custom channel. Any suggestions here?

Finally, say I have a huge house, and I want to be able to access a control script from anywhere in the house. Since there is a 20m limit on chat, I would think that I would need multiple objects that contain the controller script. So, what if I'm inbetween these two objects - then they both respond to a chat command! Is there a method to this madness? lol

Thanks for any tips and/or feedback.
tre Zobel
Registered User
Join date: 21 Jan 2006
Posts: 55
answer
04-23-2007 15:04
From: someone
A friend of mine said that when his sim crashed, the script reset. If this is the case, then would a custom chat channel that gets set, and assigned to a variable, get wiped out on reset? Say if I had two objects rezzed in world, and they are talking on their custom channels. If they are next to each other, wouldn't that cause problems if the scripts reset?


As long as the variables are global, and you don't have it use something like llFrand or on_rez() reset it should stay the same.

To be even safer you may consider hard-coding the chat channel into the scripts.
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
04-23-2007 16:20
If a script is reset...all variables not 'hard-set' are cleared.

To protect scripts, I'll often assign a default variable to important globals...and allow user customization of them through the interface. That way, there is always a default value in the case of reset.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
04-23-2007 23:50
From: Kenn Nilsson
If a script is reset...all variables not 'hard-set' are cleared.

To protect scripts, I'll often assign a default variable to important globals...and allow user customization of them through the interface. That way, there is always a default value in the case of reset.


Yes, I agree. I always set a default global variable if needed in case of a reset. What I'm worried about is say two identical houses are setup next to each other (by a customer) and when the sim resets, and then the scripts reset, then both houses will operate on the same channel. So if they are close enough together, there would be crosstalk. Perhaps there is no way to avoid this.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-24-2007 00:56
From: Mason Kingsford
Yes, I agree. I always set a default global variable if needed in case of a reset. What I'm worried about is say two identical houses are setup next to each other (by a customer) and when the sim resets, and then the scripts reset, then both houses will operate on the same channel. So if they are close enough together, there would be crosstalk. Perhaps there is no way to avoid this.


use a notecard to store the channel information. Then on a reset reread the notecard.
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
04-24-2007 01:04
From: Newgate Ludd
use a notecard to store the channel information. Then on a reset reread the notecard.


Can my script write to a notecard?
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
04-24-2007 01:16
No! You write the notecard. Your script reads the notecard!
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-24-2007 01:34
From: Ed Gobo
No! You write the notecard. Your script reads the notecard!


As Ed states you write the notecard and update it with which ever channel you want the house to use. The script reads the notecard to set its channel number(s). You can tehn update teh notecard as required and either have teh house automatically reload (using a changed event to monitor its inventory change triggered by the edit) or manually via a menu or other user invoked means.
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
04-24-2007 05:34
Sorry about my curt response. To make up for it, here is a link to an example of reading a notecard:
http://wiki.secondlife.com/wiki/Notecard_reading
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
04-24-2007 13:56
From: Ed Gobo
Sorry about my curt response. To make up for it, here is a link to an example of reading a notecard:
http://wiki.secondlife.com/wiki/Notecard_reading



Guys - I already know how to read a notecard, and I use it for user access all the time.

Sure, it's easy to write a custom channel in an objects notecard. But you see, I want the house to generate a custom channel on it's own, when it's rezzed by the customer. Otherwise, two houses next to each other will crosstalk. I was hoping to automate it, since some customers may screw up or not change the channel themselves.

Looks like that may be the only way though. I'll have to have a channel update feature and explain the procedure to customers. I can imagine it now though, lot's of IMs saying why do the houses next to each other not work correctly. Writing to a notecard should be a built in function. PHP can write to a file, why not an Objects script. Either that, or allow database access for variable, so that they will be saved on a script crash or reset.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-24-2007 15:02
From: Mason Kingsford
Guys - I already know how to read a notecard, and I use it for user access all the time.

Sure, it's easy to write a custom channel in an objects notecard. But you see, I want the house to generate a custom channel on it's own, when it's rezzed by the customer. Otherwise, two houses next to each other will crosstalk. I was hoping to automate it, since some customers may screw up or not change the channel themselves.

Looks like that may be the only way though. I'll have to have a channel update feature and explain the procedure to customers. I can imagine it now though, lot's of IMs saying why do the houses next to each other not work correctly. Writing to a notecard should be a built in function. PHP can write to a file, why not an Objects script. Either that, or allow database access for variable, so that they will be saved on a script crash or reset.



There are a number of methods of generating a channel based on owner id or name. But that usually implies a permanent listen on that channel?
Ace Albion
Registered User
Join date: 21 Oct 2005
Posts: 866
04-25-2007 00:46
Mason, my houses set their "relay" channel (for communicating between the main control script and other house sections/potential accessories) on the first run of the user menu by the owner.

edit- to be clear, I don't ask the owner to do anything technical, just to run the menu one time before placing another house out. Just calling the menu triggers the relay channel assigment automatically on first run.

I did think about timer delays and whatnot on_rez, but honestly I think SL can't even stabilise enough to guarantee a rez in the right place, much less have the pieces respond to the command within any time delay I could think of as reasonable.

The default channel is fixed in the script, and the first-time run of the menu sends out a command for a new random channel and the other listening scripts change their listens on that order.

I'm working on a house now that's too big for chat (50m wide or so). While the easiest thing would be to get people to press ctrl-enter instead of just enter to shout for the menu on the menu channel, we all know that that simple solution isn't going to be accepted. Endless IMs will follow. My current thinking is to create one-prim touch panels that will communicate with the main control script passing along the relevant credentials and commands (such as avatar key for authority and response). It'll be encrypted to prevent spoofing. The second advantage to this, is that then people can use touch panels as well as speech to open the menu, even in regular sized houses.

I just haven't had time to work on it. I think it's funny that a single extra keypress would solve the problem, but due to the way people behave, it would never be acceptable, so instead hours of scripting work ahead :D
_____________________
Ace's Spaces! at Deco (147, 148, 24)
ace.5pointstudio.com
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
04-25-2007 15:46
Ace,

Thanks for taking the time to post a reply. I appreciate it. Definitely gives me some things to consider as I continue to develop.

Question: If two houses are next to each other, and then the sim crashes or resets, would calling your menu command send out the same random channel to both houses?
Adrian Zobel
Registered User
Join date: 4 Jan 2006
Posts: 49
04-25-2007 17:30
Your script can't write to a notecard, but there are things it can write to, including the object's description field, and the colors and textures on various sides of the prim. If the important data is written to the description (or whatever) it should be able to re-read that information whenever the script itself is reset.
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
04-25-2007 19:15
From: Adrian Zobel
Your script can't write to a notecard, but there are things it can write to, including the object's description field, and the colors and textures on various sides of the prim. If the important data is written to the description (or whatever) it should be able to re-read that information whenever the script itself is reset.


Now that is cool and clever. I'll look into it. Thanks for that tip, it just might do the trick!
Ace Albion
Registered User
Join date: 21 Oct 2005
Posts: 866
04-26-2007 00:47
From: Mason Kingsford
Ace,

Thanks for taking the time to post a reply. I appreciate it. Definitely gives me some things to consider as I continue to develop.

Question: If two houses are next to each other, and then the sim crashes or resets, would calling your menu command send out the same random channel to both houses?


I don't know if scripts reset on those circumstances, as opposed to resuming their states, but in those cases (which, lets face it, is crisis recovery time) I just advise to reset the scripts in each house before setting it up. That ensures any that snagged a command they shouldn't have will have a fresh set of ears. I do also restrict the comms to same owner on the prims, which cuts down on that. I think for landlords, paying a bit more attention to house setup is a small price to pay for buying a house once which they can rez and rent a dozen times over for free.
_____________________
Ace's Spaces! at Deco (147, 148, 24)
ace.5pointstudio.com
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
04-26-2007 16:12
From: Ace Albion
I don't know if scripts reset on those circumstances, as opposed to resuming their states, but in those cases (which, lets face it, is crisis recovery time) I just advise to reset the scripts in each house before setting it up. That ensures any that snagged a command they shouldn't have will have a fresh set of ears. I do also restrict the comms to same owner on the prims, which cuts down on that. I think for landlords, paying a bit more attention to house setup is a small price to pay for buying a house once which they can rez and rent a dozen times over for free.


Thanks again Ace. That all makes good sense. As for the copy issue, I understand why it makes sense for houses to be copyable. It's too bad there isn't a way to effectively offer non-copy versions. (I mean, I know you 'can' but it causes all sorts of problems for customers) Maybe down the line this will be possible.