A while back I wrote a blog article on reducing prim count by using a veneer prim with a texture change script in it. Since then I have written a much improved script that uses an auto-generated touch menu, and also responds to voice commands.
Usage
The script allows for changing the texture on a prim, either on a single face or on all faces. You can set the texture via voice commands or touch menu.
Textures must be dropped into the same prim as the script is in. Additionally, the system textures of “default” (plywood), “blank”, “transparent”, and “media” are supported.
Currently, the script restricts use to the owner or, in the case of an object deeded to group, the group. Further revisions of the script may allow an access list.
Touch menu
Simply touch the prim which contains the script, and a dialog menu will pop up giving options for all textures in the prim plus the aforementioned system textures.
Voice commands
By default the script listens on channel 45. To change this to a different channel, edit the value of LISTENER_CHANNEL in the script.
The following commands are supported:
Command | Parameter | Description |
status | none | shows all options and also the current texture |
set | name | Sets the texture of the face to the texture named ‘name’. If this parameter is omitted then it displays the name of the current texture. If the named texture is not found then it will report an error and no further action taken. Additionally, you may specify the system textures of “default”, “plywood” (same as default), “blank”, “transparent”, or “media”. If a texture by one of those names exists in the object then it will override the system texture and use the named texture instead. |
name | none | Equivalent to ‘set’ |
idx | number | Sets the texture by index. To see the valid indexes use ‘status’. |
index | number | Same as idx |
face | number | Sets the face to the specified number. If the parameter is omitted then it displays the current face. Valid values are a positive integer, or else -1 for ALL_SIDES. The literal string ALL_SIDES can also be used. If the index is out of range then an error will be reported and no further action taken. |
If the command is omitted then the script will try to load a texture by name. If no texture by that name is found, then it will report an error.
License
I hereby release the script under the same license as the Second Life source code – ie. the LGPL
Credits
The menu-based code is derived from the SimpleDialogMenuSystem script by Omei Qunhua.
The command-based code is my own work.
One thought on “Script: Texture change by menu and touch”