New Link Message Feature Request

View: New views
1 Messages — Rating Filter:   Alert me  

New Link Message Feature Request

by Kubota Homewood :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have just filed a new feature request in JIRA

https://jira.secondlife.com/browse/SVC-4967

I am including the request below.  If you feel so inclined, please vote or comment on this feature request.

Thanks,

    Kubota

    Doing delicate tasks with heavy machinery

As Second Life evolves, the scripting in SL has become more complex. Due to many reasons the number of scripts in an object are increasing and the interaction between those objects increases. The primary tool for interaction between scripts is the llMessageLinked() function. Unfortunately, every script in a prim must be woken up with any link message is directed at that prim. I suggest two solutions.

Solution #1

The internal state associated with a script is augmented to include the following values:

integer message_mask; // Defaults to -1
integer message_vmask; // Defaults to 0
integer message_value; // Defaults to 0

A new function is added to set these values:

llMessageLinkMask(integer mask, integer vmask, integer value)

The check to determine if a script should be sent a link message is augmented. Assuming the following pseudo code is currently being used:

if (has_link_message_event) { send_link_message(sender, number, message, id); }

It would become

if (has_link_message_event &&
((number & message_mask) != 0 ||
(number & message_vmask) == message_value)) { send_link_message(sender, number, message, id); }

Example usage:

llMessageLinkMask(0x80000000, 0xffff0000, 0x12340000)

This would limit this script to only receiving link messages which either hand the high order bit set in the number (broadcast) or the upper 16 bits set to 0x1234.

Justification:

Allows scripts, with a minimal impact, to direct link messages to particular scripts or groups of scripts. Reduces server load when many scripts are interacting within a single prim.

Solution #2

Assign each script an ID that is easily differentiated from a link number of any possible LINK_* value. A suggested format is:

0x800000000 | (link_number << 16) | (inventory_index)

Test for a script ID: (((id) & 0xc0000000) == 0x80000000)

The "link_number" is the link number of the prim the script is in. For a single prim object this is 0. For a multi-prim object the root is 1 and the children number up from their.

The "inventory_index" is any convenient index that will identify this script. A script's ID can change when the inventory or link set changes.

When a message is sent to a script ID rather than a link number the "sender" in the event is the script ID of the sending script.

A new function is added to retrieve a script ID based on the scripts name:

integer llGetScriptID(string script_name)

Returns the script ID for the specified script in the inventory of this prim. If the script_name does not exist or is not a script a value of 0 is returned.

llGetScriptID(llGetScriptName())

returns the script ID of the current script

Optional implementation for extra credit:

integer llGetScriptID(integer link, string script_name)

Returns the script ID for the named script within the specified prim of the object.

llGetScriptID(llGetLinkNumber(), llGetScriptName())

Would then return the script ID of the current script



_______________________________________________
Click here to unsubscribe or manage your list subscription:
https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters