Help creating my first script |
Author: |
Message: |
edmarriner
New Member
Posts: 5
Joined: Jun 2006
|
O.P. Help creating my first script
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
This post was edited on 07-22-2006 at 05:33 PM by edmarriner.
|
|
07-22-2006 05:31 PM |
|
|
foaly
Senior Member
Posts: 718 Reputation: 20
38 / /
Joined: Jul 2006
|
RE: Help creating my first script
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
This post was edited on 07-22-2006 at 05:48 PM by foaly.
|
|
07-22-2006 05:43 PM |
|
|
Pai
Full Member
w00t !
Posts: 203 Reputation: 2
– / / –
Joined: Sep 2003
|
RE: Help creating my first script
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.
|
|
07-22-2006 05:51 PM |
|
|
edmarriner
New Member
Posts: 5
Joined: Jun 2006
|
O.P. RE: Help creating my first script
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
|
|
07-22-2006 06:27 PM |
|
|
The_Joker
Full Member
TF
Posts: 125
Joined: Oct 2005
|
RE: Help creating my first script
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
This post was edited on 07-22-2006 at 06:35 PM by The_Joker.
Messenger Plus! 3.61 unofficial Hebrew translator
Messenger Plus! Live unofficial Hebrew translator
|
|
07-22-2006 06:32 PM |
|
|
edmarriner
New Member
Posts: 5
Joined: Jun 2006
|
O.P. RE: Help creating my first script
by they i ment the person who wants there name to flash.
|
|
07-22-2006 06:33 PM |
|
|
The_Joker
Full Member
TF
Posts: 125
Joined: Oct 2005
|
RE: Help creating my first script
Oops, by the word contacts it seems like you mean your contact, not you.
Messenger Plus! 3.61 unofficial Hebrew translator
Messenger Plus! Live unofficial Hebrew translator
|
|
07-22-2006 06:38 PM |
|
|
4penguino
Banned
Posts: 85 Reputation: -13
Joined: Jul 2006
|
RE: Help creating my first script
function OnEvent_Uninitialize(MessengerExit)
{
}
does this bit have 2 be at the bottum of the script or the top?
|
|
07-22-2006 06:50 PM |
|
|
Silentdragon
Full Member
if(life==null && wrists) EmoAlert();
Posts: 148 Reputation: 2
34 / / –
Joined: Jun 2006
|
RE: Help creating my first script
Doesn't matter just don't put it in another function.
|
|
07-22-2006 07:00 PM |
|
|
Aeryn
Full Member
Posts: 230 Reputation: 28
– / / –
Joined: Jun 2005
Status: Away
|
RE: Help creating my first script
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.
This post was edited on 07-22-2006 at 09:31 PM by Aeryn.
|
|
07-22-2006 09:28 PM |
|
|
|