Jump to content

I want to say "/me" but not say it....


Rolig Loon
 Share

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

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

Recommended Posts

This is silly.  I want to read a line from a notecard and say it in llOwnerSay.  The line might say something like

/me says Hello, Avatar!

If it does, I want the substring /me to print out too.  This ....

if (llGetSubString(words,0,0) == "/"){

    llOwnerSay("/\/me " + words);

}

almost works, but I get an extra "/" in the message. If I try to get rid of the extra "/", then /me becomes active, which of course makes it disappear instead of printing out.  I'm going nuts. How do I get rid of the extra "/"? :smileysurprised:

 

Link to comment
Share on other sites

input = llDumpList2String( llParseStringKeepNulls( input, ["/me "], [] ), "/me " );

I cheat.... view as html to see how

ETA:

a leading space is probably better, since mine will also print the literal string if copied from chat... but if you are just looking to supress /me from strings, it works a charm

Link to comment
Share on other sites

Void Singer wrote:

input = llDumpList2String( llParseStringKeepNulls( input, ["/me "], [] ), "/me " );

I cheat.... view as html to see how

ETA:

a leading space is probably better, since mine will also print the literal string if copied from chat... but if you are just looking to supress /me from strings, it works a charm

Oh, now that is tricky.  I wouldn't have thought of the non-breaking white space.  I'll have to remember that one, Void. 

In this case, even the leading blank space isn't ideal, because I can't be confident that my client will always remember to cut&paste the chat line my script produces without copying the space too.  Still, given a choice between two potential user errors, I'd rather do that than have a line start without /me at all. 

Link to comment
Share on other sites

This is my "nameless" chat mimic.  You throw a string into 'message' and it'll rename the prim to the first word in the sentence, /me-chat the rest of the sentence, and rename the prim back to normal. (^_^)

I know it's doing a bit much, but, you can see where I split the /me from the space using '+' concatenation.  I think it does the same thing as Void's list method, though, I believe this technique is quite a bit more efficient. (^_^)

 

        {            string myname = llGetObjectName();            integer stringlength = llStringLength(message);            integer firstspace = 0;                        while (llGetSubString(message, firstspace, firstspace) != " "  && firstspace != -1)            {                firstspace++;                                if (firstspace >= llStringLength(message))                {                    firstspace = -1;                }            }                        if (firstspace != -1){                llSetObjectName(llGetSubString(message, 0, firstspace - 1));            }else{                llSetObjectName(llGetSubString(message, 0, firstspace));            }                        if (firstspace != -1)            {                llSay(0, "/me" + " " + llGetSubString(message, firstspace + 1, stringlength));            }else{                llSay(0, "/me  ");            }                        llSetObjectName ( myname );                    }

 

 

Link to comment
Share on other sites

actually a variation of Immies suggestion is what I was going to offer next.... now that I know the use case...

llSetObjectName( llGetObectName() + ": /me" );
llOwnerSay( "/me " + llGetSubString( output, 4, -1 ) );
llSetObjectName( llGetSubString( llGetObjectName(), 0, -6 ) );

the only bothersome thing is that in V2 and several of the TPVs, the entire object name is linked in a different color (plus it doesn't play nice at all with v2's non-plaintext chat since they fixed /me for that)

ETA:
why are you starting a new line with /me anyways? doesn't seem like a normal thing to do in a script, and if it's for a notecard you can always catch the leading space with llStringTrim. if it is a script, you can actually cheat and print multiple lines, and use inline comments to negate the objects name by appending /* to the end of one block and */\n to the begining of the next... as long as it's not a continued string literal it's perfectly safe

Link to comment
Share on other sites

Does it matter why? Could be instructions in llOwnerSay, that include showing you how to emote.

And I've used /me in script a lot, for communications...

 

By the way, these scripted replies, aren't they just more complex ways of doing what I suggested? Assuming the string isn't variable, that should work.And even if it is, you could use llOwnerSay("/me : /me says " + string);

Link to comment
Share on other sites

 


Gadget Portal wrote:

Does it matter why? Could be instructions in llOwnerSay, that include showing you how to emote.

And I've used /me in script a lot, for communications...


By the way, these scripted replies, aren't they just more complex ways of doing what I suggested? Assuming the string isn't variable, that should work.And even if it is, you could use llOwnerSay("/me : /me says " + string);

Yes.  This has been a great help. As I said in my OP, this is a somewhat silly detail in a script that I've been working on for the last few days. Among other things, the script is supposed to grab a line from a notecard and present it in owner chat, from where the owner can then cut and paste it into IM or public chat -- thus "personalizing" a message that would otherwise come from an object. The owner could of course type /me and then paste the message, but that's just one more thing to remember, so I wanted to embed /me into the message itself.  Thanks, everyone, for sharing such a range of creative possibilities. Compared to the rest of the script's logic, this was indeed a silly detail, but it was annoying for me not to imagine a simple answer.  Now we all have many.  :smileyhappy:

 

Link to comment
Share on other sites

heh, and now that I know the exact behavior I could make one more suggestion, although from your comments inworld I'm guessing you arelady figured it out (so this is for the thread readers).... use llTextbox so that the user can send the string as is

@Gadget:
it might matter (and did this time). the better a problem is understood, the better it can be addressed... devil's in the details and all that. my question wasn't intended as condescending, it was genuine confusion about what was to be accomplished... and more options is always good =)

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4754 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...