These forums are CLOSED. Please visit the new forums HERE
need help with a key card system |
|
|
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
|
02-13-2009 01:56
im trying to make a security door that opens to key card that a person is wearing. ive got a basic idea but its flawed cause anyone can open the door is someone is nearby with a key card. i want it to be 5 levels of security so yea. help would be much appreciated
|
|
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
|
02-13-2009 02:06
have the keycard identify the owner and compare that with the toucher
_____________________
L$ is the root of all evil
videos work! thanks SL ![]() |
|
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
|
02-13-2009 02:30
ok thats kindof what i thought i had to do but no clue how to do it
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
02-13-2009 02:57
If you're looking for someone to make this script for you, Scripting Tips is the wrong place to look. Try posting in "Products Wanted".
This forum is for gettting help with writing your own scripts... but we're not here to give you a free working example of the script you desire. _____________________
![]() ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura |
|
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
|
02-13-2009 03:07
thats not what im asking. giving help would be like "use this code and this code". then i have to figure out how they work an stuff.
|
|
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
|
02-13-2009 05:00
This can be done many different ways. These are some of the methods that can be used to detect the keycard and allow entry based on criteria...
llSensorRepeat (http://wiki.secondlife.com/wiki/LlSensorRepeat) llListen (http://wiki.secondlife.com/wiki/LlListen) collision_start (http://wiki.secondlife.com/wiki/Collision_start) llDetectedKey (http://wiki.secondlife.com/wiki/LlDetectedKey) llGetKey (http://wiki.secondlife.com/wiki/LlGetKey) |
|
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
|
02-13-2009 05:39
i was looking at those and thought maybe. thanks for the help
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-13-2009 08:18
How would I do it?
I'm wearing the card as an attachment, so the door can't use a sensor to detect the card, unfortunately (the card can sense the door, though, but I'm not doing it that way). This means the door and the card have to talk to each other. The door knows who's just touched it. I can grab the toucher's uuid thus: CODE touch_start(integer num_detected){The card knows who it belongs to; llGetOwner(); is lsl for "what is my owner's uuid?".We've got to find a nice obscure channel on which the door and the key can communicate. I'd be inclined to adapt this useful snippet from http://wiki.secondlife.com/wiki/DialogMenus: CODE integer channel_dialog; // top of script in variablesso that the door talks and listens on channel based not on its own uuid (as in this example) but on the uuid of whoever has just touched it. My card knows it belongs to me, so I can make it communicate on the same channel by adapting the snippet slightly differently to use my uuid. Then, if someone touches the door, the door can work out what channel to use and then say, "any cards around belonging to the av who has just touched me?" or words to that effect and start listening for a reply. If it gets a positive response in the next few seconds, it shuts down the listener and opens the door, and if it doesn't it just stops listening and waits for the next customer. |
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-13-2009 08:43
I've done this one before. On interesting events (touch, etc.) have the door send out a general query on a common channel. If you really want secure, you could include some random data that the door remembers, so outdated replies can't simply be re-used.
Have all nearby cards take the door's query, add some kind of passcode, hash the result, and add it and the door's original query data to a reply. The door, of course, also knows the passcode and can verity the signature hash. The door can either cache valid responses and remember them for a while (but it pretty much has to re-query every time it sees someone who ISN'T authorized), or simply look for one from the person it was trying to authorize (e.g. the toucher). You don't have to include the owner in the reply. Just use 'llGetOwnerKey()' to find the owner of the speaking object. |
|
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
|
02-13-2009 09:01
well Innula Zenovka your response actually makes sense to me. i understand what to do for it a little more now but im still kinda having troubles putting it together.
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-13-2009 11:56
well Innula Zenovka your response actually makes sense to me. i understand what to do for it a little more now but im still kinda having troubles putting it together. |
|
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
|
02-13-2009 12:13
ok well i deleted my first attempt since it was completly wrong so going off what you said already this is what i have so far
integer channel_dialog; default { state_entry() { channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) ); llListen(-83,"", NULL_KEY, "" ;} touch_start(integer num_detected) { key av = llDetectedKey(0); } listen(integer channel, string name, key id, string message) { } } now im not sure if this is set up right or not but yea. also i really dont know what to do for what its sapossed to listen to or what to actually set in the card. |
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-13-2009 13:03
ok well i deleted my first attempt since it was completly wrong so going off what you said already this is what i have so far integer channel_dialog; default { state_entry() { channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) ); llListen(-83,"", NULL_KEY, "" ;} touch_start(integer num_detected) { key av = llDetectedKey(0); } listen(integer channel, string name, key id, string message) { } } now im not sure if this is set up right or not but yea. also i really dont know what to do for what its sapossed to listen to or what to actually set in the card. You want to grab the toucher's key in the touch_start event, which you have done, but then.. if you are following my suggestion.. you want to use it to generate a channel based on the key, and say something on it, in the hope of getting a message back from the card, if the av has one. So I would do something like this: CODE integer mychannel; // declared as a global variable so we can use it anywhere in the script Now all you need to do is write a script for the key card to make it listen for messages on a channel based on its owner's uuid and respond when it gets one. And put stuff in the door script to open the door, of course. |
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-13-2009 14:49
...... CODE
I'm still quite new to LSL, so I'm curious about the use of llListenControl in situations like this. Since it's highly unlikely that the listen event will ever receive a message on mychannel that DOESN'T result from the touch_start event in this script, why is llListenControl necessary? Is there a good reason why you can't just let the object listen on mychannel all the time? |
|
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
|
02-13-2009 15:32
I'm still quite new to LSL, so I'm curious about the use of llListenControl in situations like this. Since it's highly unlikely that the listen event will ever receive a message on mychannel that DOESN'T result from the touch_start event in this script, why is llListenControl necessary? Is there a good reason why you can't just let the object listen on mychannel all the time? what i am trying to get made here is a key card door script that can be set to 5 different levels. if it listens to only one av's channel then it wont work for anyone else. |
|
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
|
02-13-2009 15:54
Well, let's see... You want to grab the toucher's key in the touch_start event, which you have done, but then.. if you are following my suggestion.. you want to use it to generate a channel based on the key, and say something on it, in the hope of getting a message back from the card, if the av has one. So I would do something like this: CODE integer mychannel; // declared as a global variable so we can use it anywhere in the script Now all you need to do is write a script for the key card to make it listen for messages on a channel based on its owner's uuid and respond when it gets one. And put stuff in the door script to open the door, of course. ok i can understand what it is doing here but it also confuses me. most of that code is new to me. now correct me if im wrong but if i set the channel in this instead of it getting the channel from the av i would be able to set different security levels right? cause as far as i can understand right now this just basicly sends a message on the channel saying that the one who touched it is the one with the card and i can either use the av channel or a set channel. if im wrong please tell me. right now i am trying to get the card done up |
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-13-2009 15:55
I'm still quite new to LSL, so I'm curious about the use of llListenControl in situations like this. Since it's highly unlikely that the listen event will ever receive a message on mychannel that DOESN'T result from the touch_start event in this script, why is llListenControl necessary? Is there a good reason why you can't just let the object listen on mychannel all the time? Certainly I could do it the way Hewee suggests.. just listen on one channel all the time and check that the owner of the object that replies is the same av how just touched me. Even then, though, I think it's good practice to shut down the listener when it's not needed. |
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-13-2009 16:00
ok i can understand what it is doing here but it also confuses me. most of that code is new to me. now correct me if im wrong but if i set the channel in this instead of it getting the channel from the av i would be able to set different security levels right? cause as far as i can understand right now this just basicly sends a message on the channel saying that the one who touched it is the one with the card and i can either use the av channel or a set channel. if im wrong please tell me. right now i am trying to get the card done up or the card says what my level is when it identifies me to the door ("This is Innula's card and she is security level such-and-such" . |
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-13-2009 16:08
I understand that, but it looks to me as if whoever touches the object generates mychannel, a channel number based on that person's UUID. The object then says the toucher's key on mychannel, thus activating its own listen event. In the listen event, it checks to be sure that it's receiving a message from the person who touched it (Well, duh. Who else is going to be sending a message on this special channel?). If so, then it unlocks the door. I don't see a key card in this script. I just see someone touching a door and being admitted if she's the person who touched it.
I'm actually mostly curious about what llListenControl does, but that curiosity led me to wonder about the script as a whole. I don't see (1) why this script goes to all the trouble of creating a special channel to listen to itself and (2) what the llListenControl function has to do with any of it. I'm clearly missing something here. (Probably more than one thing. It's been a long day ..... ) |
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-13-2009 16:34
I understand that, but it looks to me as if whoever touches the object generates mychannel, a channel number based on that person's UUID. The object then says the toucher's key on mychannel, thus activating its own listen event. |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
02-13-2009 16:49
I keep it archived:
Reply from Kelly Linden on 11/13/07 to Scripters mailing list: "You are pretty close. The actual order of events is: 1. Chat that is said gets added to a history. 2. A script that is running and has a listen event will ask the history for a chat message during its slice of run time. 3. When the script asks the history for a chat message the checks are done in this order: - channel - self chat (objects can't hear themselves) - distance/RegionSay - key - name - message 4. If a message is found then a listen event is added to the event queue. The key/name/message checks only happen at all if those are specified of course. So, the most efficient way is llRegionSay on a rarely used channel." _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-13-2009 17:06
I'm not sure the reference to "objects" there is, in fact, correct. Certainly a prim can't talk to itself -- regardless of whether the listener is in the same script or another script in the same prim -- but I'm pretty sure that a script in one prim can hear another prim in the same linkset.
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-13-2009 17:06
No.. prims can't hear themselves. To activate the listen event, it has to get a response from another prim that's listening on mychannel. Which will be the key card. Oh. /me hides her face. I knew I was missing something. OK, so back to the question that got me into this thread in the first place..... What's the extra value added here by using llListenControl? Unless you anticipate having >64 key cards yelling at the same time, can't you just keep listening on each value of mychannel? Why turn off the listen handles? |
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-13-2009 17:18
I may have misunderstood it, but I was under the impression that if I don't close the listener, the channels on which I'm listening will just stack up, so the the 65th av who touches it will crash it.
Afterthought. Sorry.. I didn't mention the main reason for using llListenControl. The way it was explained to me is that whenever anything's said in the region, the sim has to run various tests for all scripts with an open listener, to see which, if any, script needs to do something about it. Almost messages will fall at the first hurdle for my door -- they are on the wrong channel, so they can't be for the door -- but why waste processing resources having the door check anything at all other than for the few seconds when it might expect to receive a message (just after someone's touched it)? |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
02-13-2009 17:22
I'm not sure the reference to "objects" there is, in fact, correct. Certainly a prim can't talk to itself -- regardless of whether the listener is in the same script or another script in the same prim -- but I'm pretty sure that a script in one prim can hear another prim in the same linkset. Just depends on your definition of "object". Object in Kelly's post is indeed referring to "prim" and not link set. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |