2 questions from a newbie
|
|
Sariel Claven
Registered User
Join date: 3 Apr 2009
Posts: 7
|
04-09-2009 19:01
Ok, I'm a newbie, and I admit these may be silly questions, or questions asked many times but I'm still stumped.
1. At Particle Labs, I picked up a "listening sensor" target script. This script will listen on chat for something like "/1 name_of_object" where "/1" is the channel and "name_of_object" you want the underlying script to target. How do I change the channel from a number to a name? For example, gestures are done like "/kiss". What if I want my script to respond to "/bark" rather than "/1"?
2. There are some things that I received "free" from various places that I just can't look at. One of them is the script (or whatever) that handles "hug" requests. This script sends a message to the avatar saying that so-and-so want to animate your avatar and allows you to accept or decline. How is this accomplished? Can this be done in any script? If so, how?
Any help would be appreciated.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
04-09-2009 19:17
From: Sariel Claven Ok, I'm a newbie, and I admit these may be silly questions, or questions asked many times but I'm still stumped.
1. At Particle Labs, I picked up a "listening sensor" target script. This script will listen on chat for something like "/1 name_of_object" where "/1" is the channel and "name_of_object" you want the underlying script to target. How do I change the channel from a number to a name? For example, gestures are done like "/kiss". What if I want my script to respond to "/bark" rather than "/1"? assume you can view and modify the script, there will be a line starting with llListen( 1, change the one to a zero, and it will listen for any name... unfortunately it will listen for everything else too. this can be solved by modifying the code inside of the listen event. you'll want it to test to see if there is a "/" at the begining and then remove it. which generally looks like if (!llSubStringIndex( message, "//" )){ message = llDeleteSubString( message, 0, 0 ); //-- all the other code that was between the brackets of this event } From: someone 2. There are some things that I received "free" from various places that I just can't look at. One of them is the script (or whatever) that handles "hug" requests. This script sends a message to the avatar saying that so-and-so want to animate your avatar and allows you to accept or decline. How is this accomplished? Can this be done in any script? If so, how?
Any help would be appreciated. can't look at because... ? the script is no modify? anyway, yes this is done by script, and there should be a few examples on the forum (try serching hugger or hug attachment).
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Abraxes Binder
Registered User
Join date: 23 May 2008
Posts: 205
|
04-11-2009 02:03
2) when an animation attempted initiated without sitting, the blue request box is shown eg llRequestPermissions(<key>, PERMISSION_TRIGGER_ANIMATION) in a non-sit situation would prompt the requestbox. It is all a question of permissions. When you 'sit' on an obj, it is presumed that you give animation permission. If you only walk by, you will get the popup and have to decide specificly. BR ab
_____________________
BR ab
|
|
Sariel Claven
Registered User
Join date: 3 Apr 2009
Posts: 7
|
04-11-2009 13:31
From: Abraxes Binder 2) when an animation attempted initiated without sitting, the blue request box is shown eg llRequestPermissions(<key>, PERMISSION_TRIGGER_ANIMATION) in a non-sit situation would prompt the requestbox. It is all a question of permissions. When you 'sit' on an obj, it is presumed that you give animation permission. If you only walk by, you will get the popup and have to decide specificly. BR ab Ok, with a little work, and a lot of help from others, including Sarienna Hax, I wrote what I want and it works. I haven't yet put it into an object to be worn like I eventually want to do but with Sarienna's help I now know how to do that. One thing I'm still puzzled about: I'm listening on channel 0 for the command to activate the script. However, the command when typed into the channel appears in the channel. That doesn't happen when listening on other channels, or with commands like /shrug, etc. They don't appear. But with my object if I say "/foo item" those words appear just like I've said them. I want them suppressed. Any way to do that?
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
04-11-2009 13:35
Did you try renaming your Object? Try naming it Sariel Claven and see what happens.
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
04-11-2009 14:03
From: Sariel Claven One thing I'm still puzzled about: I'm listening on channel 0 for the command to activate the script. However, the command when typed into the channel appears in the channel. That doesn't happen when listening on other channels, or with commands like /shrug, etc. They don't appear. But with my object if I say "/foo item" those words appear just like I've said them. I want them suppressed. Any way to do that? A command like /shrug is a shortcut to activate a gesture, so it won't appear in chat. A prefix like /89 is a signal to redirect what follows to channel 89, so that line won't appear in public chat either. Unless you are using "/foo" as a shortcut for a gesture, it will show up in chat because it clearly isn't a channel number. A script can only reinterpret the string "/foo" as a signal to do something if you type it in the first place .... and that means it will show up in chat. There is no "backup and erase what I just typed" function. A script that has to listen to everything that's typed in public chat has to do a lot of work, contributing to lag. One big advantage of triggering the particle script by typing the command in channel 1 (the way the listening sensor script you picked up is written) is that you're listening on a relatively quiet channel. The task you're attempting is a nice scripting challenge, but in the end it's easier to simply listen on a non-public channel and it's friendlier too.
|
|
Sariel Claven
Registered User
Join date: 3 Apr 2009
Posts: 7
|
04-11-2009 14:19
From: Rolig Loon A command like /shrug is a shortcut to activate a gesture, so it won't appear in chat. A prefix like /89 is a signal to redirect what follows to channel 89, so that line won't appear in public chat either. Unless you are using "/foo" as a shortcut for a gesture, it will show up in chat because it clearly isn't a channel number. A script can only reinterpret the string "/foo" as a signal to do something if you type it in the first place .... and that means it will show up in chat. There is no "backup and erase what I just typed" function. A script that has to listen to everything that's typed in public chat has to do a lot of work, contributing to lag. One big advantage of triggering the particle script by typing the command in channel 1 (the way the listening sensor script you picked up is written) is that you're listening on a relatively quiet channel. The task you're attempting is a nice scripting challenge, but in the end it's easier to simply listen on a non-public channel and it's friendlier too. Ok, I guess that's not too much of a problem. I still have to have the script search for a "command" because I plan to have several things like "foo", "bar" and "bamf" and the scripts need to distinguish them. It's a lot easier to remember a command than it is to remember which channel goes with which effect. So, I'll end up with "/1Foo" and "/1Bamf" and the two different scripts will know when they are meant to activate. I'm beginning to see how scripting can be really fun in SL... once you know what you're doing. 
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
04-11-2009 14:44
From: Sariel Claven Ok, I guess that's not too much of a problem. I still have to have the script search for a "command" because I plan to have several things like "foo", "bar" and "bamf" and the scripts need to distinguish them. It's a lot easier to remember a command than it is to remember which channel goes with which effect. So, I'll end up with "/1Foo" and "/1Bamf" and the two different scripts will know when they are meant to activate. Just remember to leave a space between the channel number and your command. "/1Foo" will be interpreted as a string typed in channel 0. "/1 Foo" will be interpreted as the string "Foo" typed in channel 1, which is what you want. Incidentally, take a close look at  to see how to filter a listen. For example, you can use a handle like llListen(4,"",llGetOwner(),"foo");
to listen on channel 4 and ONLY let the listen event respond when the object's owner says the word "foo." Unless you have to manage several of them, a couple of good filters saves the script a lot of work and can save you having to write a series of condition statements to do the same job later. Depending on what you mean by "several things," that's an option you may want to consider. From: someone I'm beginning to see how scripting can be really fun in SL... once you know what you're doing.  Welcome to the party. 
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
04-11-2009 17:05
there is a way around this, by using a gesture...
if your listen is on an off channel, and the first part of the command is static (like /command) instead of variable(like /avatar name) then you can change your script listen to a different channel, and make a gesture that replaces "/command" with "/4 /command"... then you don't have to memorize channels, the command doesn't go to general chat, and everyone is happy. the nice thing about this is that you can enable it for items you've bought that use off channels.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
04-11-2009 17:40
From: Rolig Loon Just remember to leave a space between the channel number and your command. "/1Foo" will be interpreted as a string typed in channel 0. "/1 Foo" will be interpreted as the string "Foo" typed in channel 1, which is what you want. /1Foo with no space is still interpreted as "Foo" on channel 1. Although it isn't really a good habit to get into. Declaring a channel followed by a number with no space would not go to the expected channel.
_____________________
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
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
04-11-2009 19:50
lol love the new icon Jesse... it needs a subtitle... "this is what lsl scripters do when they DON'T want a headache" =)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|