mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2015
Posts: 22
M
M_A_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2015
Posts: 22
please, add script/file and line number when you issue an unknown command error
Thank you
Please mention me if you decide to code it.

Joined: Jul 2006
Posts: 4,172
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,172
When mIRC execute a command, if it's not a built-in command or a custom alias, the command is sent to the server, assuming it might be an IRC command, and in this case, when the command is not recognized by the IRC server, it replies back with a raw 421 UNKNOWN COMMAND, there is nothing mIRC can do to tell you which script/line number executed this command.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Sep 2015
Posts: 22
M
M_A_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2015
Posts: 22
In the meantime I think about a workaround for it that I can suggest, I want to thank you for your clear explanation and your time. I wonder of it would be possible to enable a switch for non-explicit irc server commands to be tracked, showing script/line number for them.
My usual situation is receiving an "ELSE unknown command" which leaves me clueless and I guess the same thing happens to a few more mirc scripters.
Thank you again for your time.

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
If you see the ELSE Unknown Command error and you are trying to create a script it is recommended for starters to use an mSL help program called mSLDev have a look here maybe will help you solve the problem: here


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Sep 2015
Posts: 22
M
M_A_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2015
Posts: 22
What can I say ... with that simple message you might have saved part of my life. I am indebted to you.
Thank you again.
Anyway my suggestion still makes sense and I think it deserves to be taken into account by the mirc developping team.

Last edited by M_A_; 21/09/15 09:32 PM. Reason: Adding a remark
Joined: Jul 2006
Posts: 4,172
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,172
How do you suggest mIRC takes it into account?
The only thing I can see is what you said, getting mIRC into a 'non-server' state where it wouldn't send commands to the server as a last try, it would instead error out with the typical scriptfile/line number informations.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2005
Posts: 17
C
Pikka bird
Offline
Pikka bird
C
Joined: Jun 2005
Posts: 17
I can certainly see the value, and problems, associated with trying to track the script/line number when trying to fix a buggy script. What I would suggest comes from my background in writing TCL (and something similar in Perl): When an unknown command is about to be processed, the interpreter calls a function called "unknown", which let's the script itself try to resolve the command, before trying something else such as passing the command on to the command shell for execution.

In mIRC, I can see this being implemented as a remote, such as:

ON 1:UNKNOWN:/echo I don't know command $1 $+ ! | HALTDEF

Where a HALTDEF would halt the default operation of mIRC trying to send the command on to the server. Additional identifiers could be set to indicate which script file and line number were being executed at the time.

I can see value in such a remote event in cases where you would want to build up a command and/or parameters.. for example, I have a script that handles certain RAW numeric from certain servers or certain groups enabled, but not others. I do this by building up a command like "VAR %cmd = OnRaw<numeric>" then use $ISALIAS(%cmd) to see if such an alias exists. If it does, the script executes it. If not, it simply moves on without doing anything.

With an ON *:UNKNOWN:... remote, I could simply try to call the alias, and in the UNKNOWN handler, either try to handle the situation, or simply ignore it and assume I've not defined a handler for this particular server connection.

I hope I'm being clear.. Re-reading what I wrote, I'm not so sure!


Link Copied to Clipboard