OsNpcSayTo

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Add See Also)
m (Change See Also)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
 
|threat_level=High
 
|threat_level=High
|permissions=${XEngine|osslNPC}
+
|permissions=${OSSL|osslNPC}
 
|delay=0
 
|delay=0
 
|function_syntax=osNpcSayTo(key npc, key target, integer channel, string message)
 
|function_syntax=osNpcSayTo(key npc, key target, integer channel, string message)
|ossl_example= ...
 
 
|description='''npc''' says '''message''' on the given '''channel''' to the specified '''target'''
 
|description='''npc''' says '''message''' on the given '''channel''' to the specified '''target'''
|additional_info=This function was added in 0.9.0.1 Dev
+
|ossl_example=<source lang="lsl">
 +
//
 +
// osNpcSayTo Script Exemple
 +
// Author: djphil
 +
//
 +
 
 +
key npc;
 +
key user;
 +
 
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        llSay(PUBLIC_CHANNEL, "Touch to see osNpcSayTo usage.");
 +
    }
 +
 
 +
    touch_start(integer number)
 +
    {
 +
        user = llDetectedKey(0);
 +
        vector npcPos = llGetPos() + <-1.0, 0.0, 1.0>;
 +
        osAgentSaveAppearance(user, "appearance");
 +
        npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance");
 +
        state hasNPC;
 +
    }
 +
}
 +
 
 +
state hasNPC
 +
{
 +
    state_entry()
 +
    {
 +
        llSetTimerEvent(5.0);
 +
    }
 +
 
 +
    timer()
 +
    {
 +
        llSetTimerEvent(0.0);
 +
        osNpcSayTo(npc, user, PUBLIC_CHANNEL, "Hello world!");
 +
        osNpcSayTo(npc, user, PUBLIC_CHANNEL, "I Love OpenSimulator!");
 +
        osNpcSayTo(npc, user, PUBLIC_CHANNEL, "The Open Source Metaverse!");
 +
    }
 +
 
 +
    touch_start(integer number)
 +
    {
 +
        osNpcSayTo(npc, user, PUBLIC_CHANNEL, "Goodbye!");
 +
        llSetTimerEvent(0.0);
 +
        osNpcRemove(npc);
 +
        npc = NULL_KEY;
 +
        state default;
 +
    }
 +
}
 +
</source>
 +
|additional_info=This function was added in 0.9.1.0 Dev<br>
 +
This function is based on llRegionSayTo, it therefore has no range limitation inside the region.
 
}}
 
}}
'''See Also'''
+
== See Also ==
 +
* [[osNpcWhisper]]
 
* [[osNpcSay]]
 
* [[osNpcSay]]
 +
* [[osNpcSayTo]]
 
* [[osNpcShout]]
 
* [[osNpcShout]]
* [[osNpcWhisper]]
 

Latest revision as of 19:53, 5 December 2020

osNpcSayTo(key npc, key target, integer channel, string message)
npc says message on the given channel to the specified target
Threat Level High
Permissions ${OSSL|osslNPC}
Extra Delay 0 seconds
Example(s)
//
// osNpcSayTo Script Exemple
// Author: djphil
//
 
key npc;
key user;
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osNpcSayTo usage.");
    }
 
    touch_start(integer number)
    {
        user = llDetectedKey(0);
        vector npcPos = llGetPos() + <-1.0, 0.0, 1.0>;
        osAgentSaveAppearance(user, "appearance");
        npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance");
        state hasNPC;
    }
}
 
state hasNPC
{
    state_entry()
    {
        llSetTimerEvent(5.0);
    }
 
    timer()
    {
        llSetTimerEvent(0.0);
        osNpcSayTo(npc, user, PUBLIC_CHANNEL, "Hello world!");
        osNpcSayTo(npc, user, PUBLIC_CHANNEL, "I Love OpenSimulator!");
        osNpcSayTo(npc, user, PUBLIC_CHANNEL, "The Open Source Metaverse!");
    }
 
    touch_start(integer number)
    {
        osNpcSayTo(npc, user, PUBLIC_CHANNEL, "Goodbye!");
        llSetTimerEvent(0.0);
        osNpcRemove(npc);
        npc = NULL_KEY;
        state default;
    }
}
Notes
This function was added in 0.9.1.0 Dev

This function is based on llRegionSayTo, it therefore has no range limitation inside the region.


[edit] See Also

Personal tools
General
About This Wiki