Shoutbox

Help creating my first script - 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: Help creating my first script (/showthread.php?tid=63799)

Help creating my first script by edmarriner on 07-22-2006 at 05:31 PM

Hi,

Im tring to make the contacts name flash when they type !flash but i cant seem to get it working, im a bit of a newbie at this so any help is much appreicated.

Heres what ive got so far, i expect its all totaly wrong :$

code:
function flash(){
for (i = 0; i < 10-; i++) {
Messenger.MyName = "[c=40]" + contactsname + "[/c]";
Messenger.MyName = "[c=0]" + contactsname + "[/c]";
}
}
OnEvent_Initialize(MessengerStart)
{

var contactsname = Messenger.MyName ;
var savedname = contactsname ;
contactsname = MsgPlus.RemoveFormatCodes(contactsname);


function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if (Message == "!flash") {
   

flash();
Messenger.MyName = savedname ;
}
}

function OnEvent_Uninitialize(MessengerExit)
{
}


Any ideas?

Thanks,

-ed
RE: Help creating my first script by foaly on 07-22-2006 at 05:43 PM

well the 10- in the forloop cant be good...


here try this

code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_Uninitialize(MessengerExit)
{
}

function flash(){
for (i = 0; i < 10; i++) {
Messenger.MyName = "[c=40]" + contactsname + "[/c]";
Messenger.MyName = "[c=0]" + contactsname + "[/c]";
}
}

var contactsname = Messenger.MyName ;
var savedname = contactsname ;
contactsname = MsgPlus.RemoveFormatCodes(contactsname);


function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
if (Message == "!flash") {

flash();
Messenger.MyName = savedname ;
}
}


al i did was take it out of the OnEvent_Initialize(MessengerStart) function
RE: Help creating my first script by Pai on 07-22-2006 at 05:51 PM

code:
function flash(){
for (i = 0; i < 10; i++) {
Messenger.MyName = "[c=40]" + contactsname + "[/c]";
Messenger.MyName = "[c=0]" + contactsname + "[/c]";
}


function OnEvent_Initialize(MessengerStart)
{

var contactsname = Messenger.MyName ;
var savedname = contactsname ;
contactsname = MsgPlus.RemoveFormatCodes(contactsname);

}

function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
if (Message == "!flash") {
flash();
Messenger.MyName = savedname ;
}
}

function OnEvent_Uninitialize(MessengerExit)
{
}


That's the correct syntax (you can compare what's wrong with your code). But that won't work I think, you want it to flash 10 times but your nick will change so quickly that it won't even change to your contacts... You could use timers, to wait 500ms or so to change the color of your nick.
RE: Help creating my first script by edmarriner on 07-22-2006 at 06:27 PM

thanks, that - wasnt ment to be there :$ .

I looked at msgplus 's timer but the quickest i could make it change to another color is every 10 seconds so it wont look like its "flashing"

is there a way to make the color change every say 1 second or so?
thanks,

-ed


RE: Help creating my first script by The_Joker on 07-22-2006 at 06:32 PM

quote:
Originally posted by edmarriner
Im tring to make the contacts name flash when they type !flash
So don't u need to use the RECEIVED msg func?

function OnEvent_ChatWndReceivedMessage(ChatWnd, Message);

I believe the time limit to change name is 6 seconds.
Better then 10 :P
RE: Help creating my first script by edmarriner on 07-22-2006 at 06:33 PM

by they i ment the person who wants there name to flash.


RE: Help creating my first script by The_Joker on 07-22-2006 at 06:38 PM

Oops, by the word contacts it seems like you mean your contact, not you.


RE: Help creating my first script by 4penguino on 07-22-2006 at 06:50 PM

function OnEvent_Uninitialize(MessengerExit)
{
}
does this bit have 2 be at the bottum of the script or the top?


RE: Help creating my first script by Silentdragon on 07-22-2006 at 07:00 PM

Doesn't matter just don't put it in another function.


RE: Help creating my first script by Aeryn on 07-22-2006 at 09:28 PM

You're using the variable contactsname inside the flash() function while it was defined inside the OnEvent_Initialize function. If you define a variable inside a function it means that it's a local variable, and it won't exist outside of the function it was declared in. It won't exist inside flash().

To fix this, declare contactsname outside of all functions with the "var" keyword and don't use "var" inside OnEvent_Initialize.