I know this thread is dead since one month but I just wanted to help people who encounter the same problem.
Since I didn't found a trick in any website I tried, I just searched myself and
found out how to change your personal message from a script (sample in the end) :
-
If you just need to change the personal message in the ChatWndSendMessage event :
Return the text "/psm [your message here]" and it will be updated.
-
If you need to change the personal message in any other function or event :
Send a special message to a chat window using the
ChatWnd.SendMessage(string) function.
This special message should be unique and the probability that the user types it should be negligible.
This will trigger a
ChatWndSendMessage event.
After some tests, I found that if you just return "/psm [your message here]" from a script-sent message, it will only send "[your message here]" to your contact and never update the personal message.
What you have to do is to catch your special message using a condition, and return "/psm /psm [your message here]" (no, that's not a typo). This is just dumb but it works.
Here is the
sample code (copy in a new script to test) :
code:
var strSpecialMessage = "§¤§¤@~ or anything"; // Special message to use to send a message in any function.
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if (Message == strSpecialMessage)
{
return "/psm /psm [your message here]";
}
else if (Message == "NOW")
{
ChatWnd.SendMessage(strSpecialMessage);
return "";
}
else return Message;
}
This code will change your personal message to "[your message here]" when you send the exact message "NOW" in any chat window. But you can trigger it from any function if you change the code.
All you need is a chat window... if your script isn't related to a chat window, then you'll have to make sure there are opened chat windows, and if not, try to open one, send the message and then close it immediately.
I don't know how to close it, though. Maybe with an external library function which takes in parameter the handle of the window. Well... that's complicated.