Suggestion/Message script
|
|
Nisa Maverick
Registered User
Join date: 3 Jun 2007
Posts: 224
|
02-23-2009 06:03
I have been trying to get a script to work, Drop a notecard to leave a suggestion/message. An instant message when someone has, I think I have those two sorted seems to work. But now I'm a little lost I want it to 1) Get the Avatars name so it appears in the instant message and 2) If at all possible hovering text above shows how many or indeed if any, notecards received, and once I read and delete them the number goes to 0. Here is the script, default { state_entry() { llAllowInventoryDrop(TRUE); llSay(0, "Please drop your notecard here by dragging it into the box from your inventory."  ; } changed(integer mask) { if(mask & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY)) llWhisper(0, "Thank you for submitting your notecard!"  ; llInstantMessage(llGetOwner(), (string)llKey2Name(llDetectedKey(0)) + " Dropped a Notecard Message " + llGetObjectName() + " in "+ llGetRegionName()); } } Thank you in anticipation.
|
|
Harleen Gretzky
Registered User
Join date: 27 Oct 2005
Posts: 51
|
02-23-2009 07:34
There unfortunately is no way to detect the avatar dropping inventory into an object, without them interacting with the object first. Like making them touch the object, then the touch event turns on the allow inventory drop and the changed event turns it back off.
|
|
Nisa Maverick
Registered User
Join date: 3 Jun 2007
Posts: 224
|
02-23-2009 07:41
I thought you could, as visitors counters pick up the avatar name and they dont touch those.
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-23-2009 07:48
Visitor counters use sensors, which detect people within a sensing range. They won't tell the difference between a casual visitor and someone who is dropping something into your box. There might be several people within sensor range of the box. Also, the person who drops the suggestion in the box might actually be standing halfway across the room, out of sensor range entirely. The most reliable way to get the name is a touch event. If that doesn't appeal to you, ask people to put their names on suggestions that they submit.
|
|
Nisa Maverick
Registered User
Join date: 3 Jun 2007
Posts: 224
|
02-23-2009 07:52
So is there any way at all I can change this script to pick up the avatar name, if not, any way of telling me on a hovering text how many notecards have been received, thank you.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
02-23-2009 07:55
The changed event is not triggered when:
"when inventory is added using llAllowInventoryDrop, and the user dropping the new inventory item is not the owner of the prim."
Visitor counters use a sensor or collision etc to detect who passes by. You could of course see who comes close to your box but there is no way to know if someone drops inventory in it.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Nisa Maverick
Registered User
Join date: 3 Jun 2007
Posts: 224
|
02-23-2009 08:09
One way round it, I have put a notecard giver script inside as well and enclosed a notecard to write their message on, that works ok.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-23-2009 08:43
From: Jesse Barnett The changed event is not triggered when:
"when inventory is added using llAllowInventoryDrop, and the user dropping the new inventory item is not the owner of the prim." Yes it is. It is just fired with the CHANGED_ALLOWED_DROP flag rather than the CHANGED_INVENTORY flag. The text you quote is in a table specifically under the row for the CHANGED_INVENTORY flag. http://www.lslwiki.net/lslwiki/wakka.php?wakka=changedBut that doesn't change the fact that there is no way to tell who (other than whether the person has modify rights or not) dropped a particular item. Even the workarounds that people have mentioned, such as requiring a touch before the drop, are not foolproof; just a little harder to screw up. Another one that makes it a LITTLE less flaky is to ignore (delete) any items dropped that have a creator other than the person who touched the object. That one has the drawback that the dropper MUST create their own notecard rather than opening up someone else's and changing it, and that caveat should probably be noted for the user. It's STILL not completely secure, because a middle-man COULD obtain a notecard authored by someone, edit it, wait for that person to touch (watch for the particle stream), and race them to drop in a notecard. So how paranoid do you prefer? You could have a user copy/paste text to chat instead....  If you REALLY wanted to you could have a confirmation step: once a notecard has been dropped, use say llDialog() to send the user you THINK dropped in the notecard a confirmation code they have to speak to keep their notecard from being ignored/deleted after a reasonable timeout.
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-23-2009 09:44
Of course, you could choose to forget about notecards entirely. Just tell users to type something (on a private channel) like "SUGGESTION:" followed on the same chat line by their suggestion. You write your script to listen on that channel, filter out anything that isn't a SUGGESTION: xxxxxx, and add it to a suggestion list that you dump periodically to yourself in an IM. (Or simply forget the SUGGESTION: part and accept anything that's typed in chat on that channel as a suggestion  ). The biggest advantage of that approach is that you automatically get the ID of the avatar.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
02-23-2009 16:20
Actually it was wrong across the board anyways. default { state_entry() { llAllowInventoryDrop(TRUE); } changed(integer change) { //if(change & CHANGED_ALLOWED_DROP){ // llSay(0, "changed allowed drop"); //} if(change + CHANGED_INVENTORY){ llSay(0,"changed inventory"); } } }
With CHANGED_ALLOWED_DROP commented out, an inventory drop by either owner or someone without mod rights results in this message: "changed inventory" If CHANGED_ALLOWED_DROP is uncommented then an inventory drop by owner will fire this message: "changed inventory" And an inventory drop by someone without mod rights results in both messages being fired: "changed allowed drop" "changed inventory" So if you do not need any further processing then you do not need to include CHANGED_ALLOWED_DROP in your script. But it would come in handy if you were using touch like this: key name; key owner;
default { state_entry() { owner = llGetOwner(); llSetText("touch me first to drop inventory",<0,0,0>,1.0); llAllowInventoryDrop(FALSE); } touch_start(integer n) { llAllowInventoryDrop(TRUE); llSetTimerEvent(20.0); name = llDetectedName(0); } changed(integer change) { if(change & CHANGED_ALLOWED_DROP){ llSay(0, "thank you"); llAllowInventoryDrop(FALSE); llInstantMessage(owner, name + " dropped inventory"); llSetTimerEvent(0.0); } } timer() { llAllowInventoryDrop(FALSE); llSetTimerEvent(0.0); } }
With it setup like this the owner can add inventory at any time and will not be spammed by messages but anyone else will need to touch it first to drop inventory. As soon as the timer runs out or they drop inventory then inventory drop is disabled until touched again. There is always the possibility that someone drops inventory within that 20 second window of time before the person that touched it puts in thier inventory but this is about as good as it gets.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|