osNpcSay not working?

Creating scripts
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

osNpcSay not working?

Post by John Mela »

I've been trying to use the osNpcSay() function, and it seems to fail silently. There's an example on that linked page to test it, which I've pasted at the end of this message.

The same applies to osNpcWhisper() and osNpcShout(). I'm in my own world, and other NPC functions such as osNpcCreate(), osNpcMoveToTarget(), etc work fine. It also works fine on a vanilla OS 0.9 grid.

Is this a Kitely issue? Thanks in advance!

Testing example:

Code: Select all

key npc;
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osNpcSay (without channel) usage.");
    }
 
    touch_start(integer number)
    {
        key toucher = llDetectedKey(0);
        vector npcPos = llGetPos() + <-1.0, 0.0, 1.0>;
        osAgentSaveAppearance(toucher, "appearance");
        npc = osNpcCreate("ImYour", "Clone", npcPos, "appearance");
        state hasNPC;
    }
}
 
state hasNPC
{
    state_entry()
    {
        llSetTimerEvent(5.0);
    }
 
    timer()
    {
        llSetTimerEvent(0.0);
        osNpcSay(npc, "Hello world!");
        osNpcSay(npc, "I Love OpenSimulator!");
        osNpcSay(npc, "The Open Source Metaverse!");
    }
 
    touch_start(integer number)
    {
        osNpcSay(npc, "Goodbye!");
        llSetTimerEvent(0.0);
        osNpcRemove(npc);
        npc = NULL_KEY;
        state default;
    }
}
These users thanked the author John Mela for the post:
Ilan Tochner
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4968 times
Been thanked: 4469 times
Contact:

Re: osNpcSay not working?

Post by Ilan Tochner »

Hi John,

This likely relates to OSSL permissions of your avatar on the world you're in. See: https://www.kitely.com/virtual-world-ne ... functions/
These users thanked the author Ilan Tochner for the post:
John Mela
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: osNpcSay not working?

Post by John Mela »

Thanks Ilan.

But I'm in my own world, and other NPC functions work fine.

The page you linked says that the following functions are "Allowed for the World Manager and Estate Managers", and this is my own world. And other functions in this list work fine:

Code: Select all

osNpcCreate
osNpcGetOwner
osNpcGetPos
osNpcGetRot
osNpcLoadAppearance
osNpcMoveTo
osNpcMoveToTarget
osNpcPlayAnimation
osNpcRemove
osNpcSaveAppearance
osNpcSay
osNpcSayTo
osNpcSetProfileAbout
osNpcSetProfileImage
osNpcSetRot
osNpcShout
osNpcSit
osNpcStand
osNpcStopAnimation
osNpcStopMoveToTarget
osNpcTouch
osNpcWhisper
For example, I'm using osNpcCreate, osNpcMoveToTarget, osNpcStopMoveToTarget, osNpcSit, osNpcStand, osNpcTouch, osNpcPlayAnimation and osNpcStopAnimation, all from the same list.

The functions that don't work are osNpcSay, osNpcShout and osNpcWhisper.

Could you look into this please? Thanks.
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4968 times
Been thanked: 4469 times
Contact:

Re: osNpcSay not working?

Post by Ilan Tochner »

Is your avatar the one that created the NPCs that you're trying to use these functions on?
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: osNpcSay not working?

Post by John Mela »

Yes, the script that creates the NPCs is in an object owned by me (the world owner). The design of the system we're developing depends on the objects being owned by the region owner or administrator, so that's a reasonable requirement.
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4968 times
Been thanked: 4469 times
Contact:

Re: osNpcSay not working?

Post by Ilan Tochner »

Hi John,

I tested the script you posted by rezzing a cube in Kitely Merchants Sandbox adding that script to it then pressing the cube. The script works and the NPC messages appear in local chat. In other words, I can't reproduce the problem you reported.
These users thanked the author Ilan Tochner for the post:
John Mela
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: osNpcSay not working?

Post by John Mela »

Thanks, Ilan, that's surprising and very helpful. I'll look into this some more and report back.
These users thanked the author John Mela for the post:
Ilan Tochner
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: osNpcSay not working?

Post by Graham Mills »

I have very vague recollections of something like this happening once. I wonder if the chat is emitted in the wrong place, perhaps where the npc rezzed rather than its current location. You might need some sort of relay.
These users thanked the author Graham Mills for the post:
Ilan Tochner
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: osNpcSay not working?

Post by John Mela »

Thanks, Graham. In this case, though, both the rezzing objects and the NPCs were very close to me, certainly within the 20m limit for chat (not to mention the shout distance!).
These users thanked the author John Mela for the post:
Graham Mills
User avatar
John Mela
Posts: 91
Joined: Tue Feb 04, 2014 9:50 pm
Has thanked: 139 times
Been thanked: 127 times
Contact:

Re: osNpcSay not working?

Post by John Mela »

OK, I've managed to find out why it was working on some regions and not others. It's the "Anyone can visit" checkbox on the Access tab of About Land.

Ilan, could you try disabling that option, and run the test again?

I find that if I disable that option, osNpcSay chat on channel 0 doesn't get propagated (including scripted listeners), but works OK on non-public channels. If I enable the option, everything works. I normally have that option disabled on my land, which is why it wasn't working for me.

Presumably, this isn't intended behaviour!
These users thanked the author John Mela for the post:
Graham Mills
Post Reply