|
Allan Monday
Registered User
Join date: 29 Jan 2009
Posts: 17
|
02-11-2009 23:40
Hi ya'll, maybe somebody could give me a push in the right direction here. I was wondering if there was a way to make a object synchrinize a channel it listens to with a remote unit. For example 2 RC Cars with two different Remotes rez it press a synch button on a HUD and than it would listen to that given channel. If this all makes no sense I appologize but it's 12:39 am and im fighting with this Idea the whole day without any result. Cheers Allan
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
02-12-2009 01:04
have the remote rez the RC with a random channel number as the start parameter, retrieve that in the car an use it for the listen http://wiki.secondlife.com/wiki/LlGetStartParameter
_____________________
| | . "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... | - 
|
|
Allan Monday
Registered User
Join date: 29 Jan 2009
Posts: 17
|
02-12-2009 04:10
See my problem is that I can't figure out how to make it rez with a random channel. But thanks for the advice that brings me a little closer o my goal I gotta admit I am a bloddy Beginner with scripting but I try.
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
02-12-2009 05:25
You'll need to use the LSL function "llRezObject" to rez the object in the first place, and pass a channel number in as the last parameter to that function. See this page for more info: http://www.lslwiki.net/lslwiki/wakka.php?wakka=llRezObject
|
|
Allan Monday
Registered User
Join date: 29 Jan 2009
Posts: 17
|
02-12-2009 07:45
But how can I get it so that the channel number is randomly generated each time I rez a new one?? Or do I simply miss the point here
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
02-12-2009 08:41
You can generate a random number using llFrand. For example, something like this might do the trick: integer channel = (integer)(llFrand(1000000) + 1) * -1;
You then store that channel in your rezzing object so it knows which channel to communicate on, and pass it into the llRezObject function.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-12-2009 10:52
For random negative channels to use between scripts, I often use a function that looks like this: integer randomNegativeChannel() { return 0x80000000 | (((integer)llFrand(1<<15)) << 16) | (integer)llFrand(1<<16); }
That should do a fairly good job of generating a number between -1 and -2^31. You can't simply use one call to llFrand() if you want to take advantage of the whole range because llFrand() only has a resolution of I think 24 bits.
|