Jump to content

Ron Khondji

Resident
  • Posts

    352
  • Joined

  • Last visited

Posts posted by Ron Khondji

  1. First:
    You don't need an integer u in the sensor event.
    Do:

    ids += [llDetectedKey(i)];

     

    Then, in the listen event, you need to find the index of the name in names and use that same index to get the key from ids.
    Something like:

    integer index = llListFindList(names, [msg]);llRegionSayTo(llList2Key(ids, index), "blah blah");

     

  2. I do not know the answer to your question.
    What I did notice was a very strange construction you use in your listen event.

    Instead of:

      string player = llGetDisplayName(llDetectedKey(0));  llSay(0, "/me " + "secondlife:///app/agent/" + (string) id + "/displayname rolled " + (string)roll + ", " + message);

     You could have done:

      string player = llGetDisplayName(id);  llSay(0, "/me " + player + " rolled " + (string)roll + ", " + message);

    Because llDetectedKey() only works in touch and sensor events, and the key of the 'speaker' is allready available in the listen event.

  3. After finally having read what you are trying to do, or atleast what I think it is that you are trying to do, I have to ask this: why not keep it simple?

    Have 1 script to handle the attaching, checcking and 'touch interacting' stuff.
    Have another to do the animation stuff.
    And the last for the avatar communications.

    Use link messages to communicat between the scripts.

    Kinda like this is what I mean: 

    Script 1

    default {    state_entry() {        llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);        llSetTimerEvent(10.0);    }    run_time_permissions(integer perm) {        llSetTimerEvent(.0);        if (perm & PERMISSION_ATTACH) llAttachToAvatar(38);        else llDie();    }        attach(key id) {        if (id) llMessageLinked(LINK_SET, 1, "ATTACHED", "");        else {            llMessageLinked(LINK_SET, 1, "DETACHED", "");            llSetTimerEvent(5.0);        }        }        touch_end(integer num) {        llMessageLinked(LINK_SET, 1, "TOUCHED", "");    }            timer() {        llDie();    }                on_rez(integer rez) {        if (!llGetAttached()) llResetScript();    }      }

     

    Script 2 and 3

    default {    link_message(integer linknum, integer num, string message, key id) {        if (message == "ATTACHED") {            // do stuff        }        if (message == "DETACHED") {            // do some cleanup stuff        }        if (message == "TOUCHED") {            // do stuff        }    }}

     

    I think the above scripts do what you want without all the confusing multiple events and states.

  4. After resetting the "allow attachment dialog" pops up.

    Clicking 'yes' results in a lot of ownersay spam, a couple of "Could not find script MultiScriptxx" and a attached box.
    Touching the attached box gives this:

    [12:50] Object: 1389387016 M3: touched in Runtime state
    [12:50] Object: 1389387016 U3: touched in Runtime state
    [12:50] Object: 1389387016 S3: touched in Runtime state

     

  5. A 1 second timer in combination with a counter might be what you need.
    Like this:

    integer seconds;default{    state_entry(){        llSetTimerEvent(1.0);    }        timer(){        ++seconds;        if (seconds == 5){            // do something after 5 seconds        }        if (seconds == 7){           // do something after 7 seconds        }         seconds = 0;    }}

     

  6. How about this:

    default {    state_entry() {        string texture = llGetInventoryName(INVENTORY_TEXTURE, 0);        llParticleSystem([                    PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK,                    PSYS_SRC_PATTERN, 4,                    PSYS_PART_START_ALPHA, 1.0,                    PSYS_PART_END_ALPHA, 1.0,                    PSYS_PART_START_COLOR, <1.0,1.0,1.0>,                   PSYS_PART_END_COLOR, <1.0,1.0,1.0>,                   PSYS_PART_START_SCALE, <1.0, 1.0, .0>,                   PSYS_PART_MAX_AGE, 1.20,                    PSYS_SRC_MAX_AGE, 0.00,                    PSYS_SRC_ACCEL, <0.0,0.0,0.0>,                    PSYS_SRC_ANGLE_BEGIN, 0.00,                    PSYS_SRC_ANGLE_END, 0.00,                    PSYS_SRC_BURST_PART_COUNT, 8,                   PSYS_SRC_BURST_RADIUS, .75,                    PSYS_SRC_BURST_RATE, 0.10,                    PSYS_SRC_BURST_SPEED_MIN, 0.00,                   PSYS_SRC_BURST_SPEED_MAX, 0.00,             PSYS_SRC_OMEGA, <0.00,0.00,0.00>,            PSYS_SRC_TEXTURE, texture            ]);    }    changed(integer c) {        if (c & CHANGED_INVENTORY) llResetScript();    }}

     Put the script together with a texture in some prims inventory.

  7. My 0.02 L$:

    string round( float F, integer decimals ) {    decimals = llAbs(decimals);    F = llRound(F * llPow(10, decimals)) / llPow(10, decimals);    list temp = llParseString2List((string)F, ["."], []);    string left = llList2String(temp, 0);    string right;    if(decimals) right = "." + llGetSubString(llList2String(temp, 1), 0, decimals - 1);       return left + right;} default {    state_entry() {        llOwnerSay(round(456.94575824, 0));    }}

     

  8. I tried this little script:

    key HTTP;default{    touch_start(integer total_number)    {        HTTP = llHTTPRequest("http://opps.incarnate.me/test.php", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],  "");    }    http_response(key request_id, integer status, list metadata, string body) {        if (request_id == HTTP) {            llOwnerSay("Status: " + (string)status + "\nBody: " + body);        }    }}

     

    This is what I got back:

    [08:44] Object: Status: 200
    Body: 
    LSL Script answered:<br>
     
    Which makes me think your php script and server are working just fine.
     
    Allthough I'm probably missing the point completely :)
  9. I just like if(toggle = !toggle) better than:

    if (!toggle) {    toggle = TRUE;    // etc.}else {    toggle = FALSE;    // etc.}

    Furthermore, in the case of my example script it does work on first touch after a reset..
    State_entry() sets the media. First touch on the prim turns it off. Second touch turns it on again, and so forth.

    And, yes llClearPrimMedia() works just as well if the object is deeded to the land owning group.

  10. One problem is: left clicking on a face which has a web page on it is like clicking on the web page. So you either have to richt click and select "touch" from the menu, or click on a face of the prim that has no media.

    Having said that, here's one way to turn media on and off.

    integer toggle;SetMedia() {    llWhisper(0, "Starting Media On Prim");    llSetPrimMediaParams(0,                                    [PRIM_MEDIA_AUTO_PLAY, TRUE,                            PRIM_MEDIA_CURRENT_URL, "http://google.com",            PRIM_MEDIA_HOME_URL, "http://google.com",              PRIM_MEDIA_HEIGHT_PIXELS, 512,                          PRIM_MEDIA_WIDTH_PIXELS, 512]);                }default {    state_entry() {        SetMedia();    }    touch_start(integer num) {        if (toggle = !toggle) {            llClearPrimMedia(0);        }        else {            SetMedia();        }    }}

     

    • Like 1
×
×
  • Create New...