|
Miranda Marjeta
Registered User
Join date: 6 Oct 2007
Posts: 2
|
04-28-2008 08:36
I would like for an item to give it's contents, to anyone, via a "codeword" typed in chat rather than touch_start. I'm not great at LSL and have been beating my head against a wall for several hours now. Obviously not as easy as just changing the touch_start to a listen event. Here is the non working mess I came up with trying to change a touch_start script. Any and all help would be greatly appreciated. default { state_entry() { llListen(0, "", llDetectedKey(0), "giveme" ); }
listen(integer number, string name, key id, string message) { if (message = "giveme"); llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_OBJECT, 0)); } }
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
04-28-2008 08:40
The llDetected stuff doesn't work in state_entry or, sadly, in listen events. I think you want to do something like this instead: default { state_entry() { llListen(0, "", "", "giveme"); }
listen(integer number, string name, key id, string message) { llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT, 0)); } }
Since you're only listening for when somebody says 'giveme', you don't have to also check that that's what somebody said in the listen event handler.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Miranda Marjeta
Registered User
Join date: 6 Oct 2007
Posts: 2
|
04-28-2008 08:47
Thank you!!!! Worked wonderfully!!
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
04-28-2008 08:49
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
04-28-2008 08:50
And you don't really want to be leaving a script laying around that is always listening on channel 0. It is going to have to process everything said in open chat in the entire simulator for first distance and then the "giveme" string.
It would be better if you changed it so that it they had a password and a channel and could then enter like this:
/187giveme
That will say "giveme" on channel 187 EDIT: corrected speeling
_____________________
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
|