Jump to content

listen instead of touch help


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

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

Recommended Posts

I have a mesh door script that uses touch but I need it to listen to open instead for a remote control. I have a simple dialog in the remote that works but not sure how to switch the touch_start into a listen start(?) type of control... So the door script hears either open or close and the does it.

The door itself it using the door script by Lyn Mimistrobell. http://wiki.secondlife.com/wiki/Smooth_Rotating_Linked_Door_With_Hinge

TIA

Link to post
Share on other sites

It is just that easy, actually.  Anything that is in the touch_start event can be done instead in the listen event.  Just tell your listen event to act if (message == "open") .  The only thing you have to watch out for is that a touch_start event will identify the toucher as llDetectedKey(0), but you cannot use any of the llDetected* functions in a listen event.  If you need information about the toucher, you will need to pass it along with the message from your remote object.  You could either send it as a separate message or, much better, as part of a single message that you parse when it's received.  The listen event might start, then, with something like 

listen(integer channel, string name, key id, string message)
{
    list temp = llParseString2List(message,["~"],[]);
    key kToucher = (key)llList2String(temp,0);    // The UUID of your toucher
    string strCommand = llList2String(temp,1);    // The command to open or shut
    if (strCommand == "open")
    // open the door
}

So, if your remote object sends a message in the form UUID~command, the listen event has unpacked it to get the two parts back out again.  Other than that minor bit, the job is done.

  • Thanks 1
Link to post
Share on other sites
2 hours ago, Max Pitre said:

"easy" is a relative term...I almost failed algebra in high school (40 some years ago) and this looks harder than that... :)

Thanks for the help.

This is crude but to the point.

default
{
	state_entry()
	{
		llListen(1000, "remote_controller", "", "");//this will listen on channel 1000 and only accept data from an object with that name.
	}
	listen(integer channel, string name, key id, string message)
	{
		if(message == "open") //if both are the same then run the branch code. If not ignore it.
		{
			//run the door openning code
		}
	}
}

 

  • Like 1
  • Thanks 1
Link to post
Share on other sites
7 hours ago, Max Pitre said:

Already been looking at that and other sources, if it was that easy I wouldn't have asked...

 

The wiki example is really very simple and the page explains everything you need to know. If that's not making sense then you need to back up as you're missing some pretty fundamental stuff.

It sounds like you're blindly copy pasting code with no idea how or why any of it does anything.

  • Like 1
  • Sad 1
Link to post
Share on other sites
5 minutes ago, CoffeeDujour said:

The wiki example is really very simple and the page explains everything you need to know. If that's not making sense then you need to back up as you're missing some pretty fundamental stuff.

It sounds like you're blindly copy pasting code with no idea how or why any of it does anything.

Or maybe you could simply explain what is what rather than be an ankle hacker? You have no idea what the OP is doing or their level of understanding. Your final comment is based on your opinion. This forum is what it states on the tin, not a put down forum.

Link to post
Share on other sites
42 minutes ago, CoffeeDujour said:

The wiki example is really very simple and the page explains everything you need to know. If that's not making sense then you need to back up as you're missing some pretty fundamental stuff.

It sounds like you're blindly copy pasting code with no idea how or why any of it does anything.

Is that what you think, well good for you, you're special.

Link to post
Share on other sites
9 minutes ago, steph Arnott said:

If you do not know it is about as helpful as a poke in the eye.

Sometimes the obvious is hidden and sometimes we need a push in the right direction like what you and Rolig did. Both helped tremendously so thanks for that. 

  • Thanks 1
Link to post
Share on other sites
2 hours ago, Max Pitre said:

Is that what you think, well good for you, you're special.

I'm not having a dig, attacking you, calling you stupid. You're trying to run before you can walk. Spend a couple of hours getting up to speed then return to your project.

The wiki has all the documentation you could ever need for everything you would ever want to do in LSL - The Wiki is really good.

BUT

If you can't read it, it's useless to you.

Rolig's example was almost the same as the wiki version. 

 

Link to post
Share on other sites
Just now, CoffeeDujour said:

I'm not having a dig, attacking you, calling you stupid.

 

Yes you did. He clearly stated  he new very little and asked for a very minor alteration when he could not understand the wiki. You then decided to be be know all of everything and smashed the poor man down. FYI a fifty year old learning new things like code is not easy. An by his response you got the mans back up.

Link to post
Share on other sites
9 minutes ago, steph Arnott said:

Ma i would rather walk than belittle some one.

Please imagine my stern grandmother voice.  This is not a place for bickering and name calling. We are intimidating new scripters who come here with legitimate questions, hoping for wise words from us.  Angry words and pointless arguments are not helping.  Just quit it. 

And relax.  😎

  • Thanks 1
Link to post
Share on other sites
1 minute ago, Rolig Loon said:

Please imagine my stern grandmother voice.  This is not a place for bickering and name calling. We are intimidating new scripters who come here with legitimate questions, hoping for wise words from us.  Angry words and pointless arguments are not helping.  Just quit it. 

And relax.  😎

Think you are attacking the the wrong person. I gave a very precise solution and an a empathic response to the OP. The other just was plain rude and abusive. This conversation is ended.

  • Haha 1
Link to post
Share on other sites

I am not attacking anyone, Steph.  I am giving general advice to people who have been posting recently.  I really do not care who starts the arguing back and forth, and who may be "right" or "wrong".  This is not the place for it.  If you find yourself trapped in a back-and-forth argument, please consider what this forum is for, bite your tongue, and stop.  

  • Thanks 3
Link to post
Share on other sites
9 minutes ago, Rolig Loon said:

I am not attacking anyone, Steph.  I am giving general advice to people who have been posting recently.  I really do not care who starts the arguing back and forth, and who may be "right" or "wrong".  This is not the place for it.  If you find yourself trapped in a back-and-forth argument, please consider what this forum is for, bite your tongue, and stop.  

Ma, be blessed. A bee and a flower are the beauty of creation. Simple, but also vastly complicated in the the structure of life.

Edited by steph Arnott
  • Thanks 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 546 days.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...