Shoutbox

noob in need of some help - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: noob in need of some help (/showthread.php?tid=78426)

noob in need of some help by Gareth_2007 on 10-25-2007 at 01:10 AM

hey

im looking for some code help im sending a messege to a contact using

code:
Wnd.SendMessage(Msgs['Welcome']);
that would show

Gareth.... says:
Welcome to the test program.
this is just some random text

this is what i would like it to look like with out changing my display name:

Test Program:
Welcome (contacts username)

the away status with messenger plus sort of does what i would like to do.


and how could i get the first 7 letters of the contacts display name and show it where it says contacts username above? cheers
RE: noob in need of some help by bigbob85 on 10-26-2007 at 01:41 AM

If you be patient I can write this up for you in about 12 hours, if no one helps you before then.

You have to get the contacts name (making sure there is only 1 contact in the current window), and that will be a string. Then use the substring (or substr ?) method to cut it down.


RE: noob in need of some help by Gareth_2007 on 10-26-2007 at 02:20 PM

if you could write it that would be great :D cheers gareth


RE: noob in need of some help by bigbob85 on 10-27-2007 at 04:18 AM

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    var Contacts = ChatWnd.Contacts;
    var e = new Enumerator(Contacts);
    for(; !e.atEnd(); e.moveNext())
    {
        var Contact = e.item();
        Debug.Trace(" " + Contact.Name.substring(0, 20));
    }
}

You should be able to adapt that into something useful.
Contact.Name - Name of the contact in the chat.
substring(start, end) - cuts down the string from start, till end.

Might also want to check Contacts.count to see if its 1 (only 1 contact in a the chat window).

Hope that helps.