Delayed Writing - 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: Delayed Writing (/showthread.php?tid=94723)
Delayed Writing by Barathrum on 06-04-2010 at 03:40 PM
1. Is it possible to make a script that does the following:
Whenever I write anything, it will write the message character by character with delay of 0.5 second. So example:
"Hello" will become:
H <0,5s> e <0,5s> l <0,5s> l <0,5s> o <0,5s>
It should write it in same message, not new line for each character.
2. Second question:
I have this script here:
code: function OnEvent_ChatWndSendMessage(ChatWnd, Message){
return "msg = [ " + Message + " ]"
}
How would I make everything except the Message some color?
RE: Delayed Writing by matty on 06-04-2010 at 05:00 PM
You cannot have WLM send a message character by character and have it appear on the same line. This is impossible. However you can have it send the messages on different lines.
As for the other question you can use [c][/c] tags... for instance [c=4]test[/c] would be test
RE: Delayed Writing by Barathrum on 06-04-2010 at 07:50 PM
Oh too bad, can you post for on new line code someone?
Thank you, also I'll use the colors now.
RE: Delayed Writing by matty on 06-04-2010 at 08:17 PM
Untested...
js code: var oChatWnds = {};
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
if (sMessage.charAt(0) !== '/' && typeof oChatWnds[pChatWnd.Handle] === 'undefined') {
oChatWnds[pChatWnd.Handle] = {
Message : sMessage,
i : 0
};
MsgPlus.AddTimer(pChatWnd.Handle, 5000);
return '';
}
}
function OnEvent_Timer(sTimerId) {
var oChat = oChatWnds[sTimerId];
var Message = oChatWnds[sTimerId].Message.charAt(oChatWnds[sTimerId].i);
if (Message === '/') Message = '//';
++oChatWnds[sTimerId].i;
oChat.SendMessage(Message);
MsgPlus.AddTimer(sTimerId, 5000);
}
RE: Delayed Writing by Matti on 06-05-2010 at 08:08 AM
You might want to change the 5000 ms delay into a 500 ms delay, it'd take a really long time before the message is fully transmitted. (Typo I guess? )
Also, wouldn't the built-in flood protection prevent the script from working correctly? The counter from the amount of messages sent by the script can be reset when the user sends a message himself, but this is also prevented by the script. The user can't reset the counter because all messages are intercepted (unless of course he sends a /command).
It just doesn't seem a good idea to try this, there are too many obstacles which you can't really get around. I believe it would also be very irritating for you contacts to have to wait several seconds before they get your message.
RE: Delayed Writing by Barathrum on 06-05-2010 at 10:49 AM
Error:
Script has been stopped
Script is starting
Script is now loaded and ready
Function called: OnEvent_ChatWndSendMessage
Error: Object expected (code: -2146823281)
File: Delayed Typing.js. Line: 20.
Function OnEvent_Timer returned an error. Code: -2147352567
RE: Delayed Writing by matty on 06-05-2010 at 12:55 PM
quote: Originally posted by Barathrum
Error:
Script has been stopped
Script is starting
Script is now loaded and ready
Function called: OnEvent_ChatWndSendMessage
Error: Object expected (code: -2146823281)
File: Delayed Typing.js. Line: 20.
Function OnEvent_Timer returned an error. Code: -2147352567
Fixed... needed to replace ++i with ++oChatWnds[sTimerId].i
RE: Delayed Writing by Barathrum on 06-05-2010 at 01:29 PM
Now there an other error:
Function called: OnEvent_ChatWndSendMessage
Error: Object doesn't support this property or method (code: -2146827850)
File: Delayed Typing.js. Line: 21.
Function OnEvent_Timer returned an error. Code: -2147352567
RE: Delayed Writing by whiz on 06-05-2010 at 01:36 PM
quote: Originally posted by matty
js code: var oChatWnds = {};
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
if (sMessage.charAt(0) !== '/' && typeof oChatWnds[pChatWnd.Handle] === 'undefined') {
>>> oChatWnds[pChatWnd.Handle] = {<<<
>>> Message : sMessage,<<<
>>> i : 0<<<
>>> };<<<
MsgPlus.AddTimer(pChatWnd.Handle, 5000);
return '';
}
}
function OnEvent_Timer(sTimerId) {
var oChat = oChatWnds[sTimerId];
var Message = oChatWnds[sTimerId].Message.charAt(oChatWnds[sTimerId].i);
if (Message === '/') Message = '//';
++oChatWnds[sTimerId].i;
>>> oChat.SendMessage(Message);<<<
MsgPlus.AddTimer(sTimerId, 5000);
}
The oChat isn't actually a chat window, but just an object with Message and i properties.
Would this work?
js code: var oChatWnds = {};
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
if (sMessage.charAt(0) !== '/' && typeof oChatWnds[pChatWnd.Handle] === 'undefined') {
oChatWnds[pChatWnd.Handle] = {
Message : sMessage,
i : 0,
Wnd : pChatWnd
};
MsgPlus.AddTimer(pChatWnd.Handle, 5000);
return '';
}
}
function OnEvent_Timer(sTimerId) {
var oChat = oChatWnds[sTimerId];
var Message = oChatWnds[sTimerId].Message.charAt(oChatWnds[sTimerId].i);
if (Message === '/') Message = '//';
++oChatWnds[sTimerId].i;
oChat.Wnd.SendMessage(Message);
MsgPlus.AddTimer(sTimerId, 5000);
}
RE: Delayed Writing by Barathrum on 06-05-2010 at 02:45 PM
Error :/
Error: Expected '}' (code: -2146827279)
File: Delayed Typing.js. Line: 8.
RE: Delayed Writing by whiz on 06-05-2010 at 03:08 PM
Oops! Replace this:
js code: Wnd : pChatWnd;
...with this:
js code: Wnd : pChatWnd
(in other words, remove the semi-colon from the end)
RE: Delayed Writing by Barathrum on 06-05-2010 at 04:41 PM
Also, do you think, that you could make it close the window for me when it finish typing and then open it again?
Also it is very buggy
It only seems to work normal when you type the 1st msg, after that every is buggy, unless you reopen the window.
RE: Delayed Writing by whiz on 06-05-2010 at 04:58 PM
In what sense is it buggy?
Does it stop sending messages (probably because of the flood protection)? Do colour tags mess up (display as tags)? Do emotions move to the end of lines (with "written" versions in the original positions)?
RE: Delayed Writing by Barathrum on 06-05-2010 at 05:29 PM
Well messages bugg like, they are send in 1 line, or they get writen like 5 times the whole text, not char by char, emotions ofc. don't get spelled, which is obvious.
RE: Delayed Writing by matty on 06-05-2010 at 06:54 PM
I know why it happens... I don't really feel like fixing it. After the last character is sent the object needs to be deleted. For it to work again.
RE: Delayed Writing by Barathrum on 06-05-2010 at 07:40 PM
Ohh, is it hard to delete the object? Or can anyone tell me how I remove the Object?
RE: Delayed Writing by matty on 06-06-2010 at 02:12 AM
Change the function for the timer to the following:
js code: function OnEvent_Timer(sTimerId) {
var oChat = oChatWnds[sTimerId];
var Message = oChatWnds[sTimerId].Message.charAt(oChatWnds[sTimerId].i);
if (Message === '/') Message = '//';
++oChatWnds[sTimerId].i;
oChat.Wnd.SendMessage(Message);
if (oChatWnd[sTimerId].i === oChatWnd[sTimerId].Message.length)
delete oChatWnd[sTimerId];
else
MsgPlus.AddTimer(sTimerId, 5000);
}
RE: Delayed Writing by Barathrum on 06-06-2010 at 07:10 AM
Nop still bugs alot :/ When typing in messages, it just writes the whole word in a weird order and such :/
|