Jump to content
  • 0
Fabeha

can one script be triggered from another?

Question

  • 0

One script can invoke functions in another, certainly, All they need to do is communicate with each other. They might use llWhisper, llSay or llRegionSay on a specific chat channel, with listeners on the same channel. That can communnicate between different linkests entirely. Or they may use llMessageLinked, with a different type of listen for linked messages, for communications within a single linkset. But all the scripts need to be running at least a listener of some sort, for that communication to happen.

For example, I made an elevator. The script in the floor call buttons makes the scripts in the elevator car, elevator car doors, and shaft doors do things at certain times. The script in the elevator car makes things happen with the doors of the car and the doors of the shaft. When they aren't doing things, the scripts just idle and listen for further commands. But they are all running.

  • Like 1

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

One script can invoke functions in another, certainly, All they need to do is communicate with each other. They might use llWhisper, llSay or llRegionSay on a specific chat channel, with listeners on the same channel. That can communnicate between different linkests entirely. Or they may use llMessageLinked, with a different type of listen for linked messages, for communications within a single linkset. But all the scripts need to be running at least a listener of some sort, for that communication to happen.

For example, I made an elevator. The script in the floor call buttons makes the scripts in the elevator car, elevator car doors, and shaft doors do things at certain times. The script in the elevator car makes things happen with the doors of the car and the doors of the shaft. When they aren't doing things, the scripts just idle and listen for further commands. But they are all running.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

There are several ways to do it.  The most common way is to use llMessageLinked to send information from one script to the other, as in

llMessageLinked (LINK_THIS,8,"Basketball", Bobs_UUID);

where you are sending the number 8, the word "Basketball" and the UUID fo someone named Bob to any other script in the prim.  If you want to turn script #2 on and off completely with a command from script #1, you could use llSetScriptState, as in

llSetScriptState ("Script2",FALSE);

which would disable a script named Script2  that is in the same prim.  There are other ways too -- some more convoluted -- but those are the most common ones.  The one big thing that you cannot do is send a chat message of any kind dierctly from one script to another in the same prim.  You can send chat to another prim in the sme object, however.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
On 09/02/2012 at 1:34 AM, Ceera Murakami said:

One script can invoke functions in another, certainly, All they need to do is communicate with each other. They might use llWhisper, llSay or llRegionSay on a specific chat channel, with listeners on the same channel. That can communnicate between different linkests entirely. Or they may use llMessageLinked, with a different type of listen for linked messages, for communications within a single linkset. But all the scripts need to be running at least a listener of some sort, for that communication to happen.

For example, I made an elevator. The script in the floor call buttons makes the scripts in the elevator car, elevator car doors, and shaft doors do things at certain times. The script in the elevator car makes things happen with the doors of the car and the doors of the shaft. When they aren't doing things, the scripts just idle and listen for further commands. But they are all running.

I find it quite amusing to read how experienced users mislead ppl asking questions. 

If a script is turned off, how can it listen to messages? Thats a basic logic. 

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, bizbot said:

If a script is turned off, how can it listen to messages? Thats a basic logic. 

Easy.  I explained that in  my post in this very old thread. That's what llSetScriptState is meant to do. 

The OP in this thread asked a rather confusing question, thanks to poor typing.  He wanted to know what happens if "Script 1 does not run on its on but it tuns with the help of script 2 ?"  You and I interpreted this to mean "Script 1 does not run when it is turned off but it turns on with the help of script 2 ?"  Ceera, a very experienced scripter and builder who has been in SL at least as long as I have, interpreted the same words to mean "Script 1 does not run by itself but it runs with the help of script 2 ?"  So she explained how you can control script 1 by using commands from script 2 to do things that it cannot do by itself. 

We're often faced with ambiguous questions here in Answers, so we have to guess at what the OP really meant to say. Sometimes there are language difficulties, sometimes people make spelling or typing errors, and sometimes the OP is so confused that he doesn't know exactly what to ask. If you spend much time reading threads here, you'll find that most of the experienced volunteers here will try to approach the same question from several different directions, especially when the question isn't clear. B|

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   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...