Hi Diva,<div><br></div><div>With pathfinding, a NPC has to navigate between virtual "waypoints" along a path to reach a goal. Currently I have a region module that can be queried by scripts and will generate a path that a NPC should be able to follow, then the NPC controller script checks the position of the NPC every 0.5 seconds and makes a decision if a waypoint has been reached or passed and which direction to travel in to reach the next waypoint. One problem I have is that the NPCs don't have a "at_target" event and that the 0.5 second default minimum timer interval is really too long to wait. Another issue is knowing when a NPC has reached a waypoint; it's possible that something may have influenced the NPC's direction and position while travelling to a waypoint and it has deviated from the straight path that was assumed when the path was generated. This becomes especially difficult when navigating around narrow areas with tight corners and many potential obstructions. Ideally I'd like the NPCs to be controlled by scripts but if I could generate events from a region module that the script could process, then the region module could use more complex logic to determine how well a path is being followed and if any corrections are necessary. I've not researched how such events can be passed to a script yet, but if you think this may be a potential application for your event system, I'd like to look into it further and maybe try a few ideas.</div>
<div><br></div><div>-dahlia<br><div><br><div class="gmail_quote">On Sun, Nov 18, 2012 at 5:28 PM, Diva Canto <span dir="ltr"><<a href="mailto:diva@metaverseink.com" target="_blank">diva@metaverseink.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am working on a module that passes interesting scene events up to the scripts in a manner that's very easy to act upon. An example is attached at the end of this message.<br>
<br>
Question: What other events would people like to grab? The idea is to have the module do all the complicated logic, and pass only simple facts to the scripts.<br>
<br>
<br>
    state_entry()<br>
    {<br>
        llSay(0, "Script running");<br>
        modSendCommand("Script Events", "subscribe|AvatarArrived", llGetKey());<br>
        modSendCommand("Script Events", "subscribe|LastAvatarLeft", llGetKey());<br>
    }<br>
<br>
    link_message(integer sender_num, integer num, string message, key id)<br>
    {<br>
        list parts = llParseString2List(message, ["|"], []);<br>
        if (llGetListLength(parts) >= 2) {<br>
            if (llList2String(parts, 1) == "AvatarArrived") {<br>
                // message is: event|AvatarArrived|True or False <-- LocalTeleport or HG Teleport<br>
                if (llGetListLength(parts) >= 3) {<br>
                    if (llList2String(parts, 2) == "True") {<br>
                        llInstantMessage(id, "Welcome to the Gateway! Choose your destination by walking into one of the teleporters.");<br>
                        llRegionSay(region_channel, "ports foreign");<br>
                    } else {<br>
                        llInstantMessage(id, "Welcome to the Virtual Lab's Gateway! Choose your local destination by walking into one of the teleporters.");<br>
                        llRegionSay(region_channel, "ports local");<br>
                    }<br>
                } else {<br>
                    llSay(0, "Malformed message " + message + " " + (string)llGetListLength(parts)<u></u>);<br>
                }<br>
                play_music();<br>
            } else if (llList2String(parts, 1) == "LastAvatarLeft") {<br>
                // message is: event|LastAvatarLeft<br>
                llRegionSay(region_channel, "ports reset");<br>
            }<br>
        }<br>
    }<br>
<br>
______________________________<u></u>_________________<br>
Opensim-dev mailing list<br>
<a href="mailto:Opensim-dev@lists.berlios.de" target="_blank">Opensim-dev@lists.berlios.de</a><br>
<a href="https://lists.berlios.de/mailman/listinfo/opensim-dev" target="_blank">https://lists.berlios.de/<u></u>mailman/listinfo/opensim-dev</a><br>
</blockquote></div><br></div></div>