Chat Command-need help scripting
|
|
Cheeky Chaplin
Lifelong Learner
Join date: 26 Feb 2007
Posts: 34
|
04-11-2007 12:05
Hello, I have an item for sale, but my customers tell me the chat commands will not work for them. Can someone help me to determine how to modify the scripts to allow the new owner to chat command my item? Here is how it reads now: default { state_entry() { key owner = llGetOwner(); llWhisper(0,"Cloaking ready"  ; llListen(0,"",owner,""  ; } listen( integer channel, string name, key id, string message ) { if( message == "cloak" ) { llSetStatus(STATUS_PHANTOM, TRUE); llWhisper(0,"Cloaking"  ; llSetAlpha(0,ALL_SIDES); } if( message == "uncloak" ) { llSetStatus(STATUS_PHANTOM, FALSE); llWhisper(0,"Uncloaking"  ; llSetAlpha(1,ALL_SIDES); } } } Thanks in advance! Cheeky Chaplin.
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
04-11-2007 12:08
have you tried adding this? on_rez (integer param) { llResetScript(); }
That way when it is rezzed for the new owner, it should recognize the new owner. Rj
|
|
Cheeky Chaplin
Lifelong Learner
Join date: 26 Feb 2007
Posts: 34
|
Thanks, RJ
04-11-2007 12:11
Thanks, RJ. Appreciate the quick reply.
I will try it now, and let you know.
Your friend, Cheeks
|
|
Cheeky Chaplin
Lifelong Learner
Join date: 26 Feb 2007
Posts: 34
|
Where exactly does this extra bit of scripting go....?
04-11-2007 12:16
RJ, I am having trouble figuring this out. Where exactly does this extra bit of scripting go in the sequence....?
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
04-11-2007 12:20
It could go in several places really, but this works:
default { on_rez(integer param) { llResetScript(); }
state_entry() { key owner = llGetOwner(); llWhisper(0,"Cloaking ready"); llListen(0,"",owner,""); }
// And the rest of your code after this...
|
|
Cheeky Chaplin
Lifelong Learner
Join date: 26 Feb 2007
Posts: 34
|
Thanks again, RJ.
04-11-2007 12:24
Thanks again. OK no errors in script now. I will have one of my friends try it out. 'Preciate your help a lot. 
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
A couple of points
04-11-2007 13:30
Use llOwnerSay rather than llWhisper, only the owner will hear it. Use a channel other than 0! Even with the owner filter its still going to be processing everything you say which is 99% of the time nothing to do with the cloak.
|
|
Raven Ivanova
Registered User
Join date: 4 Dec 2006
Posts: 70
|
More info on channels?
04-12-2007 14:40
From: Newgate Ludd Use llOwnerSay rather than llWhisper, only the owner will hear it. Use a channel other than 0! Even with the owner filter its still going to be processing everything you say which is 99% of the time nothing to do with the cloak. I need to know more about channels. I don't want to use channel 0 either, but I'm not sure what channels I CAN use. Is it true there are 4,294,967,294 possible channels? Are there any limitations attached to certain channels?
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
04-12-2007 14:49
From: Raven Ivanova I need to know more about channels. I don't want to use channel 0 either, but I'm not sure what channels I CAN use. Is it true there are 4,294,967,294 possible channels? Are there any limitations attached to certain channels? Since you intend someone to chat on the chosen channel, you'll want to pick a small number, because they have to type in that chat channel each time here. For example, if you choose channel 2, they have to type: /2and what you want them to say So feel free to use channel 1, or 2, or whatever, since you are filtering by owner too, you don't have to worry about someone else accidentally commanding your prim. Rj
|
|
Raven Ivanova
Registered User
Join date: 4 Dec 2006
Posts: 70
|
04-12-2007 14:57
Thanks RJ!
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
04-12-2007 15:26
Valid channels are the range of a 32-bit signed integer, -2,147,483,648 to +2,147,483,647. Negative channels cannot be used directly by avatar chat, only as a response generated by clicking on an llDialog button.
The channels you typically want to avoid are 0 (open chat) and DEBUG_CHANNEL, which is 2,147,483,647. Any chat on DEBUG_CHANNEL will appear in the Script Warnings/Errors window.
|
|
Raven Ivanova
Registered User
Join date: 4 Dec 2006
Posts: 70
|
Channel script not working
04-12-2007 16:46
Thanks Deanna, great info. Does anyone know what is wrong with my script? I'm using channel 2 (I hope) but my commands aren't working in Chat. I even had to remove all instances of llOwnerSay llOwnerSay(2,"Light Activated"  ; as I kept getting Syntax and Argument errors because of llOwnerSay. My script that compiled but doesn't work in channel 2 chat: ---------------------------- default { state_entry() { key owner = llGetOwner(); llListen(2,"",owner,""  ; llSetStatus(STATUS_PHANTOM, TRUE); llSetTexture("light", ALL_SIDES); llSetTextureAnim(ANIM_ON|LOOP, ALL_SIDES, 4, 4, 0, 0, 2.0); } listen( integer channel, string name, key id, string message ) { if( message == "/2 lighton" ) { llSetStatus(STATUS_PHANTOM, TRUE); llSetTexture("light", ALL_SIDES); llSetTextureAnim(ANIM_ON|LOOP, ALL_SIDES, 4, 4, 0, 0, 2.0); } if( message == "/2 lightoff" ) { llSetStatus(STATUS_PHANTOM, FALSE); llSetTextureAnim(FALSE, ALL_SIDES, 0, 0, 0, 0, 0.0); llSetTexture("alpha", ALL_SIDES); } } on_rez(integer param) { llResetScript(); } } ----------------------------
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
04-12-2007 16:50
llOwnerSay doesnt use a channel. It is only heard by the owner. I.e. llOwnerSay("Hi there"  ; Also the message returned won't have the channel in it. So you don't need: if( message == "/2 lighton" ) Just: if( message == "lighton" ) Rj
|