mIRC Home    About    Download    Register    News    Help

Print Thread
#266059 13/09/19 09:12 PM
Joined: Mar 2004
Posts: 155
D
Darkmnm Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Mar 2004
Posts: 155
I'm working with a old addon for auto identify and having issues.

From my Menubar popup when I click on:
.List stored nicknames:{ auto.ident -l }

a @window opens and I get the following error:
* /filter: unable to open file 'C:\Users\USERNAME\AppData\Roaming\mIRC\script\data\remotes\script\data\files\autoident.ini' (line 21, script2.tps)

Line 21 is as follows:
filter -fLg $ai.ini @auto-ident /^\[[^\[\]]++\]$/

Now, the path should be the following:
$scriptdirscript\data\files\autoident.ini

I believe the error has to do with the /^\[[^\[\]]++\]$/ code in Line 21 but I have no idea what any of that means and/or does. Any assistance with this is greatly appreciated.

Full code is below:

on *:load:{ writeini $ai.ini options nick enable }

alias -l ai.ini { return $qt($scriptdirscript\data\files\autoident.ini) }

alias auto.ident {
if ($1 == -a) {
if (($2) && ($3) && ($4)) { writeini $ai.ini $2 $3 $4 }
else { echo -a Please use in the format: /auto.ident -a server nickname password }
}
if ($1 == -ru) {
if (($2) && ($3)) { remini $ai.ini $2 $3 }
else { echo -a Please use in the format: /auto.ident -ru server nickname }
}
if ($1 == -rs) {
if (($2)) { remini $ai.ini $2 }
else { echo -a Please use in the format: /auto.ident -rs server }
}
if ($1 == -l) {
window -adl20k0S @auto-ident
titlebar @auto-ident $ai.ini
filter -fLg $ai.ini @auto-ident /^\[[^\[\]]++\]$/
}
if ($1 == -n) {
$iif($readini($ai.ini,options,nick) == enable,writeini $ai.ini options nick disable,writeini $ai.ini options nick enable)
}
if ($1 !isin -a -rs -ru -l -n) {
echo -a Please use in the form auto.ident [-a/-ru/-rs/-l]
echo -a -a = Add auto ident. Eg: /auto.ident -a server.com mynick password
echo -a -ru = Remove auto ident nickname. Eg: /auto.ident -ru server.com nickname
echo -a -rs = Remove auto ident server. Eg: /auto.ident -rs server.com
echo -a -l = List currently stored servers and Passwords. Used as: /audio.ident -l
echo -a -n = This will disable the auto nickname change when connecting to a server with a stored auto-identification. Used as: /auto.ident -n
echo -a You can use -n again to Re-enable the auto nickname change.
}
}

on *:connect:{
if ($ini($ai.ini,$server)) {
if ($readini($ai.ini,$server,$me) { msg nickserv identify $readini($ai.ini,$server,$me) | goto end }
else {
if ($readini($ai.ini,options,nick) == enable) {
nick $ini($ai.ini,$server,1)
msg nickserv identify $readini($ai.ini,$server,$me)
goto end
}
else { echo -a You have chosen not to change your nickname | goto end }
}
}
var %n = 1
while (%n <= $ini($ai.ini,0)) {
if ($gettok($server,2-,46) isin $ini($ai.ini,%n)) {
if ($readini($ai.ini,$ini($ai.ini,%n),$me)) { msg nickserv identify $readini($ai.ini,$ini($ai.ini,%n),$me) | goto end }
if ($ini($ai.ini,%n,0) == 0) { goto message1 }
else {
if ($readini($ai.ini,options,nick) == enable) {
nick $ini($ai.ini,%n,1) | msg nickserv identify $readini($ai.ini,$ini($ai.ini,%n),$ini($ai.ini,%n,1)) | goto end }
}
else { echo -a You have chosen not to change your nickname | goto end }
}
else { inc %n }
}
:message2
echo -a This server is not set to auto-identify any nicknames.
goto end
:message1
echo -a There are no nicknames stored for this server.
:end
}

menu @auto-ident {
dclick:{
loadbuf -rt $+ $remove($sline($active,1),[,]) $active $ai.ini
if (!$line($active,0)) aline $active * This item has no data.
}
}

Darkmnm #266060 13/09/19 09:38 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
The error has to do with the fact that /filter cannot open the file


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #266061 14/09/19 03:11 AM
Joined: Mar 2004
Posts: 155
D
Darkmnm Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Mar 2004
Posts: 155
Thanks Captain Obvious.

For anyone else that reads this post I had $scriptdir and not $mircdir which altered the full path that it was supposed to be looking for.

Darkmnm #266062 14/09/19 07:54 AM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Pro-tip. You shouldn't toss that moniker around when someone points you to the true problem instead of the mistaken problem that you were blaming the error message on.

maroon #266065 14/09/19 06:00 PM
Joined: Mar 2004
Posts: 155
D
Darkmnm Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Mar 2004
Posts: 155
You are right. My apologies Wims.

Darkmnm #266066 14/09/19 06:18 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
smile
Note that if ($1 !isin -a -rs -ru -l -n) does not properly validate the parameter as passing '-' wouldn't trigger that if.
In this case it's better to use elseif and else to reuse the previous logic, but in general you could have used if (!$istok(-n -a -rs etc..,$1,32))

Code
alias auto.ident {
if ($1 == -a) {
if (($2) && ($3) && ($4)) { writeini $ai.ini $2 $3 $4 }
else { echo -a Please use in the format: /auto.ident -a server nickname password }
}
elseif ($1 == -ru) {
if (($2) && ($3)) { remini $ai.ini $2 $3 }
else { echo -a Please use in the format: /auto.ident -ru server nickname }
}
elseif ($1 == -rs) {
if (($2)) { remini $ai.ini $2 }
else { echo -a Please use in the format: /auto.ident -rs server }
}
elseif ($1 == -l) {
window -adl20k0S @auto-ident
titlebar @auto-ident $ai.ini
filter -fLg $ai.ini @auto-ident /^\[[^\[\]]++\]$/
}
elseif ($1 == -n) {
$iif($readini($ai.ini,options,nick) == enable,writeini $ai.ini options nick disable,writeini $ai.ini options nick enable)
}
else {
echo -a Please use in the form auto.ident [-a/-ru/-rs/-l]
echo -a -a = Add auto ident. Eg: /auto.ident -a server.com mynick password
echo -a -ru = Remove auto ident nickname. Eg: /auto.ident -ru server.com nickname
echo -a -rs = Remove auto ident server. Eg: /auto.ident -rs server.com
echo -a -l = List currently stored servers and Passwords. Used as: /audio.ident -l
echo -a -n = This will disable the auto nickname change when connecting to a server with a stored auto-identification. Used as: /auto.ident -n
echo -a You can use -n again to Re-enable the auto nickname change.
}
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #266071 16/09/19 01:47 AM
Joined: Mar 2004
Posts: 155
D
Darkmnm Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Mar 2004
Posts: 155
Thank you Wims. I greatly appreciate the changed code.


Link Copied to Clipboard