Change font size
It is currently Sat Dec 15, 2018 1:32 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: region map
PostPosted: Sat Jul 07, 2012 3:07 am 

Joined: Tue Nov 16, 2010 7:45 am
Posts: 9
2010-11-11

Note the region map uses two OS functions which need to be enabled in the opensim.ini
Read http://opensimulator.org/wiki/OSSL_Enabling_Functions for help on enabling them.

Region map uses the following OS functions:
osGetAvatarList osGetMapTexture osTeleportAgent


create a prim
drop the makeMapBlipPrim script into it
make a new script and copy the MapBlip notecard into it
save the script
take the Blip prim into your inventory

create another prim
drop the makeMapPrim script into it
drop the Blip prim from your inventory into it
make sure the blip has copy permission
make a new script and copy the RegionMap notecard into it
save the script

should ask for link / delink permission

after you have run the test data a couple times
open the maps script and uncomment

// gAvatarList = osGetAvatarList();

then delete

// Test Data remove and uncomment the line above.
gAvatarList = ["000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-00",
"000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-01",
"000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-02",
"000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-03",
"000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-04"];
// End Test Data

MakeMapPrim
{L_CODE}:
default
{
    state_entry()
    {
        llSay(0, "Script running");
        llSetPrimitiveParams([
            7, <2.56,2.56,0.05>,
            9,0, 0, <0.0,1.0,0.0>, 0.0, <0.0,0.0,0.0>, <1.0,1.0,1.0>, <0.0,0.0,0.0>,
           27, "regionMap"]);
        llRemoveInventory(llGetScriptName());     
    }
}


makeMapBlipPrim
{L_CODE}:
default
{
    state_entry()
    {
        llSay(0, "Script running");
        llSetPrimitiveParams([
            7,<0.025,0.025,0.025>,
            9, 3, 0, <0.0,1.0,0.0>, 0.0, <0.0,0.0,0.0>, <0.0,1.0,0.0>,
           17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0,
           18, -1, <0.0,255.0,0.0>, 1.0,
           25, -1, 0.20,
           27, "Blip"]);

        llParticleSystem([
             PSYS_PART_FLAGS
             , 0
             | PSYS_PART_EMISSIVE_MASK
             | PSYS_PART_INTERP_COLOR_MASK
             | PSYS_PART_INTERP_SCALE_MASK
             | PSYS_PART_FOLLOW_SRC_MASK
             ,
           
             PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP,
           
             PSYS_SRC_MAX_AGE, 0.0,
             PSYS_SRC_BURST_RATE, 5.0,
             PSYS_SRC_BURST_PART_COUNT, 1,
           
             PSYS_SRC_ACCEL, <0.0,0.0,0.01>,
           
             PSYS_PART_MAX_AGE, 3.,
             PSYS_PART_START_COLOR, <0,1,0>,
             PSYS_PART_END_COLOR, <1,1,1>,
             PSYS_PART_START_ALPHA, 0.8,
             PSYS_PART_END_ALPHA, 0.,
           
             PSYS_PART_START_SCALE, <0.5,0.5,0>,
             PSYS_PART_END_SCALE, <.01,.01,0>]);
        llRemoveInventory(llGetScriptName());
    }
}



MapBlip
{L_CODE}:
integer gUnSet = TRUE;
key gAvatar = "";
vector gPosition = ZERO_VECTOR;
string gName = "";

default
{
    link_message(integer source, integer num, string data, key id)
    {
        if (gUnSet)
        {
            gUnSet = FALSE;
            integer cut = llSubStringIndex(data,"*");
            gAvatar = (key)llGetSubString(data, 0, cut - 1);
            string dataString = llGetSubString(data, cut + 1, -1);
            cut = llSubStringIndex(dataString,"*");
            gPosition = (vector)llGetSubString(dataString, 0, cut - 1);
            gName = llGetSubString(dataString, cut + 1, -1);

            llSetPos(<-1.28 + (gPosition.x / 100), -1.28 + (gPosition.y / 100), 0.035 + (gPosition.z / 100)>);
                 
            llSetText(gName, <0.0, 0.0, 0.0>, 1.0);
        }
    }
   
    touch_start(integer touched)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            osTeleportAgent(llDetectedKey(0), llGetRegionName(), gPosition, ZERO_VECTOR);
        }
    }
   
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            if (llGetLinkNumber() == 0) { llDie(); }
        }
    }
}


RegionMap
{L_CODE}:
integer gOn = FALSE;

list gAvatarList = [];

integer gAvatars = 0;
integer gAvatar = 0;

addBlip()
{
    if (gAvatar < gAvatars)
    {
        string dataString = "";
       
        dataString = llList2String(gAvatarList, gAvatar * 3) + "*";
        dataString = dataString + llList2String(gAvatarList, gAvatar * 3 + 1) + "*";
        dataString = dataString + llList2String(gAvatarList, gAvatar * 3 + 2);
                       
        llMessageLinked( LINK_SET, 0, dataString, "");
       
        gAvatar++;
       
        if (gAvatar < gAvatars) { llRezObject( "Blip", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, 1); }
    }
}

default
{
    on_rez(integer rezzed) { do { llSay(0, "resetting now"); llResetScript(); } while (TRUE); }
   
    changed(integer change)
    {
        if (change & (CHANGED_REGION_RESTART | CHANGED_REGION_START))
            do { llOwnerSay("Reseting..."); llResetScript(); } while (TRUE);
    }

    state_entry()
    {
        llSetTexture(osGetMapTexture(),0);
        llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS);
    }
   
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_CHANGE_LINKS) { state running; }
        else { llOwnerSay("Sorry, without this permissiom I cannot run."); }
    }
}

state running
{
    on_rez(integer rezzed) { do { llSay(0, "resetting now"); llResetScript(); } while (TRUE); }
   
    touch_start(integer touched)
    {
        if (gOn)
        {
            llSetTimerEvent(0);
            llBreakAllLinks();
        }
       
        gAvatar = 0;

        //  gAvatarList = osGetAvatarList();
        // Test Data remove and uncomment the line above.
        gAvatarList = ["000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-00",
                       "000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-01",
                       "000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-02",
                       "000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-03",
                       "000000-0000-0000-0000-000000000000", <llFrand(256.0), llFrand(256.0), llFrand(256.0)>, "Avatar-04"];
        // End Test Data
       
        if (gAvatarList == []) { llOwnerSay("No one detected."); }
        else
        {
            gOn = TRUE;
            llSetTimerEvent(300.0);
            gAvatars = llGetListLength(gAvatarList) / 3;
            llRezObject( "Blip", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, 1);
        }
    }
   
    object_rez(key id)
    {
        llCreateLink(id, TRUE);
        addBlip();
    }
   
    timer()
    {
        llSetTimerEvent(0);
        llBreakAllLinks();
        gOn = FALSE;
    }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net