[Opensim-dev] ScriptEvents Module

Diva Canto diva at metaverseink.com
Mon Nov 19 03:17:25 UTC 2012


Dahlia, your scenario seems appropriate for this. The module would hook 
on one of the movement events that scene generates.

I'm glad to see Melanie making these real events; it will make the LSL 
code look a little nicer. But independent of the syntax, it's good to 
know what events people would like to get in their scripts. I did those 
two in the example because I needed them. I'll be happy to add more. The 
module is here:
https://github.com/diva/diva-distribution/blob/master/addon-modules/Modules/ScriptEventsModule.cs

Diva


On 11/18/2012 6:48 PM, Dahlia Trimble wrote:
> Hi Diva,
>
> 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.
>
> -dahlia
>
> On Sun, Nov 18, 2012 at 5:28 PM, Diva Canto <diva at metaverseink.com 
> <mailto:diva at metaverseink.com>> wrote:
>
>     Hi,
>
>     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.
>
>     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.
>
>
>         state_entry()
>         {
>             llSay(0, "Script running");
>             modSendCommand("Script Events", "subscribe|AvatarArrived",
>     llGetKey());
>             modSendCommand("Script Events",
>     "subscribe|LastAvatarLeft", llGetKey());
>         }
>
>         link_message(integer sender_num, integer num, string message,
>     key id)
>         {
>             list parts = llParseString2List(message, ["|"], []);
>             if (llGetListLength(parts) >= 2) {
>                 if (llList2String(parts, 1) == "AvatarArrived") {
>                     // message is: event|AvatarArrived|True or False
>     <-- LocalTeleport or HG Teleport
>                     if (llGetListLength(parts) >= 3) {
>                         if (llList2String(parts, 2) == "True") {
>                             llInstantMessage(id, "Welcome to the
>     Gateway! Choose your destination by walking into one of the
>     teleporters.");
>                             llRegionSay(region_channel, "ports foreign");
>                         } else {
>                             llInstantMessage(id, "Welcome to the
>     Virtual Lab's Gateway! Choose your local destination by walking
>     into one of the teleporters.");
>                             llRegionSay(region_channel, "ports local");
>                         }
>                     } else {
>                         llSay(0, "Malformed message " + message + " "
>     + (string)llGetListLength(parts));
>                     }
>                     play_music();
>                 } else if (llList2String(parts, 1) == "LastAvatarLeft") {
>                     // message is: event|LastAvatarLeft
>                     llRegionSay(region_channel, "ports reset");
>                 }
>             }
>         }
>
>     _______________________________________________
>     Opensim-dev mailing list
>     Opensim-dev at lists.berlios.de <mailto:Opensim-dev at lists.berlios.de>
>     https://lists.berlios.de/mailman/listinfo/opensim-dev
>
>
>
>
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20121118/30330f0c/attachment-0001.html>


More information about the Opensim-dev mailing list