Jump to content

Say a script name to local chat?


AussiePaul
 Share

You are about to reply to a thread that has been inactive for 3549 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Can anybody tell me how I would have a scripts name said in local chat when I dropped it in a prim?

For example, If I dropped an animation in a prim, the name of the animation would be said in local chat.

I have been looking in the functions lists... and I can see llgetscript name but it appears that delets a certain object? I just want the name with out having to open it in properties manually.

Thanks for your help ,

Paul

Link to comment
Share on other sites

llGetScriptName gives you the script name, but if you're wanting to announce other various inventory item types as they're dropped into an object, you need to detect inventory changes using the changed event.  You'll probably have to keep track of what already existed or was previously dropped into inventory, to detect what new items were dropped into inventory.

Link to comment
Share on other sites

Thank you for the replies Ohjiro and Yingzi.


I apologize for not explaing exactly what Im trying to do... I just was trying to not make a long post... but I think it deserves  a detailed explanation of what I'm doing and why.

 So here goes....

What I'm trying to do is this... Mty AO has a feature that allows me to rezz it on the ground and  drop my animations in to it . The AO then automatically creates the notecard so that the anims work with the ao. I'm playing with building one for my self ... just for the exercize... just for fun... I'm adding all of the names of the free  animations that I have collected that I want to add to this "Practice AO" but its tedious... open the animation in Properties... Copy the name... paste it to the Notecard and then repeat.

I figured there muist be a way to use a script to do it because my AO does that ... (I cant see how the AO does it of course because the files are no mod).

I am a type of person who likes to think about how to do things in better ways.

My initial plan was to make a prim and put the script into the prim... then add the animations... My AO sorts them... but I dont need that because I'm thinking Ill just ad say ... all of the stands... I understand that the script cant write the names to a notecard ... thats ok.

If it is able to write it to Local chat (or IM) either way wont matter.... its not like Ill be doing this in a busy place ... probably on my own rental land ... so I would then take the list of all the stands... and paste them in a notecard and save it ... I would need to ad a "|" character between each one... again... I'm sure I could use a script to do that as well but thats for another lesson for me ... for now, it would be easy to do manually..

Then I could do the same for all of the walks... and so on.

So there you have it!

Thats what Im trying to do ... so I'll go off to SL now and play with that piece of script and read some more and see what I can do with it ...

Thanks for the help.

 Cheers,

Paul

Link to comment
Share on other sites

Drop this script in your object, add your items to the object, then touch the object and it will give you a line in local chat with all inventory items separated with the | delimiter.  Note the settings at the top of the script.

 

string delimiter = "|"; // Delimiter; change to whatever you want
integer include_me = FALSE; // Include this script in the results? TRUE or FALSE

default
{
    touch_start(integer total_number)
    {
        list items_in_inventory;
        integer counter;
        integer number_of_items = llGetInventoryNumber(INVENTORY_ALL);
        string item_name;

        do
        {
            item_name = llGetInventoryName(INVENTORY_ALL,counter);
            if (include_me == FALSE && item_name == llGetScriptName()) jump skip;
            items_in_inventory += [item_name];                    
            @skip;
            counter++;
        } while (counter < number_of_items);
        
        llWhisper(0,llDumpList2String(items_in_inventory,delimiter));
    }
}

 

Link to comment
Share on other sites

Or drop this self-deleting script into your object after you have put all your other stuff into it......

string gHold;default{    state_entry()    {        gHold = llGetObjectName();        llSetObjectName("");  //Removes object name from chat line        integer i;        while (i < llGetInventoryNumber(INVENTORY_ALL) )        {            if (llGetScriptName() !=  llGetInventoryName(INVENTORY_ALL, i))            {                llOwnerSay("/me " + llGetInventoryName(INVENTORY_ALL, i));            }            ++i;        }        llSetObjectName(gHold);  // Restores object name        llRemoveInventory(llGetScriptName());  //Removes this script automatically    }}

 If you're really clever and if your viewer lets you do it easily, you can turn off the timestamp on each chat line too, so that you get a nice, clean printout that you don't need to edit before you cut & paste it into the notecard. 

 

 

Link to comment
Share on other sites

Thanks  Yingzi and Rollig.

Its good for me to be able to know what these scripts do, and look at the various tools that you both have used to get the results.

I'm poring over those lines now, but then I remembered I needed to come and thank you both for your kind assistance.

Thanks again,

Paul.

PS ... Rollig!! You are so distracting!!! Now I find myself back looking at how I can remove the timestamps... (I use Firestorm and I am pretty sure I have seen that as an option in Preferences... so I'll find that, if for nothing else than the challenge!!  LOL)

Link to comment
Share on other sites

LOL Havn't gone into FS yet... Still reading the scripts...

On a slightly different topic... Could you explain to me or show me where to find out what these parts mean.

"/me " and the "i" in (INVENTORY_ALL, i) ?

{                llOwnerSay("/me " + llGetInventoryName(INVENTORY_ALL, i));            }
Link to comment
Share on other sites

/me is the same thing that you or I type at the start of a line in local chat or IM when we don't want the colon to show between our name and the message, as in

"/me says Hello!"

which appears in chat as "Rolig Loon says Hello!" when I type it.  The script is just acting as your surrogate, typing "/me  " for you.

Look in the LSL wiki for the syntax for llGetInventoryName()llGetInventoryName(INVENTORY_ALL,i) means literally, "Tell me the name of the ith item of all those in this object's Contents."

 

Link to comment
Share on other sites

Of course.  Having the script auto-die makes sense if you're only doing one set of animations. 

I considered that he might want to do more than one set of animations at once.  Having a script not die saves him having to drag and drop the script in each time to do another set, which requires scrolling to find the script to drag and drop it; it takes away focus from the animations folder, which you have to scroll back up to.  You could have two inventory windows open but that's extra screen real-estate.  Instead, just delete the old set of animations and add the new ones, press touch and you've got your new set to copy/paste to your notecard.

Since he's going to copy/paste from chat, it's easy to avoid unwanted text (in this case, a colon) if all you're copying is the chat text with your mouse.  Left click hold and drag across, highlighting the text you want, then CTRL-C (copy) and CTR-V (paste) to notecard.   Keep in mind, the script prints out one line of text.  If you use this copy/paste method, you don't have to worry about timestamps, colons or any unwanted text, because you're highlighting what you want to copy.

Delete prim when done, gets rid of script and all in one fell swoop.  Easy peasy.

EDIT:  I tested the one-line dump to chat with llWhisper, which has a 1024 byte limit.  I was able to get 73 "Hello, Avatar" strings (13 characters apiece), including the | delimiter, before truncation.  It's possible to surpass the llWhisper function's limit, but 70 13-character names is more than enough for most needs.

Glad I could help, Paul.

Link to comment
Share on other sites

It's always good to have more than one tool in the toolbox.  You never know which one you're going to need most.  I think most scripters have probably written several versions of our two scripts, bcause this is a common problem. 

I like having a self-deleting option sometimes for those occasions when I need a quick, uncluttered list of an object's contents and don't care to do any cleanup afterwards.  If I were needing to generate a list over and over again, I'd probably go for a script that stays in the object.  I also like being able to cut & paste a whole block of text lines instead of having to copy one line at a time.  That's why I like being able to suppress the object name, colon, and timestamp when I can.  If I only wanted to cut & paste a few lines, that wouldn't make any difference.

Anyway, the OP and anyone else can choose,  or write other versions.  :smileywink:

Link to comment
Share on other sites

I agree with everything you said. 

An example of the Amacci AO HUD notecard (which uses ZHAO II, the most common AO/Dance script in SL):

 

[ Standing ]AOF_stand6|AOF_stand7|AOF_stand8|AOF_stand9|AOF_stand10[ Walking ]|Amacci Female Walk 1|Amacci Female Walk 5[ Sitting ]AOF_sit2|AOF_sit3|AOF_sit4[ Sitting On Ground ]AOF_gsit1|AOF_gsit2|AOF_gsit3

 

The output of my script looks like this (below).  All one line (minus "[15:57] Object whispers:" from the front of the line), which can be select copy/pasted directly into the HUD notecard because it's in the format it uses.  No editing out anything, it's all ready to go.

 

Dance 1|Dance 2|Dance 3|Dance 4|Dance 5|Dance 6|dream-dance|f_dance_01|f_dance_03|f_dance_05|f_dance_06|f_dance_07|f_dance_08|f_dance_09|f_dance_10|HeadBang

 

I use the llRemoveScript all the time.  Scripts like Get Link Number (which Firestorm doesn't report correctly half the time), Get Position and Rotation, Clear Hover Text and so many other uses.  A friend of mine once wanted a script that would rename an object and die, to save typing. lol

The more ways the merrier, I say.  Learning more than one way is most beneficial.  That's how I learn most of the time, through others.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3549 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...