MantisBT - opensim
View Issue Details
0008400opensim[REGION] Script Functionspublic2018-10-25 14:222019-10-25 16:07
Mandarinka Tasty 
 
normaltweakalways
acknowledgedwon't fix 
0.9.0.1 
 
Standalone (1 Region) , Standalone (Multiple Regions) , Grid (1 Region per Sim) , Grid (Multiple Regions per Sim)
BasicPhysics, ODE, BulletSim, ubODE
Mono / Linux32, Mono / Linux64, Mono / Windows, Mono / OSX, .NET / Windows32, .NET / Windows64
5.x
0008400: More logical NPC's detection with llGetAgentList and replacing ssp.IsViewerUIGod with ssp.IsGod.
Hello.

I've added more logical processing of NPCs' detection accordingly to applied NPC flags. Addtionally I've replaced ScenePresence bool IsViewerUIGod with correct IsGod.

The description of logics I have applied is as follows:

1. If bool AllowSenseAsAvatar = false ( OpenSim.ini , OpenSimDefaults.ini)

then NPC detection is not possible with llGetAgentList

Now we set AllowSenseAsAvatar = true in ini file.

2. If flag AGENT_LIST_EXCLUDENPC is applied as a scope in llGetAgentList

then NPC detection is not possible with llGetAgentList.

3. If NPC is not created with flag OS_NPC_SENSE_AS_AGENT within osNpcCreate

then NPC detection is not possible with llGetAgentList.

Those cases have been introduced by me as logical union = p v q v r,that means if one of them is true, then NPC detection is not possible with llGetAgentList.

To make NPC detection possible with my version of llGetAgentList one needs:

1. set bool AllowSenseAsAvatar = true in ini file.
2. do not use flag AGENT_LIST_EXCLUDENPC
3. create NPC using osNpcCreate with flag: OS_NPC_SENSE_AS_AGENT

I hope my explanations above are appropriately understandable.

In-world script school example:

integer i;
key npc = NULL_KEY;

default
{
    touch_start(integer num)
    {
        if(npc == NULL_KEY)
        {
            osOwnerSaveAppearance("MyClone");
            llSetTimerEvent(2);
        }
        else
        {
            osNpcRemove(npc);
            llRemoveInventory("MyClone");
            llResetScript();
        }
    }
    timer()
    {
        llSetTimerEvent(0);
        if(i == 0)
        {
            npc = osNpcCreate("John","Smith",llGetPos()+<0,0,2>,"MyClone",OS_NPC_SENSE_AS_AGENT);
            i=1;
            llSetTimerEvent(5);
        }
        else
        {
            list agents = llGetAgentList(AGENT_LIST_REGION, []);
            integer j;
            while (j < llGetListLength(agents))
            {
                string bot = "";
                key id = llList2Key(agents,j);
                string name = llKey2Name(id);
                if(npc == id)
                {
                    bot = "\t<--- NPC has been detected!\n"
                }
                llOwnerSay(name + " [ " + (string)id + " ]" + bot);
                ++j;
            }
        }
    }
}
No tags attached.
Issue History
2018-10-25 14:22Mandarinka TastyNew Issue
2018-10-25 14:22Mandarinka TastyFile Added: 0001-More-logical-NPC-s-detection-with-llGetAgentList-and.patch
2018-10-25 14:23Mandarinka TastyStatusnew => patch included
2018-10-25 14:24Mandarinka TastyDescription Updatedbug_revision_view_page.php?rev_id=7009#r7009
2018-10-25 14:25Mandarinka TastyDescription Updatedbug_revision_view_page.php?rev_id=7010#r7010
2018-10-25 14:25Mandarinka TastyDescription Updatedbug_revision_view_page.php?rev_id=7011#r7011
2018-10-25 14:50Mandarinka TastyDescription Updatedbug_revision_view_page.php?rev_id=7012#r7012
2018-10-26 16:23Mandarinka TastyDescription Updatedbug_revision_view_page.php?rev_id=7025#r7025
2018-10-26 18:18BillBlightNote Added: 0033269
2018-10-26 18:19BillBlightNote Edited: 0033269bug_revision_view_page.php?bugnote_id=33269#r7027
2018-10-26 19:06Mandarinka TastyNote Added: 0033270
2018-10-26 19:08BillBlightNote Added: 0033271
2018-10-26 19:23Mandarinka TastyNote Added: 0033272
2019-10-25 14:42Mandarinka TastyFile Deleted: 0001-More-logical-NPC-s-detection-with-llGetAgentList-and.patch
2019-10-25 14:43Mandarinka TastyNote Added: 0035776
2019-10-25 14:43Mandarinka TastyStatuspatch included => resolved
2019-10-25 14:43Mandarinka TastyResolutionopen => won't fix
2019-10-25 14:43Mandarinka TastyAssigned To => Mandarinka Tasty
2019-10-25 16:07BillBlightAssigned ToMandarinka Tasty =>
2019-10-25 16:07BillBlightStatusresolved => acknowledged

Notes
(0033269)
BillBlight   
2018-10-26 18:18   
(edited on: 2018-10-26 18:19)
Not that I mind this, but just an observation ..

SL does not have NPC, so should we be adopting ll functions to fit us, and be outside of ll spec or just use our own functions such as the existing osGetNPCList() ?


Just not sure it is a good habit to get into ..

(0033270)
Mandarinka Tasty   
2018-10-26 19:06   
@watcher )
First at all, SL does not care what we do or not do with functions that have been designed by LL. All our efforts are meaningless for them , if we repeat those functions with 1-1 precision, or we modify them due to our needs.
It is impossible to make ideal clone of SL, and also mighty majority of people do not want that.
Hence, as you notice, reading my words, I opt for adopting LL functions and modyfing them into our environment accordingly to our needs, wishes etc.
I also consider that reaching LL spec is useless in OpenSim, because it's not possible in 100%. We can try to "stand on our heads" and we will not repeat it as they did. So for what to keep those functions exactly the same?
Additionally, code is opensourced, so anyone is free to set it as he/she wants.

Our osGetNPCList() is very nice tool to detect and list only NPCs.
That is why I have decided to limit using llGetAgentList with NPC and only allow if they are sensed as avatars = agents and not excluded from detection. That is more logical in my opinion. Personally i would even eliminate scanning NPCs with llGetAgentList, but let us do some consensus.
What do you think about my thoughts?
(0033271)
BillBlight   
2018-10-26 19:08   
Yeah was not trying to start a debate, I just see a lot of people scream "We need to be exactly like LL" and then at the same time they scream the opposite when it does not do exactly what they want ...


I'll just keep my opinions to myself in the future ..
(0033272)
Mandarinka Tasty   
2018-10-26 19:23   
@watcher )
Please always share your opinions, because it gives us/me possibility to observe problems and concepts from other perspective. Thanks in advance.
What I've been personally observing for the very long time is: people rather want to look exactly here, as their SL avatars. And many of them also would like LL scripted functions to be improved.
(0035776)
Mandarinka Tasty   
2019-10-25 14:43   
The patch has been removed by the author.