IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: Osiris on August 26, 2010, 12:37:02 PM

Title: In need of autoident
Post by: Osiris on August 26, 2010, 12:37:02 PM
I'm trying to migrate from mIRC to icechat, and as I'm an op on a server I have to convert some of my scripts. One of which is an auto ident as nicks are often changed on this server and needing to identify manually after changing back is a real pain in the butt.

How can I convert a script such as this

Code: [Select]
on 1:NOTICE:This nick is owned by someone else.*:?:{
  if $nick = NickServ {
    /msg nickserv ident password
  }
}

And similarly this:
Code: [Select]
on 1:NOTICE:*Access denied*:?:{
  if $nick = ChanServ || $nick = OperServ || $nick = NickServ || $nick = MemoServ  {
    /msg nickserv ident password
  }
}

Thanks much, any advice and help is greatly appreciated!
Title: Re: In need of autoident
Post by: Morio on August 27, 2010, 03:24:46 AM
Why don't you just use the autoperform option, found in the server editor? You'll want to identify yourself every time you join the server anyway.
Title: Re: In need of autoident
Post by: Osiris on August 27, 2010, 12:26:16 PM
I do use the auto perform which works great on startup, however it doesn't work after a name change has occurred and I have to ident manually.
Title: Re: In need of autoident
Post by: Osiris on August 27, 2010, 04:32:35 PM
Well I sort of have the audoident going. I've sure people who have a handle on the scripting language will see many flaws with it.

Code: [Select]
Sub ONNOTICE(Message,Nickname,Host,ServerNumber)
if Message = "This nick is owned by someone else.  Please choose another." and Nickname = GetIdentifier ("NickServ") then
sendcommand "/ns identify password"
else if Message = "Access denied." then
sendcommand "/ns identify password"
else if Message = "Permission denied." then
sendcommand "/ns identify password"
end if
end if
end if
End Sub

I still can't figure out how to add multiple names to who could be sending this message, such as with the "Access Denied" message it can come from ChanServ or OperServ.
Title: Re: In need of autoident
Post by: Snerf on August 27, 2010, 08:41:02 PM
Ok, you dont need to use GetIdentifier("Nickserv"), as GetIdentifier is used for getting $variables.

Code: [Select]
Sub ONNOTICE(Message,Nickname,Host,ServerNumber)
if Nickname = "NickServ" or NickName = "OperServ" then
    if Message = "This nick is owned by someone else.  Please choose another." then
          sendcommand "/ns identify password", servernumber
    else if Message = "Access denied." then
          sendcommand "/ns identify password", servernumber
    else if Message = "Permission denied." then
          sendcommand "/ns identify password", servernumber
    end if
end if
End Sub

That should do the trick for you.
Its important to add the ServerNumber at the end, if you are connected to multiple servers.
Title: Re: In need of autoident
Post by: Osiris on August 28, 2010, 11:52:51 AM
Awesome, thanks for the help. I've made the changes to the script which now looks like-
Code: [Select]
Sub ONNOTICE(Message,Nickname,Host,ServerNumber)
if Nickname = "NickServ" or Nickname = "ChanServ" or Nickname = "OperServ" then
    if Message = "This nick is owned by someone else.  Please choose another." then
        sendcommand "/ns identify password"
    else if Message = "Access denied." then
        sendcommand "/ns identify password"
    else if Message = "Permission denied." then
        sendcommand "/ns identify password"
    end if
    end if
    end if
end if
End Sub
As I only connect to one server I didn't include a server number. Also it seemed to want more end ifs so I added those.

Thanks again for the help. 8-)
Title: Re: In need of autoident
Post by: Snerf on August 28, 2010, 02:32:48 PM
Well, it should not need those extra 'end if's, but hey, if it works for you, its all good.
Title: Re: In need of autoident
Post by: v29 on February 01, 2011, 04:33:08 PM
The script seem to work great for me also, but...

if I change my nickname from f.i. "v29" to "v29|Away" it doesn't wanna work.
Well,the nick is added to the profiles and so on.From all of my profiles(v29 or v29|work or v29_ or v29|nap) this one (v29|Away) is the only one which doesn't work properly.

Have to say one thing:I'm a newbie to scripting,so maybe I made some sort of general error while using this script
Code: [Select]
on 1:CONNECT:{
/msg nickserv identify PW
}
Sub ONNOTICEThis nick is owned by someone else.NICK!*@*
if Nickname = "NickServ" or Nickname = "ChanServ" or Nickname = "OperServ" then
if Message = "This nick is owned by someone else.  Please choose another." and Nickname = GetIdentifier ("NickServ") then
sendcommand "/ns identify PW"
else if Message = "Access denied." then
sendcommand "/ns identify PW"
else if Message = "Permission denied." then
sendcommand "/ns identify PW"
end if
end if
end if
end if
End Sub

Title: Re: In need of autoident
Post by: Snerf on February 01, 2011, 05:18:01 PM
That code wont work at all.

1. You can not mix mirc scripting with VB Style in the same file, they need to be saved in seperate files as seperate file types.

2. Sub ONNOTICEThis nick is owned by someone else.NICK!*@* .. this is all wrong.
it is supposed to be Sub ONNOTICE(Message,Nickname,Host,ServerNumber)
And then you add in all the code, as shown in previous examples.
Title: Re: In need of autoident
Post by: v29 on February 02, 2011, 07:19:34 AM
That code wont work at all.

1. You can not mix mirc scripting with VB Style in the same file, they need to be saved in seperate files as seperate file types.

2. Sub ONNOTICEThis nick is owned by someone else.NICK!*@* .. this is all wrong.
it is supposed to be Sub ONNOTICE(Message,Nickname,Host,ServerNumber)
And then you add in all the code, as shown in previous examples.
thanks.
Did it just like you said (took the mirc stuff out,changed e-thing) and still I have to identify manually when I change my nick.
Title: Re: In need of autoident
Post by: Snerf on February 02, 2011, 07:31:17 AM
Paste the what you have. Also, what kind of a file type did you save it as?
Title: Re: In need of autoident
Post by: v29 on February 07, 2011, 11:27:01 PM
Paste the what you have. Also, what kind of a file type did you save it as?
it was a long way till I got what you meant with "save as".also I had no internet access,that's why I'm kinda late on this.sorry.

ok,back to topic:I saved the following as ".ics" in my favorites and atm it looks like it works.
Code: [Select]
ONNOTICE(Message,Nickname,Host,Servernumber)
if Nickname = "NickServ" or "NickName" = "OperServ" then
    if Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    else if Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    else if Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    else if Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    else if Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    else if Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    end if
End if
End NOTICE

since I have 5 different nicks atm, it should be possible to add another one if needed.
it's quite a lot learning by doing.

one more question:do I have to load the script e-time I start Ice or does it load by itself?

thanks much for keeping your great work,snerf.
first I was into mIRC,but then Ice turned out as the better one since it is really more intuitive.
Title: Re: In need of autoident
Post by: Morio on February 07, 2011, 11:38:31 PM
You should save the file as .ice, not .ics

on the second line, you should not have quotes around Nickname, because that causes it to be treated like a string, not a variable
Code: [Select]
if Nickname = "NickServ" or NickName = "OperServ" then
Also, you have 6 identical If statements. If the first one doesn't trigger, neither will the following 5.

And one more thing, there is no 'Else If', it should be 'ElseIf'
Title: Re: In need of autoident
Post by: Snerf on February 08, 2011, 06:54:22 AM
Also,you also removed the SUB part in the beginning of the ONNOTICE and at the end it is not END Notice, it is END Sub

Sub ONNOTICE(Message,Nickname,Host,ServerNumber)
.
.
.
End Sub


Also, unless you only connect to 1 server, you should add ', ServerNumber' at the end of the sendcommand lines, so it knows what server to send the command to.

SendCommand "/ns identify PW", ServerNumber
Title: Re: In need of autoident
Post by: v29 on February 09, 2011, 05:58:40 PM
You should save the file as .ice, not .ics

on the second line, you should not have quotes around Nickname, because that causes it to be treated like a string, not a variable
Code: [Select]
if Nickname = "NickServ" or NickName = "OperServ" then
Also, you have 6 identical If statements. If the first one doesn't trigger, neither will the following 5.

And one more thing, there is no 'Else If', it should be 'ElseIf'
thanks.I'm using 5 nicknames atm and I maybe wanna add one,thats why.weirdly this script works my Vista laptop.(maybe version Ice7 used there?don't have any access to lappie atm,only at weekends)

also,if I save it as ".ice"(win7 PC) there is this error message:
->> ERROR:modScriptFunctions:HF.NOW.working.script4th.try.ice:200:Function:LoadScriptFile:Error Number:1032 : UngültigesZeichen -->(unvalid sign/symbol/parameter - dunno the correct english translation for "Zeichen" at this point),maybe this is because I use Ice7.70?(just clicked on the version info cause this all made no sense to me and invented this...sorry for any confusion btw :))Because when I save it as ics-file,this message doesn't occur.

Quote from: Snerf link=topic=1482.msg6383#msg6383 date=1297176862
Also,you also removed the SUB part in the beginning of the ONNOTICE and at the end it is not END Notice, it is END Sub

Sub ONNOTICE(Message,Nickname,Host,ServerNumber)
.
.
.
End Sub


Also, unless you only connect to 1 server, you should add ', ServerNumber' at the end of the sendcommand lines, so it knows what server to send the command to.

SendCommand "/ns identify PW", ServerNumber
ok,thanks.changed it (took out Servernumber) since I only use one server atm.
But there's still something wrong with it, as I still have to identify manually.

There's something I don't get:is it important to use upper- and lowercases?
Anyway,this my not-working result...phew.This whole thing costs me a lot of patience.

Code: [Select]
Sub ONNOTICE(Message,Nickname,Host)
if Nickname = $NickServ$ or NickName = $OperServ$ then
    if Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    ElseIf Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    ElseIf Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    ElseIf Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    ElseIf Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    ElseIf Message = "This nickname is registered and protected."
        sendcommand "/ns identify PW"
    endIf
EndIf
End Sub

what did I do wrong this time?mixing up the two versions, 7 and 7.70, on 2 different computers?

edit:all my alias list (the default one) is gone, by accident I guess.what do I do now to solve that prob?re-install?
and do all those settings again which I did already,like autoperform by server etc.
o.O way too much for me.I go to sleep

edit2: can someone mail me the aliases by PM please?
Title: Re: In need of autoident
Post by: Snerf on February 09, 2011, 10:01:49 PM
Your changing things every time, and then you make changes that dont work.

if Nickname = $NickServ$ or NickName = $OperServ$ then

needs to be:

if Nickname = "NickServ" or NickName = "OperServ" then

And do you not nice that every one if the ElseIf statements, are checking for the same thing?

IceChat 7 and 7.70 are the same thing. 7.70 is just an update.
Title: Re: In need of autoident
Post by: v29 on February 10, 2011, 12:25:23 AM
First there is this language border which keeps me looking up words again and again and again.Sure, it would be easier if english was my mother's tongue.
But it isn't. *half smile*
My Vista Laptop is doing quite well with my third or fourth script although it may contain mistakes.

As I stated before I'm completely new to nowadays computer scripting.

on the second line, you should not have quotes around Nickname, because that causes it to be treated like a string, not a variable
Code: [Select]
if Nickname = "NickServ" or NickName = "OperServ" then
???--->
if Nickname = $NickServ$ or NickName = $OperServ$ then
needs to be:
if Nickname = "NickServ" or NickName = "OperServ" then

Your changing things every time, and then you make changes that dont work.
Mistakes are made for learning from them.
And do you not nice that every one if the ElseIf statements, are checking for the same thing?
no.how should I have known.no one told me before Morio did so.and I stated earlier that I wanted to use several different nicks.

Have you ever heard of any bicycle rider who could drive a Formula 1 car perfectly?

You have told me to paste the "what I have".
I do so and misunderstandings happen.
Sorry,but when I or my behaviour gets you this upset,then I will make it on my own.
How long it will ever take.

Title: Re: In need of autoident
Post by: Snerf on February 10, 2011, 12:43:01 AM
Well, you just seem to keep repeating the same mistakes, that is all.