Difference between revisions of "Bot Playground/Commands/touchPrim"

From SmartBots Developers Docs
Jump to: navigation, search
m (Gg moved page Bot Playground/Commands/touch to Bot Playground/Commands/touchPrim without leaving a redirect)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
<onlyinclude>Touches an in-world object by its UUID</onlyinclude>
+
<onlyinclude>Touches an in-world object (prim) by its UUID</onlyinclude>
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Bot.touch(uuid);
+
Bot.touchPrim(uuid);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 30: Line 30:
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Bot.touch("a6b4be6c-ca10-398f-846e-ea933cebfda2");
+
// SmartBots Playground code start v1.0 (automatic line)
 +
Bot.on("chat_message", function(event) {
 +
console.log("Got a message: " + event.message);
 +
 
 +
// Teleport home. Please don't leave your bots at DuoLife!
 +
Bot.teleport("HOME");
 +
});
 +
 
 +
// Goto to testing object
 +
Bot.teleport("DuoLife/211/152/31");
 +
 
 +
console.log("Teleported, touching object in 3 seconds...");
 +
 
 +
setTimeout(function() {
 +
Bot.touchPrim("a6b4be6c-ca10-398f-846e-ea933cebfda2");
 +
console.log("Object touched, waiting for object's message...");
 +
}, 3000);
 +
</syntaxhighlight>
 +
 
 +
The test object's LSL code is the following:
 +
<syntaxhighlight lang="lsl">
 +
default {
 +
    touch_start(integer total_number) {
 +
        llOwnerSay("touched by "+llDetectedName(0));
 +
        llRegionSayTo(llDetectedKey(0), 0, "I'm touched by " + llDetectedName(0));
 +
    }
 +
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 17:31, 21 August 2016

Touches an in-world object (prim) by its UUID

Bot.touchPrim(uuid);

Reference

This command accepts the following parameters:

Variable Required Description


Input:
uuid yes An UUID of the object to tough.
Output:
result This function does not return anything

Comment

It is important to remember that bot is able to touch objects it "sees":

  • after logging in, give bot about 30 seconds to load surrounding objects,
  • the same after teleporting,
  • nearby objects load faster than distant,
  • if you want bot to touch a distant object (say, another side of the sim), visit it first to "see and remember" it.

Examples

Touch a special test object in SmartBots office (the object is located at DuoLife/210/151/31):

// SmartBots Playground code start v1.0 (automatic line)
Bot.on("chat_message", function(event) {
	console.log("Got a message: " + event.message);

	// Teleport home. Please don't leave your bots at DuoLife!
	Bot.teleport("HOME");
});

// Goto to testing object
Bot.teleport("DuoLife/211/152/31");

console.log("Teleported, touching object in 3 seconds...");

setTimeout(function() {
	Bot.touchPrim("a6b4be6c-ca10-398f-846e-ea933cebfda2");
	console.log("Object touched, waiting for object's message...");
}, 3000);

The test object's LSL code is the following:

default {
    touch_start(integer total_number) {
        llOwnerSay("touched by "+llDetectedName(0));
        llRegionSayTo(llDetectedKey(0), 0, "I'm touched by " + llDetectedName(0));
    }
}