Jump to content

Using two scripts


puneetg30
 Share

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

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

Recommended Posts

Link messages is the first thing that comes to mind. You can have one script send a link message to LINK_THIS if you only want scripts in the same prim to receive it. Using the other link message fields to send specific commands, you can send an integer, a message or a uuid, or a combination of them depending on what data you need to send to the other script.

In the second script you'll have a link_message event that will receive all link messages sent to that prim. Using the data sent from the other script you can tell it what it needs to do

  • Like 1
Link to comment
Share on other sites

To clarify, you can't directly call a function from a separate script.

You need to send a message to the script you want to call a function from.
That script must also be listening to some kind of message, and call the function when all the criteria is met.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

7 hours ago, Wulfie Reanimator said:

To clarify, you can't directly call a function from a separate script.

You need to send a message to the script you want to call a function from.
That script must also be listening to some kind of message, and call the function when all the criteria is met.

Imagine if you could...inheritance in LSL. That would be so useful if you use the same custom function in multiple scripts

  • Like 1
Link to comment
Share on other sites

I've had to do this because I ran out of script space. It's a pain. The calling script has to check to see if the called script is working. You can lose messages, although this is rare, so you have to time out and retry.  Also, getting the scripts started up and synchronized on rez can get complicated. If you send before the receiver has started, you will silently lose a message.

Unless you really need to do this, don't.

Edited by animats
Link to comment
Share on other sites

11 hours ago, Wandering Soulstar said:

Come pretty close with the Firefox Preprocessor ... have you looked into that? Since I discovered it has changed my life 😉

 

Yes I have but I’m more talking about native implementation of it that let’s you import specific functions from another script if you have to use them for each script. For example writing something vaguely like :

sysSecurity(): scriptName.sysSecurity{ }

instead of pasting in each script

sysSecurity(){

    .......

    .......

}

would be even neater if the function you were importing returned an integer and you could write

if(!sysSecurity():scriptName.sysSecurity)return

to determine whether the script had passed the security check

Idk random thoughts

  • Like 2
Link to comment
Share on other sites

The servers are too resource limited to allow much computation in LSL. Technically, LL could let you run full C# code in addition to LSL. OpenSimulator allows this.The execution engine is Mono, which can run many different languages. But keeping the servers from overloading is hard enough now.

Link to comment
Share on other sites

8 hours ago, animats said:

The servers are too resource limited to allow much computation in LSL. Technically, LL could let you run full C# code in addition to LSL. OpenSimulator allows this.The execution engine is Mono, which can run many different languages. But keeping the servers from overloading is hard enough now.

Resource limitation is not why they don't allow that. IT was started, it was never finished ..

The only certainty is that there is no certainty that changing the precursor language from LSL to C# would make the slightest difference to how the final script executes. If I had to place bets, I would say the C# base would product slower bulkier bytecode. There are also security concerns, LSL is very well sandboxed.

Opensim is not a reference for anything LL do. Not even close.  If SL popped and we all went to Opensim, it would be dead 5 minutes later as it doesn't scale, and then on fire a day later when the hackery types pwned the entire mess.

  • Like 1
Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...