Jump to content

Object Animation Chat Trigger


Exorcyst
 Share

You are about to reply to a thread that has been inactive for 1589 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hey all!

 

I wonder if someone could help me with some scripting

I want to make an animated object with a chat trigger, for instance ''/move''

So the wearer can use a chat command to make the desired object move that he or she is wearing.

 

Link to comment
Share on other sites

That's one of the simplest things you can do, since it only requires defining a channel to listen on and then telling the listen event in your script to execute your chosen action when it hears a specific message on that channel.  If you're unsure about how to do that, study the examples in the LSL wiki.  Do be careful, however, to not listen on the PUBLIC_CHANNEL (channel 0).  Doing that means that your script will need to evaluate every single thing that is said in chat by anyone within range.  It's a good way to create lag and get people annoyed at you.  In fact, if I were approaching a project like this, I would avoid using any kind of chat trigger altogether.  It's a rather clumsy, old-style way to trigger actions anyway.  I'd consider using a touch trigger or, even better, making a small, simple HUD to toggle the action on and off.

The larger challenge, of course, will be how to make your attachment move the way that you expect it to.  Generally speaking, that's a lot harder than scripting an on/off toggle switch. :)

Edited by Rolig Loon
Link to comment
Share on other sites

from your example, it looks like you want to use a gesture?

you could make a gesture, and for the trigger ... /move

and for the steps, just add a chat step with this chat... /-323 move now

and your script could catch that in a listen and then do the move...

default
{
    state_entry()
    { llListen(-323, "","", "");       
    }
    touch_start(integer total_number)
    {      
    }
    listen(integer channel, string name, key id, string message)
    {   if(message)
        { llOwnerSay("do something here");
        }
    }
}

 

Link to comment
Share on other sites

While I do agree that a touch trigger is best for a lot of things, looking at reviews for a classic switchblade knife on the MP was enough to tell me that sometimes it's just best to be able to tell something to do something in chat. Almost every review said the item was great but they had trouble clicking on the button, and why couldn't the script have a chat option...

As for gestures, I like them because you can use them in mouselook. It's not just because you don't have to preface a chat command with a channel number, but because when you're in mouselook you can trigger your chat commands with hotkeys via the gestures.

Also yeah, how you intend to make the object move or appear to move is worthy of consideration. Whole other can of worms, though. xD

Link to comment
Share on other sites

On 17 March 2017 at 2:16 AM, Berksey said:

While I do agree that a touch trigger is best for a lot of things, looking at reviews for a classic switchblade knife on the MP was enough to tell me that sometimes it's just best to be able to tell something to do something in chat. Almost every review said the item was great but they had trouble clicking on the button, and why couldn't the script have a chat option...

As for gestures, I like them because you can use them in mouselook. It's not just because you don't have to preface a chat command with a channel number, but because when you're in mouselook you can trigger your chat commands with hotkeys via the gestures.

Also yeah, how you intend to make the object move or appear to move is worthy of consideration. Whole other can of worms, though. xD

You know gestures can use channels, right? Just checking...

Also, don't use channels /0 (local chat) /1 /2 /3 /5 /7 /11 /66 /77 /99 /666 as all of those tend to get over used by people and thyus have a lot more traffic on them for your script to listen to...
 

  • Like 1
Link to comment
Share on other sites

6 hours ago, Klytyna said:

You know gestures can use channels, right? Just checking...

Also, don't use channels /0 (local chat) /1 /2 /3 /5 /7 /11 /66 /77 /99 /666 as all of those tend to get over used by people and thyus have a lot more traffic on them for your script to listen to...
 

For things like that that I intend to only listen to the owner, I write in the script to listen only to them, and have it check on rez/attach if the current owner is the stored owner key, if not, reset. Of course it's not that simple when it's communicating from a hud, which is where I use llRegionSayTo(llGetOwner()....., and use a channel generated by the owner key, or a keyword translated to numbers (agrippan method), but I don't reduce it down to a single digit, I try to keep it =< 6 digits

Edited by Ruthven Willenov
Link to comment
Share on other sites

21 hours ago, Ruthven Willenov said:

For things like that that I intend to only listen to the owner, I write in the script to listen only to them, and have it check on rez/attach if the current owner is the stored owner key, if not, reset. Of course it's not that simple when it's communicating from a hud, which is where I use llRegionSayTo(llGetOwner()....., and use a channel generated by the owner key, or a keyword translated to numbers (agrippan method), but I don't reduce it down to a single digit, I try to keep it =< 6 digits

Yeah, but if the owner uses a gesture, that counts as the owner, and using 6digit channel numbers is great when you only want input from another scripted object say a body-hud talking to a bodymesh, but it's a pain for actual people to use. Hence Gestures, if your scripted item animates when a message is sent on /498739, rather than have to remember that damn number and type it every time, you put it in a gesture so you just type

/animate

in local and the gesture feature in the viewer changes that to

/498739 animate primthing option 5

or whatever command the object expects.
 

  • Like 1
Link to comment
Share on other sites

Klytyna is making a really good point, IMO. Especially if you tend to (like I do sometimes) have more than one item (such as ranged and melee weapons) attached, and they both use the same commands (which I tend to script them to use out of habit)... Scripting each to use its own channel out of thousands and thousands makes it a lot easier to ensure there's no overlap between items. And gestures can say anything on any channel with a single keystroke, so hey.

Thanks for bringing that up!

Edited by Berksey
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1589 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...