Jump to content

JDroo

Resident
  • Posts

    17
  • Joined

  • Last visited

Posts posted by JDroo

  1. @ellestones  that is not the issue. I have no problem with the 0.1 delay, my issue is the delay of having to reset the script and then re read the card before being able to so anything.

    I want to be able to change the notecard on the fly, dump previous collected data from the previous card and load in the data of a newly selected card. Is there no way to clear stored data in the memory of the script on the fly?

    • Thanks 1
  2. Okay, this script is kinda big and a mess. [wrote by me, so it's pretty much garbo WIP] but it works.

    it works.. but i have to reset the script to get it to read the newly selected notecard, and this means it has to rebuild the notecard list, then grab the notecard name i stored in the 2nd child prim of the linkset's description [so it's saved between resets...blah blah] then finally texture using the new data.

    I do not want it to work this way. it's slow and bothersome having to wait after each time i select a new texture notecard from the menu.

    I've been trying for hours to get it to texture after selecting a notecard, without resetting anything. is there a way to clear the previous dataserver junk collected from the previous card and simply reload a new card?

    I want it to be able to reload a new notecard without resting the script.

    Please tell me it's possible, and please can someone show me how to do this.

    thanx lots in advanced

    here is the script:

     

    string uuids;
    string BLANK = "✭";
    integer current_menu;
    list NEXT;
    integer dialogChannel;
    list texture_names;
    list texture_uuids;
    list scalesx;
    list scalesy;
    list offsetx;
    list offsety;
    string current;
    integer finished_loading;
    integer counter;
    integer listenHandle;
    integer menu_page;
    key rpic;
    key lpic;
    key fpic;
    key bpic;
    key tapez;
    key printz;
    key tfrillz;
    key bfrillz;
    float srpicx;
    float slpicx;
    float sfpicx;
    float sbpicx;
    float stapezx;
    float sprintzx;
    float stfrillzx;
    float sbfrillzx;
    float srpicy;
    float slpicy;
    float sfpicy;
    float sbpicy;
    float stapezy;
    float sprintzy;
    float stfrillzy;
    float sbfrillzy;
    float orpicx;
    float olpicx;
    float ofpicx;
    float obpicx;
    float otapezx;
    float oprintzx;
    float otfrillzx;
    float obfrillzx;
    float orpicy;
    float olpicy;
    float ofpicy;
    float obpicy;
    float otapezy;
    float oprintzy;
    float otfrillzy;
    float obfrillzy;
    integer USELAYERS;
    integer PICLAYERS;
    integer ADDON1;
    integer ADDON2;
    integer ADDON3;
    integer ADDON4;
    integer ADDON5;
    integer ADDON6;
    integer ADDON7;
    getLinks() {
      integer total = llGetNumberOfPrims() + 1;
      string name;
      while ((total--) - 1) {
        name = llGetLinkName(total);
        if (name == "USE LAYERS") USELAYERS = total;
        if (name == "PIC LAYERS") PICLAYERS = total;
        if (name == "ADD ON 1") ADDON1 = total;
        if (name == "ADD ON 2") ADDON2 = total;
        if (name == "ADD ON 3") ADDON3 = total;
        if (name == "ADD ON 4") ADDON4 = total;
        if (name == "ADD ON 5") ADDON5 = total;
        if (name == "ADD ON 6") ADDON6 = total;
        if (name == "ADD ON 7") ADDON7 = total;
      }
      name = "";
    }
    remove_listen_handle() {
      llListenRemove(listenHandle);
    }
    key line_request_id;
    key read_request_id;
    integer line_total;
    integer line_index;
    string read_status;
    integer textureCount;
    FinishLoading() {
      llListen(dialogChannel, "", "", "");
      Page(0);
      finished_loading = TRUE;
            getLinks();
            llSetLinkPrimitiveParamsFast(PICLAYERS, [PRIM_TEXTURE, 2, rpic, < srpicx, srpicy, 0 > , < orpicx, orpicy, 0 > , 0]); //right cutie
            llSetLinkPrimitiveParamsFast(PICLAYERS, [PRIM_TEXTURE, 3, lpic, < slpicx, slpicy, 0 > , < olpicx, olpicy, 0 > , 0]); //left cutie
            llSetLinkPrimitiveParamsFast(PICLAYERS, [PRIM_TEXTURE, 1, fpic, < sfpicx, sfpicy, 0 > , < ofpicx, ofpicy, 0 > , 0]); //frpnt pic
            llSetLinkPrimitiveParamsFast(PICLAYERS, [PRIM_TEXTURE, 4, bpic, < sbpicx, sbpicy, 0 > , < obpicx, obpicy, 0 > , 0]); //back pic
            llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, 1, printz, < sprintzx, sprintzy, 0 > , < oprintzx, oprintzy, 0 > , 0]); //main print
            llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, 4, tfrillz, < stfrillzx, stfrillzy, 0 > , < otfrillzx, otfrillzy, 0 > , 0]); //top ruffles
            llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, 3, bfrillz, < sbfrillzx, sbfrillzy, 0 > , < obfrillzx, obfrillzy, 0 > , 0]); //bottom ruffles
            llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, 2, tapez, < stapezx, stapezy, 0 > , < otapezx, otapezy, 0 > , 0]); //tapes
              current_menu = 0;
              Menu();
    }
    GetSongNames() {
      if (llGetInventoryKey(uuids)) line_request_id = llGetNumberOfNotecardLines(uuids);
      else {
        llInstantMessage(llGetOwner(), "Finished loading, a notecard went missing?, choosing random and rebooting.");
        integer randocard = (integer)llFrand(llGetInventoryNumber(INVENTORY_NOTECARD));
        string rando = llGetInventoryName(INVENTORY_NOTECARD,randocard);
        llSetLinkPrimitiveParams(2, [PRIM_DESC, rando]);
        llResetScript();
      }
    }
    Menu() {
      string text;
      list buttons;
      integer type = 1;
      if (current_menu == 0) {
        text = " ";
        buttons += [BLANK, "[NOTECARD]", BLANK, BLANK, "[EXIT]", BLANK];
      } else if (current_menu == 1) {
        text = "ᴛᴇxᴛᴜʀᴇs\n";
        integer i;
        integer l = llGetListLength(NEXT);
        string name;
        for (i = 0; i < l; i++) {
          name = llList2Key(NEXT, i);
          text += name + "\n";
          buttons += llGetSubString(name, 0, 23);
        }
        buttons += ["[⇐ PREV]", "[BACK]", "[NEXT ⇒]"];
      } else if (current_menu == 4) {
        text = "sᴇʟᴇᴄᴛ ᴛʜᴇ ᴛᴇxᴛᴜʀᴇ NOTECARD ʏᴏᴜ ᴡɪsʜ ᴛᴏ ᴜsᴇ\nɪꜰ ʏᴏᴜ ᴍᴀᴋᴇ ᴀ sᴇʟᴇᴄᴛɪᴏɴ ᴛʜᴇ ᴍᴇɴᴜ ᴡɪʟʟ ᴄʟᴏsᴇ ᴀɴᴅ sᴄʀɪᴘᴛ ᴡɪʟʟ ʀᴇsᴇᴛ.";
        integer count = llGetInventoryNumber(INVENTORY_NOTECARD);
        integer i;
        integer start = menu_page * 9;
        integer end = start + 9;
        for (i = start; i < count && i < end; i++) {
          string num = (string)(i + 1) + " ";
          string name = llGetInventoryName(INVENTORY_NOTECARD, i);
          buttons += name;
        }
        if (menu_page >= 1) {
          buttons += ["[⇐ PREV]"];
        } else {
          buttons += [" "];
        }
        buttons += ["[BACK]"];
        if (menu_page < count / 8) {
          buttons += ["[NEXT ⇒]"];
        } else {
          buttons += [" "];
        }
    }
      if (type == 1) {
        buttons = llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
        llDialog(llGetOwner(), text, buttons, dialogChannel);
    }
    }
    MenuListener(key id, string message) {
      if (llGetOwner() == llGetOwnerKey(id) && message == "menu") {
        Menu();
      } else if (current_menu == 0) {
        if (message == "[NOTECARD]") {
          current_menu = 4;
          Menu();
        } else if (message == "[EXIT]")
        {
          llListenRemove(listenHandle);
          llSetScriptState("[NEZZY TEXTURES]",FALSE);
          llSetScriptState("[NEZZY CORE]",TRUE);
            } 
        else if (message == BLANK) llListenRemove(listenHandle);
      } else if (current_menu == 4) {
        if (message == "[⇐ PREV]") {
          if (menu_page > 0) {
            menu_page--;
          }
          Menu();
        } else if (message == "[BACK]") {
          current_menu = 0;
          Menu();
        } else if (message == "[NEXT ⇒]") {
          integer l = llGetInventoryNumber(INVENTORY_NOTECARD);
          if (menu_page < l) {
            menu_page++;
          }
          Menu();
        } else if (message == " ") {
          Menu();
        } else {
          string NOTECARD = llGetInventoryName(INVENTORY_NOTECARD, (integer) message - 1);
          llSetLinkPrimitiveParams(2, [PRIM_DESC, (string) message]);
          llInstantMessage(llGetOwner(), "Selecting notecard: ''" + (string) message + "'', Rebooting.");
          llResetScript();
        }
      }}
    Page(integer p) {
      NEXT = llList2List(texture_names, p * 9, p * 9 + 8);
    }
    default {
      changed(integer change) {
        if (change & CHANGED_INVENTORY) {
          llInstantMessage(llGetOwner(), "Something has changed... Rebooting.");
          llResetScript();
        }
        if (change & CHANGED_OWNER) {
          llResetScript();
        }
      }
        state_entry() {
          uuids = (string) llGetLinkPrimitiveParams(2, [PRIM_DESC]);
          llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
          finished_loading = FALSE;
          counter = 0;
          GetSongNames();
          dialogChannel = -1 - (integer)("0x" + llGetSubString((string) llGetKey(), -7, -1));
          listenHandle = llListen(dialogChannel, "", llGetOwner(), "");
        }
        dataserver(key requested, string data) {
          if (requested == line_request_id) {
            line_total = (integer) data;
            read_request_id = llGetNotecardLine(uuids, line_index++);
          }
          if (requested != read_request_id) return;
          if ((read_status = data) == EOF) {
            llInstantMessage(llGetOwner(), "Finished Loading.");
            FinishLoading();
            return;
          }
          read_request_id = llGetNotecardLine(uuids, line_index++);
          if (data == "" || llGetSubString(data, 0, 0) == "#") return;
          list sticker_list = llParseString2List(data, ["|"], []);
          texture_uuids += llList2String(sticker_list, 0);
          scalesx += llList2String(sticker_list, 1);
          scalesy += llList2String(sticker_list, 2);
          offsetx += llList2String(sticker_list, 3);
          offsety += llList2String(sticker_list, 4);
          //llOwnerSay((string)data);
          rpic = llList2String(texture_uuids, 0);
          srpicx = llList2Float(scalesx, 0);
          srpicy = llList2Float(scalesy, 0);
          orpicx = llList2Float(offsetx, 0);
          orpicy = llList2Float(offsety, 0);
          lpic = llList2String(texture_uuids, 1);
          slpicx = llList2Float(scalesx, 1);
          slpicy = llList2Float(scalesy, 1);
          olpicx = llList2Float(offsetx, 1);
          olpicy = llList2Float(offsety, 1);
          fpic = llList2String(texture_uuids, 2);
          sfpicx = llList2Float(scalesx, 2);
          sfpicy = llList2Float(scalesy, 2);
          ofpicx = llList2Float(offsetx, 2);
          ofpicy = llList2Float(offsety, 2);
          bpic = llList2String(texture_uuids, 3);
          sbpicx = llList2Float(scalesx, 3);
          sbpicy = llList2Float(scalesy, 3);
          obpicx = llList2Float(offsetx, 3);
          obpicy = llList2Float(offsety, 3);
          printz = llList2String(texture_uuids, 4);
          sprintzx = llList2Float(scalesx, 4);
          sprintzy = llList2Float(scalesy, 4);
          oprintzx = llList2Float(offsetx, 4);
          oprintzy = llList2Float(offsety, 4);
          tfrillz = llList2String(texture_uuids, 5);
          stfrillzx = llList2Float(scalesx, 5);
          stfrillzy = llList2Float(scalesy, 5);
          otfrillzx = llList2Float(offsetx, 5);
          otfrillzy = llList2Float(offsety, 5);
          bfrillz = llList2String(texture_uuids, 6);
          sbfrillzx = llList2Float(scalesx, 6);
          sbfrillzy = llList2Float(scalesy, 6);
          obfrillzx = llList2Float(offsetx, 6);
          obfrillzy = llList2Float(offsety, 6);
          tapez = llList2String(texture_uuids, 7);
          stapezx = llList2Float(scalesx, 7);
          stapezy = llList2Float(scalesy, 7);
          otapezx = llList2Float(offsetx, 7);
          otapezy = llList2Float(offsety, 7);
        }
        touch_start(integer fingers) {
          if (llDetectedKey(0) == llGetOwner()) {
            if (!finished_loading) {
              llPlaySound("bb8bfbcf-64b8-dbe8-73c6-f4d67cd33584", 1);
              llInstantMessage(llGetOwner(), "Still reading notecards, please wait.");
            } else if (llDetectedKey(0) == llGetOwner()) {
              current_menu = 0;
              Menu();
            }
          }
        }
        listen(integer channel, string name, key id, string message) {
          if (channel == dialogChannel) {
            MenuListener(id, message);
          }
        }
      }

     

  3. 12 minutes ago, Innula Zenovka said:

    Try

    
    	listen(integer channel, string name, key id, string message)
    	{
    		list temp = llParseString2List(llToLower(message),[" "],[]);//break the message down into a list of the component words
    		integer max = -llGetListLength(max); //negative indices start from the beginning of the list, so llList2String(temp,max) is the 1st word in the sentence
    		integer index;
    		do {//loop through the message, word by word
    			index = llListFindList(lNames,[llList2String(temp,max)]);//is the word to be found in the lNames list?
    			if(~index){//yes, it is
    				max = -1;//so stop looking
    				string strTexture = llList2String(lTextures,index);
    				//find the correspondent entry in the full texture list
    				//do stuff
    			}
    		}
    		while(++max);
    	}

     

     

     

    It's giving me a function call mismatch type or number or arguments error on

    integer max = -llGetListLength(max);

    changed it to

    integer max = -llGetListLength(temp);

    and it fixed it

  4. 31 minutes ago, Innula Zenovka said:

    Yes, in that it will return TRUE or FALSE, so you know whether chat_text is the name of a texture in the object's inventory or not.

    However, based on what you've now said about your naming convention, I think I would do something like this (there's more economical ways to do it but I'm trying to give a clear example).     First, I'd create two lists and populate them thus:

    
    list lNames;
    list lTextures;
    default
    {
    	state_entry()
    	{
    		integer counter;
    		integer max = llGetInventoryNumber(INVENTORY_TEXTURE);
    		do {
    			string str = llGetInventoryName(INVENTORY_TEXTURE,counter);
    			list temp = llParseString2List(str,["."],[]);
    			lNames += [llList2String(temp,0)];//the part of the texture name before the full point.
    			lTextures += [str];//the whole name of the texture
    		}
    		while(++counter < max);
    	}

    Then in the listen event, 

    
    	listen(integer channel, string name, key id, string message)
    	{
    		integer index = llListFindList(lNames,[llToLower(message)]);//look for whatever I've just heard in the Names list
    		if(~index){ //index > -1, so I've found it there
    			string strTexture = llList2String(lTextures,index);
    			//find the corresponding entry in the full texture list
    			//do stuff
    		}
    	}

    That should do it, I think

    Omg, thank you, you got it! it works perfectly!

  5. the textures are named something like "smile.anim;3;2;10;0.32525;0.22957;0.01000" so the texture is named smile.anim, cause it's a texture that can be animated, the 3, and 2, are the x and y frames for the animation, the 10 is the speed it plays at, the "0.32525;0.22957;0.01000" are <0.32525,0.22957,0.01000> the scale I want the prim to be, that stuff ALL works, I don't need help with that part, I just need to know how to make the script know the name of the texture, right now I'm just grabbing the random inventory number, but I'm not sure how to do it by name, I'm guessing I need to make a list or something of the contents?

     

    [it would be called "smile.static;0.32525;0.22957;0.01000" if it was not animated and would exclude the frames and speed for animation]

     

    so in the case of "smile.anim;3;2;10;0.32525;0.22957;0.01000", I want to filter it down to just "smile" than be able to type "smile" in open chat and the prim than to grab that texture and use it as an emote.

  6. So I'm working on a script, and I've hit a road block of sorts.

     

    So what I'm wanting to do is, I have a listener set up, I want to type the name of any named texture in the objects inventory and than have it set that texture as the objects texture.So simply typing "smile" would than find the texture named smile in the contents and know to use that texture, and than set it.

    But I don't want to hard code any of the names in, I want to make it so anyone can add their own images to it, and simply type what they named the texture in chat for it than display the texture on the prim

    Currently I have it just set to show any texture no matter what I  type using "gTexture = llGetInventoryName(INVENTORY_TEXTURE,(integer)llFrand( llGetInventoryNumber(INVENTORY_TEXTURE)));"

    Tho my script is a bit more complex than just this bit, currently it can set animation x and y frames if the texture can be an animated texture, it can set the scale of the prim also, all by how I named the textures.

    So in theory it will be an emoter that will display images or animated images on just typing in local chat, and if it detects any of the words that trigger the emote it will change the prim to match accordingly.

     know i could easily just add a listen for each item, but I'd really like to make it be a bit more mod friendly for peeps that want to add their own images to the contents of the object.

     

    any help or pointers would be a great help. or point me to existing scripts for examples on what to do.

     

  7. add a script so they can change its texture to the uuid the specify in local chat maybe? i have a bass cannon, that is no mod and it lets you change the sound with a command in chat using the sound uuid... could this be applyed the same way sept with textures?

  8. vector gPos;
    integer gAnchored = FALSE;
     
    default
    {
        state_entry()
        {
            llListen(0,"",llGetOwner(),"");
            gPos = llGetPos();
        }
        touch_start(total number)
        {
            if (agent != NULL_KEY)
            {
                llRequestPermissions(agent, PERMISSION_TAKE_CONTROLS);
            }
            else
            {
                llReleaseControls();
            }
        }
     
        run_time_permissions(integer perm)
        {
            if (perm)
            {
                llTakeControls(CONTROL_DOWN| CONTROL_FWD| CONTROL_UP | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_BACK, TRUE, TRUE);
            }
        }
        control(key id, integer level, integer edge)
        {
            if (level > 0)
            {
                llStopMoveToTarget();
            }
            else
            {
                gAnchored = TRUE;
                gPos = llGetPos();
                llSetStatus(STATUS_PHYSICS, TRUE);
                llMoveToTarget(gPos,0.1);
            }
        }   
    }
     

     hihi this script works nice and all, but is it possible to make it turn off and on on the touch of the prim?? help :o

     

  9. integer toggle;
    
    default
    {
        state_entry()
        {
            llStopSound();
            llSetTimerEvent(0.2);
        }
        
        timer()
        {
            if (llGetAgentInfo(llGetOwner()) & AGENT_WALKING)
            {
                state walking;
            }
        }
    }
    state walking
    {
        state_entry()
        {
            llSetTimerEvent(0.2);
            llLoopSound("uuid",1.0);
        }
        timer()
        {
            if (!(llGetAgentInfo(llGetOwner()) & AGENT_WALKING))
            {
                state default;
            }
        }
    }

     the walking script ^

    integer toggle;
    
    default
    {
        state_entry()
        {
            //llSay(0, "Hello, Avatar!");
        }
        touch_end(integer total_number)
        {
            toggle=!toggle;//switch from FALSE to TRUE or vice versa
            if(toggle){
                //do stuff
            }
            else{
                //stop doing it
            }
        }
    }

     simple touch on/off script i think ^

     

     

    What i want to do is combine these scripts if possible so it plays sound when walking like normal, but i can turn it on and off when desired. It's probably really easy for someone who knows scripting to do this, but I'm not so talented in this area, anyone out there bored n wanna help me out?

     

  10. hihi have this script, is it possible to make it self delete/turn temp when itz health has all run out?

     

    integer hit_value = 10;//How much health we loose each time we are hit.
    integer health_value = 100;//Our total health
     
    default{
    //
        state_entry(){
            llSetText("Health: "+(string)health_value, llGetColor(0), 1.0);
            //Show our default health value  
        }  
    //
        collision_start(integer total_number){
            integer i;
            for( i = 0; i < total_number; i++ ){
                if(llDetectedType(i) & AGENT) return;
                //Check if its an object or avatar/agent hitting us, if avatar, return/stop here.
                health_value -= hit_value;
                // Detect a collision from an object, we remove our hit value
                llSetText("Health: "+(string)health_value, llGetColor(0), 1.0);
                // Set floating text to show how much health we have left.
                if(health_value == 0 || health_value < 0) state lldie;
                // Check how much health is left after removing hit value, if 0 or less.. die.
            }    
        }
    //
    }
     
    state lldie{
    //
        state_entry(){
            llSetText("Health: "+(string)health_value, llGetColor(0), 1.0);
            //Update our text, to show we have no health left.
            llSay(0,"/me is Dead!..");
        }
    //
    }

     silly me i figured it out like soom after i posted this XD

     

    finished result 

    integer hit_value = 10;//How much health we loose each time we are hit.
    integer health_value = 100;//Our total health
     
    default{
    //
        state_entry(){
            llSetText("Health: "+(string)health_value, llGetColor(0), 1.0);
            //Show our default health value  
        }  
    //
        collision_start(integer total_number){
            integer i;
            for( i = 0; i < total_number; i++ ){
                if(llDetectedType(i) & AGENT) return;
                //Check if its an object or avatar/agent hitting us, if avatar, return/stop here.
                health_value -= hit_value;
                // Detect a collision from an object, we remove our hit value
                llSetText("Health: "+(string)health_value, llGetColor(0), 1.0);
                // Set floating text to show how much health we have left.
                if(health_value == 0 || health_value < 0) state lldie;
                // Check how much health is left after removing hit value, if 0 or less.. die.
            }    
        }
    //
    }
     
    state lldie{
    //
        state_entry(){
            llSetText("Health: "+(string)health_value, llGetColor(0), 1.0);
            //Update our text, to show we have no health left.
            llDie();
            llSay(0,"/me is Dead!..");
        }
    //
    }

     

    • Thanks 1
×
×
  • Create New...