Shoutbox

Is there a way to... - 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: Is there a way to... (/showthread.php?tid=64964)

Is there a way to... by elfangor93 on 08-15-2006 at 07:42 PM

Make a message replaced but only if it's its own word? For example... making k be replaced by ok automaticly, but then it replaces it in the middle of a word. Anyone know?


RE: Is there a way to... by cloudhunter on 08-15-2006 at 07:46 PM

Simple in script. Just use this code.

code:
OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
     if (Message=="k")
     {
           return "ok";
     }
}

Cloudy
RE: Is there a way to... by Huhu_Manix on 08-15-2006 at 07:46 PM

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){

// Add space before and after the message ( if the message have only 1 word )
Message = " "+Message+" ";

// replace " k " by " ok "
while(Message.indexOf(" k "))Message=Message.replace(" k ", " ok ");

// Remove spaces
return Message.substring(1, Message.length-1);
}

RE: Is there a way to... by elfangor93 on 08-15-2006 at 07:47 PM

Ok thanks

Huhu_Manix, I tried that but it's not working.

Same with cloudhunter's script.


RE: Is there a way to... by Silentdragon on 08-15-2006 at 08:10 PM

code:
OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
     Message = Message.replace(/\bk\b/i,"Ok");
     return Message;
}

RE: Is there a way to... by cloudhunter on 08-15-2006 at 08:18 PM

Silentdragon's code should work. However i've just tried my first code, and it worked, however my second code didn't :( Sorry for that.


RE: Is there a way to... by elfangor93 on 08-15-2006 at 08:21 PM

Oh ok, I tried your 2nd one. I'll try silentdragon's.

It doesn't work :\


RE: Is there a way to... by cloudhunter on 08-15-2006 at 08:32 PM

I just tried it myself, it doesn't work...

Bleah, who would have thought that a simple request would get so hard :P

I know for a fact my code that is there now though works...


RE: Is there a way to... by elfangor93 on 08-15-2006 at 08:57 PM

It says it may be defective or i dont have the proper privilages to run scripts... is that the whole code or do I need to add something.


RE: Is there a way to... by cloudhunter on 08-15-2006 at 08:59 PM

No, that should be fine... Create a new script, and just copy and paste it in...

Cloudy


RE: Is there a way to... by Silentdragon on 08-15-2006 at 08:59 PM

Whoops made a typo, forgot to assign the result back to message.
Updated Post.


RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:03 PM

It's not letting me run the scripts. They all say defective, except the one I downloaded :S.


RE: Is there a way to... by cloudhunter on 08-15-2006 at 09:08 PM

Delete the script that you made for this, and create a new one im messenger plus. My guess is you are saving it using notepad, and nor in unicode... Use the inbuilt script editor...

Cloudy


RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:10 PM

I'm using the built in script editor.


RE: Is there a way to... by cloudhunter on 08-15-2006 at 09:10 PM

Well try deleting, then making again... Try disabling the other script you have running maybe? I'm running short of ideas...

Cloudy

Edit: Post the code you are using...


RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:11 PM

function OnEvent_Initialize(MessengerStart)
{
}
OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
Message = Message.replace(/\bk\b/i,"Ok");
return Message;
}

function OnEvent_Uninitialize(MessengerExit)
{
}


function OnEvent_Initialize(MessengerStart)
{
}
OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
     if (Message=="k")
     {
           return "ok";
     }
}
function OnEvent_Uninitialize(MessengerExit)
{
}

I've tried both


RE: Is there a way to... by dylan! on 08-15-2006 at 09:16 PM

when they are done corrected your codes and helping you, please delete 2 of the 3  posts because its against the rules. althought I'm not going to be mean and make you edit because your new and it could be difficult for you to use the [code][/code] codes


RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:18 PM

???


RE: Is there a way to... by cloudhunter on 08-15-2006 at 09:19 PM

Well, that seems fine. You don't need the

function OnEvent_Initialize(MessengerStart)
{
}

or the

function OnEvent_Uninitialize(MessengerExit)
{
}

If you aren't using it.

Cloudy


RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:20 PM

It was there automaticly. And it doesn't work without it either. I just dunno what's wrong? :S


RE: Is there a way to... by cloudhunter on 08-15-2006 at 09:22 PM

Delete the scripts you made, and disable the script you downloaded. Then try pasting the code in again...

Cloudy


RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:23 PM

Still doesn't work.


RE: Is there a way to... by cloudhunter on 08-15-2006 at 09:24 PM

Well, the code is correct, so it's something other than the code... I'm afraid I can't help...

Cloudy


RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:25 PM

I should have full privilages and everything.


RE: Is there a way to... by dylan! on 08-15-2006 at 09:27 PM

it has something to do with the return part of it

EDIT:

code:
OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
     if (Message== "k" ){
       
    return "ok";
     }
}






Error: 'return' statement outside of function.
       Line: 5. Code: -2146827270.
RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:33 PM

That doesn't work either. It won't run, it stops automaticly.


RE: Is there a way to... by dylan! on 08-15-2006 at 09:37 PM

hmm.. I don't know anything about it but how about try

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
     if (Message== "k" ){
     ChatWnd.SendMessage('ok') 
    return "";
  }
}


WE ARE ALL NOOBS.. forgot the function :dodgy:X100000
RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:46 PM

Yay it works... but new problem.

It doesn't replace if there are other words in the message. :S How can I do that?


RE: Is there a way to... by Silentdragon on 08-15-2006 at 09:50 PM

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
     Message = Message.replace(/\bk\b/i,"Ok");
     return Message;
}

RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:54 PM

It works! *does the happy dance* thank you everyone :D


RE: Is there a way to... by cloudhunter on 08-15-2006 at 09:55 PM

The "ChatWnd.SendMessage('ok')  " wasn't needed, as return will change the message being sent, I have no idea why that worked more than the others...


RE: Is there a way to... by dylan! on 08-15-2006 at 09:57 PM

quote:
Originally posted by cloudhunter
The "ChatWnd.SendMessage('ok')  " wasn't needed, as return will change the message being sent, I have no idea why that worked more than the others...

only worked more than the others because it had the function at the beginning... you forgot it:P
RE: Is there a way to... by elfangor93 on 08-15-2006 at 09:59 PM

I have 1 more question... how would I make a script that automsticly capitalizes the frst letter of my message and puts a '.' at the end, unless there is a '?'?


RE: Is there a way to... by cloudhunter on 08-15-2006 at 10:01 PM

Well there is a script that does that, however it doesn't do it right if there is a ? at the end. I suppose you could see if there was a ?, !, or ; or : at the end and not add it if there is...

Not quite sure on how to make it though...

Cloudy


RE: Is there a way to... by elfangor93 on 08-15-2006 at 10:01 PM

I don't know how to do these scripts :S


RE: Is there a way to... by elfangor93 on 08-15-2006 at 10:02 PM

Also, I have nicknames for all my contacts but if I set an alert for them signing out it shows their real names. Can I make it show their nicknames that I set?


RE: Is there a way to... by cloudhunter on 08-15-2006 at 10:02 PM

Well learn by experimenting, and by looking at others code, I did ;) You can't expect people to write scripts for you ;)

Cloudy


RE: Is there a way to... by elfangor93 on 08-15-2006 at 10:04 PM

Hmm I guess you're right. Thanks for all the help :)