A notecard giver for avatars WEARING a certain item??
|
|
Oso Turnbull
Registered User
Join date: 25 Apr 2005
Posts: 62
|
03-08-2006 09:41
Is there a script out there that would give an object or notecard ONLY to people wearing a certain item that I can specify? Not looking to specify each person but rather the object itself. And also not a script you have to "touch" to receive but rather just walk past, within a certain distance, and receive the item automatically.
For example--
If you are wearing a VIP bracelet (named in inventory as whatever I choose) and you come into that club,bar, etc. it would give you an object (a drink?) or a notecard automatically (since the script scanned for and located the bracelet).
The other ppl in the area would not receive the object/notecard unless they had and wore the same VIP bracelet.
Im not even close to being a "Scripting Master" so type slow and use small words....lol!
Thanks in advance!!
_____________________
WORGADO6996
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
03-08-2006 10:13
AFAIK, you can't run a sensor scan for an attachment. So the only way to do this would be to put a script into the VIP bracelet too. Then your scanner could broadcast a chat message saying "Is there anyone here who's wearing this bracelet?". The bracelets would be listening for the message, and they would respond with the owner's key.
Having said that... in a laggy club, this would probably make the lag quite a bit worse, even if you used a non-0 channel for the chat messages (which you should).
|
|
Sparky Brewster
Registered User
Join date: 16 Feb 2006
Posts: 6
|
03-08-2006 10:18
You may be able to improve it a bit on lag with a sensor that senses when someone comes in range and only then asks if a bracelet is out there while only listening for a short period of time for an answer.
You may be able to improve lag even further if the bracelets stop listening for a while after they sense the first request (unless you want the person to be able to walk by and get their thing a bunch of times in a night.)
You could completely cheat and just have a bracelet that senses when you enter a certain area and give the wearer something.
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
03-08-2006 10:25
My gut feeling says that running a periodic sensor will be worse than llSaying something periodically. If it's a busy club, the sensor will usually find someone, likely multiple people. Unless the range is very short, which I doubt would be the case, because this kind of application would probably want a "If a VIP TPs or walks into my club" type of range. From: someone You may be able to improve lag even further if the bracelets stop listening for a while after they sense the first request (unless you want the person to be able to walk by and get their thing a bunch of times in a night.)
That's a good idea. From: someone You could completely cheat and just have a bracelet that senses when you enter a certain area and give the wearer something. That's an even better idea  Unless the free gift changes... though even there, the bracelet could tell the central 'server' "I've arrived" and the owner's key, and the server then just gives the object.
|
|
Static Sprocket
Registered User
Join date: 10 Feb 2006
Posts: 157
|
03-08-2006 10:32
Here's what I'd do:
Have the Gift Giver script sit listenning on some negative channel.
Have the VIP attachment run a timer, 30 or 60 seconds minimum --- perhaps longer, depending on how long you expect players to stay in the area. When the timer goes off, have the attachment check what region it's in -- if it's in the club's region, then announce itself.
If the Gift Giver here's a VIP attachment announce itself, then it can gift the wearer.
The reason for this, rather then having the VIP attachment listen, is that if you have 30 VIPs at an event you'd have only 1 listenner (and 30 timers) running rather then 31 listenners running.
An alternative method would be to have the VIP Bracelet email an in-game gift giver script when an avatar puts the bracelet on. The gift giver script then scans every now and for avatars whose bracelets have reportted in, and does the appropriate gifting. Now you have no listenners and now chat going on. So little or no lag outside the llSensor() scan every now and then.
|
|
Oso Turnbull
Registered User
Join date: 25 Apr 2005
Posts: 62
|
A bracelet that senses a certain area.....
03-08-2006 11:55
How small of an area could that bracelet detect?.....I would want it to be a fairly small area....10 meters or so.....and could it give different objects or notecards in different areas or sims?
Meaning.... If in this sim give item1 but in this sim give item2.....all from the same bracelet though??
_____________________
WORGADO6996
|
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
03-08-2006 16:25
From: Oso Turnbull How small of an area could that bracelet detect?.....I would want it to be a fairly small area....10 meters or so.....and could it give different objects or notecards in different areas or sims?
Meaning.... If in this sim give item1 but in this sim give item2.....all from the same bracelet though?? The bracelet should send out a message with both the key of its owner and the position of its owner. Your objects, the objects that hear this message, can determine if the bracelet is in the correct "activation spot", or within a certain distance of it, then the object should give the appropriate object. ==Chris
|
|
Oso Turnbull
Registered User
Join date: 25 Apr 2005
Posts: 62
|
ok so then.....
03-11-2006 09:53
I need an item that the avatar is wearing to only work in certain sims, multiple not just one, and give them a different itemat each sim. I dont need an object at that location if the item they are wearing is scripted to do this. Similar to the fising poles that only work in certain sims i guess.
So my next question is anyone out there willing to help me with this or does someone have a script already written that does this???
Thanks for the help!!
_____________________
WORGADO6996
|
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
03-11-2006 12:52
Here's what I'd do: Have the script scan every so often for a specific gift object (specify the owner and the object's name), and if it detects the object, have it send a gift request on a certain channel. Have the gift giver listen on this channel. Here are some scripts that ***should*** accomplish the desired result. I ran it through lslint, but haven't tested it in-world, so it may not work incorrectly. This script depends on the secrecy of the channel to make things easier. Gift Bracelet: //Gift bracelet
key giftOwnerKey = "asasdf-asdfas-sdf-sdfg"; //Uhh... yeah, put the owner of the gift object's key here
integer giftChan = -184432; //A random channel
default { state_entry() { //Scan for an object named "gift giver" within 20 meters every minute llSensorRepeat("Gift Giver","",SCRIPTED|ACTIVE|PASSIVE,20,PI,60); } sensor( integer num ) { integer i; for ( i = 0 ; i < num ; ++i ) //Check all the detected objects { if ( llDetectedOwner(i) == giftOwnerKey ) llSay( giftChan, llGetOwner() ); } } }
Gift Giver: //Gift Giver
string giftName = "Free Stuff"; //The name of the object in inventory to give
integer giftChan = -184432; //A random channel
default { state_entry() { llListen( giftChan, "", "", "" ); } listen( integer chan, string name, key id, string msg ) { llGiveInventory( msg, giftName ); } }
Name the object giving the gifts "Gift Giver", or change the sensor in the bracelet. That should work-- have fun!
|
|
Krashnburn Hillquit
Registered User
Join date: 14 Feb 2006
Posts: 15
|
03-12-2006 08:38
Keknehv Psaltery, that was nearly exactly what I was going to say, the only difference was that I was going to recomend the worn item use collision instead of sensors. Being so new that I still spend half my time debuggin code thats not broken, but doesnt work due to un-documented limitations on llFunctions... I don't know if this would actualy be less laggy, that depends on how llCollisionFilter works I recon. default { state_entry() { llCollisionFilter("TriggerObject","", TRUE); } collision(integer num) { if(llDetectedOwner(0) == MyKey) { llSay(MY_SECRET_CHANNEL,(string)llGetOwner); //delete this script if its a one time pass Or else set a cooldown timer and add //a check for the cooldown before announcing. } } }
Then rename one of the floor prims in the entry way to be the trigger object. You can delete the script, possibly after changing the items textures to show it was expired for one time passes, or trigger a cooldown of 9 hours or whatever before it would announce itself again for a re-usable pass. I was thinking Collision handeling over timer/sensors thinking that pasive > active but im a total n00b, so maybe llCollisionFilter sucks, and if it does then the number of collisions it has to filter would show.
|
|
Dianne Mechanique
Back from the Dead
Join date: 28 Mar 2005
Posts: 2,648
|
03-12-2006 08:53
I am not a scripter, but I know enough to know that *all* of this stuff is laggy to some extent and if not written just the right way, could be an absolute nightmare. It shows to me what is wrong with SL Clubs and scripting in general that the owner of the club is willing to lag all his/her regular customers, just to magically put a drink in the hand of a "VIP." The original poster doesn't know much about scripting and just wants to do a "neat thing" but the only correct response to the question IMO is "don't do this." To encourage a non-scripter to attempt this very complicated thing when even getting the code slightly wrong will cause a huge lag fest in an already laggy situation is kind of irresponsible to me. This is like giving a teenager a loaded gun, but fobbing off the responsibility cause you *did* give him a detailed instruction manual on how to use it. Now I know where all the bad code comes from. 
|
|
Oso Turnbull
Registered User
Join date: 25 Apr 2005
Posts: 62
|
Thank you for all the help....
03-12-2006 10:28
I wanted to thank those willing to take the time to help me with my project.
The "VIP bracelet" was used as an example......maybe not the best but an example only. I am not a club owner nor would I need the object giver to be in a highly populated sim. In fact, just the opposite.
I was/am looking for an object to sell to ppl that would be coded so that when they located a destination it would give them an object or notecard. Not to detailed I know.
LAG would not be an issue in this case. Putting a prim that has the object in it may, however, after reading the replys above it seems that a scrpited attachment (for example, a bracelet) would be the best choice....all things considered.
I am a complete newbie in regards to scripting but not to SL. Thanks for assuming I wouldnt take those things into consideration though.
Again thanks to those who are trying to help and feel free to contact me in game if u are willing to continue playing with me...even though I have a loaded gun!!!!
_____________________
WORGADO6996
|
|
Krashnburn Hillquit
Registered User
Join date: 14 Feb 2006
Posts: 15
|
03-12-2006 17:17
From: Dianne Mechanique I am not a scripter, but I know enough to know that *all* of this stuff is laggy to some extent and if not written just the right way, could be an absolute nightmare. It shows to me what is wrong with SL Clubs and scripting in general that the owner of the club is willing to lag all his/her regular customers, just to magically put a drink in the hand of a "VIP." The original poster doesn't know much about scripting and just wants to do a "neat thing" but the only correct response to the question IMO is "don't do this." To encourage a non-scripter to attempt this very complicated thing when even getting the code slightly wrong will cause a huge lag fest in an already laggy situation is kind of irresponsible to me. This is like giving a teenager a loaded gun, but fobbing off the responsibility cause you *did* give him a detailed instruction manual on how to use it. Now I know where all the bad code comes from.  You are confused, Linden gave him the ability to write LSL, we are not providing any guns here, we are providing the instruction only. Any one who comes here knows that they should take Forum advice with a grain of salt, and no one is representing themselves to be some kind of guru. Seriously, the LSL documentation is like 4 stages past abominable, I was having trouble thinking of any way it could possibly get worse, but I guess if they let you censor it lol... LSL is not exactly rocket science. If you have ever used a C like language before, the language is cake. The only problem is a complete lack of background information on the functions. If there was authoritative documentation on functions giving information about their operation and limitations, then it would take a whole 3 min to figure out the least laggy way to do what he wants to do... And get this, maybe even the level of lag a solution would generate in a situation. Then the choice on implimenting or not is up to him isn't it, not you. The problem here is not to much information, its to little, the only way to figure out the effects of something with LSL is to try it and see, and that means that every scripter that comes along, each on his own, get to lag your sim to hell 12 times finding the wrong way to handle a problem, before finding the right one.
|