This script will make an object say its name and texture UUID on a simple command of "/11 Tell" or if you touch it
It is a useful example of how to use the listen() and touch_start.
Notice how the listen command uses llToLower() to force the heard message into lowercase before testing for 'tell', this is done so that the script will work for "/11 tell" or "/11 TeLL" or any combination of upper+lowercase letters for 'tell'.
//Say Name and texture UUID of an object By Tribal Toland
// 24jan07 sC some enhancements by sparti Carroll
// Simple OpenSource Licence
// 1. PLEASE SEND ME UPDATES TO THE CODE
// 2. You can do what you want with this code and object including selling it in other objects and so on.
// 3. You can sell it in closed source objects if you must, but please try to send any updates or improvements
// back to me for possible inclusion in the main trunk of development.
// 4. You must not claim that anyone apart from Tribal Toland wrote the original version of this script.
// 5. You can add and edit things but please tryto keep it all making sense.
// Thank you for your co-operation
// Tribal Toland
say_me() {
string objectname = llGetObjectName();
string texture = llGetTexture(ALL_SIDES);
llOwnerSay("The name of the object is: " + (string) objectname);
llOwnerSay("The texture key is: " + (string) texture);
}
reset() {
llSetText("Owner Touch me or say '/11 tell' to find my object name and texture key - Open Source by Tribal Toland",<1.0,1.0,1.0>,1.0);
}
default {
on_rez(integer start_param) {
llResetScript();
reset();
}
state_entry() {
reset();
key kOwner = llGetOwner();
llListen(11,"",kOwner,"");
}
touch_start(integer num_detected) {
say_me();
}
listen( integer channel, string name, key id, string message ) {
message = llToLower(message);
if( message == "tell" ) {
say_me();
}
}
}