Soren Stormwind
Second Life Resident
Join date: 28 Oct 2004
Posts: 1
|
01-17-2005 03:37
I'm building an airlock, and a requirement of that is both doors cannot be open at the same time. At the moment i have a controller on each side of each door, each set (inner and outer doors) operating on a seperate frequency as that was my debug configuration of the script.
Without going into a deep DEEP mess of listening, I'd rather pass the variable by routing it through . . . well anything else. Honestly I'm just not as proficient as I should be with listen.
The following possibilities I've considered, but as I've been awake far too long, I haven't been able to successfully implement them.
1) llGetObjectDesc/llSetObjectDesc: This would probably be the optimal as, in some situations, I could modify the value of the variable directly.
2) Repeater: I had thought of making a repeater/router that took calls on certain channels and looked for a routing table entry and carried out a corresponding action, usually passing it on to another port. Basically a way to connect many scripts that use many different ports.
3) Direct Variable Passing: I have no idea how this would be done.
4) Creating a wider range of commands: This would take the commands from the current state of MSG_OUTER_OPEN/MSG_OUTER_CLOSE and similar for the inner doors to something more like MSG_OUTER_OPEN_INNER_CLOSE/MSG_OUTER_CLOSE_INNER_OPEN. However this seems like it would mean dealing with each possible permutation of the doors: outer open/inner closed, outer closed/inner closed, outer closed/inner closed, and their reverses, creating a set of 6 total commands and much more lengthy listen statements due to if else statements.
The code itself is set up as a 5 state door: default>closed>opening>open>closing and then it resets the script. There are listeners during closed and open steps. They listen for a message that its generated by a touch_start on the controller.
What I'm really looking for is either a new idea that I haven't discussed or some clue as to find a way to implement one of the above solutions.
|
Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
|
01-17-2005 06:50
link everything and move your doors inside the link use link messages for comms
_____________________
 tired of XStreetSL? try those! apez http://tinyurl.com/yfm9d5b metalife http://tinyurl.com/yzm3yvw metaverse exchange http://tinyurl.com/yzh7j4a slapt http://tinyurl.com/yfqah9u
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
01-17-2005 09:33
some sudo code: integer doorSafe = TRUE; integer doorOpen = FALSE;
touch_start ( integer num ) { if ( doorSafe == TRUE && doorOpen == FALSE ) { doorOpen = TRUE; llMessageLinked(LINK_ALL_OTHERS, llGetLinkNumber(), "open", llGetLinkKey () )
( 0, 0, "open", llGetScriptKey() ); door ( "open" ); } else if ( doorOpen == TRUE ) { doorOpen = FALSE; llMessageLinked(LINK_ALL_OTHERS, llGetLinkNumber(), "close", llGetLinkKey () ) door ( "close" ); } }
link_message(integer sender_num, integer num, string str, key id) { string formatedMessage = llToLower ( message ); if ( formatedMessage == "open" ) { doorSafe = FALSE; } else if ( formatedMessage == "close") { doorSafe = TRUE; } }
|
Tcoz Bach
Tyrell Victim
Join date: 10 Dec 2002
Posts: 973
|
01-17-2005 22:35
Would be very easy with listens. Don't be afraid. Much easier, and faster, than llLinkMessage (which are still so, so slow).
_____________________
** ...you want to do WHAT with that cube? **
|
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
|
01-18-2005 10:11
Link messages, slow? Wha? I use them for alpha-animation without problems. 
_____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
|
Tread Whiplash
Crazy Crafter
Join date: 25 Dec 2004
Posts: 291
|
LinkMessage...
01-18-2005 11:11
I was under the impression that link-messages were FASTER than any standard llListen() ?? The only reason I can see them being slower, is if you have a LOT of scripts on the same object, and they are all listening via link_message(), and not filtering very effectively. But you'd get bogged down with standard listen() events in that situation as well.
Take care,
--Noel "HB" Wade (Tread Whiplash)
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
01-18-2005 12:20
if he uses listens, it will require ether manual assignment to for each and every door, and or ambiguous functions to try to figure out what door works with what door. both of witch will require more work then a link set messaging.
The only reason I can think of using listens, would be if he doesn't know how or can't use link sets. He's not making an rpg system, that passes large amount of data constantly paassed between many scripts. He's just need small, short, infrequent messages. With will fire instantaneously.
|