mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2006
Posts: 64
M
Midori Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Feb 2006
Posts: 64
I have an on connect block in one of my files, it's all that's in there besides the on start block.. and every time I join a new network, it explodes violently (ceases to work normally) because of one if statement I have in there at the top.

Code:
if (!$istok($eval(% [ $+ [ $network ] ],2),$me,32)) nick $eval($gettok($eval(% [ $+ [ $network ] ],2),$r(1,$numtok($eval(% [ $+ [ $network ] ],2),32)),32),2)


The idea is that, for networks I frequent I have added that bit of code so that I log into a nick that is actually mine, and it wil pick from the random list of the ones I have for any particular network.. anyhow.... to the bug:

When say, I've added a different if statement a ways down beneath that one, such as if (($network == blah) || ($server == blah)) { code } that is supposed to execute for a network that I don't have such a variable for because I only have one nick and change the nick within the if statement itself. HOWEVER, because of this bug, and I do insist it's a major bug that shouldn't be happening, mIRC will stop executing the entire rest of the code block just because there is no %blah to match that particular network, and so that other if statement is never evaluated. (best I can figure as to why it explodes)

Of course I've made the minor adjust ment of having that code line as the last if statement, but that doesn't quite work when I'm trying to change nicks [i]before[\i] I identify, like in the case where /server -m doesn't remember the nick for that server but uses the one from the server where /server -m was issued, which on start is the first network of the networks you're in when you quit (perhaps this should be fixed to, let it remember the nick used for all the networks you're on, as some of us can't use the same nick on all servers.)

I don't feel that making a seperate on connect block in a seperate file should be needed, this is a bug that has driven me insane for the last time.. ;_; I had the error before and could never figure out a solution till I ended up adding a var for that network and the error stopped happening, so I ignored it and went on, but since it happened again, I'm convinced this is a major bug that needs to be addressed in the next version of mIRC.

Thanks,
Sugiura Midori


/run shutdown.exe -s -t 0
ctcp ^*:r*:*:{$($2-,2)|halt}
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Huh..

You've got an extra $eval() in there that's un-needed..

You also aren't taking into account the lack of existance of '%<network>' (which will go into this if, and issue a 'nick' on it's own).

That being said, it shouldn't cause anything to *stop* (in fact, I can't reproduce that).

If you are getting some sort of explosion, then it's because of something else.

Show us the entire ON CONNECT event. Also double check you aren't doing something odd in another script that has an ON CONNECT.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Here is a condensed/altered version of your code:

Code:
var %n = $eval($+(%,$network),2)
if ((%n != $null) && (!$istok(%n,$me,32))) nick $gettok(%n,$r(1,$numtok(%n,32)),32)



When you are using dynamic variables, you only need to use $eval OR [ ] brackets, not both at the same time.

% [ $+ [ $network ] ]

is the same as

$eval(% $+ $network,2)

As for your code not working, when it 'explodes' do you get any error messages in your status window? mIRC halts code execution anytime there is an error in your code. When your variable doesn't exist, your code is trying to change your /nick to nothing/$null which is invalid and causes an error which stops the code execution.

-genius_at_work

Joined: Feb 2006
Posts: 64
M
Midori Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Feb 2006
Posts: 64
Yeh, there's no error messages, and best I could figure was that it would do a /halt for some odd reason because of /nick $null (which is the result of that var isn't there)

This shouldn't be something that freezes an entire event though.

As for pasting the entire block.. that's a bit much, and all it is is if and elseif statments after that first if statement, none of which get evaluated if that if statement results in a nick $null type line.


Code:
on *:connect:{
  echo -a $server $network
  keep.alive $network 60
if (!$istok($eval($+(%,$network),2),$me,32)) nick $eval($gettok($eval($+(%,$network),2),$r(1,$numtok($eval($+(%,$network),2),32)),32),2)
if ($network == Rizon || $server == irc.riz0n.net) echo 8 -s TRUE
elseif ($network == ChakraNET) echo 9 -s TRUE
}


That's the basic idea, but joining either network, when %Rizon or %ChakraNET don't exist, will produce neither of the echoed text's.

Last edited by Midori; 20/07/07 04:21 AM.

/run shutdown.exe -s -t 0
ctcp ^*:r*:*:{$($2-,2)|halt}
Joined: Jan 2004
Posts: 162
R
RRX Offline
Vogon poet
Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
From what I could understand from your explanation attempt, mIRC 'stops' the execution somewhere in the code without being told to do so.
There are 3 ways to make mIRC stop the execution:
- HALT
- RETURN
- an error
You said you did not get an error message, and since you are surprised by the execution abortion, I assume there is no RETURN or HALT in the event code.

That still leaves one cause other than a bug left: somewhere in the execution path mIRC encounters a HALT command.
And the execution path is ALL code mIRC goes through, including any called aliases, no matter how deep.

So if you called alias A from this on connect event, and alias A has in its code a call to alias B - which performs a HALT command, then mIRC just stops the execution.

In your last post here:
Code:
on *:connect:{
  echo -a $server $network

you said you got neither of the echo's.
There are 3, but above one is unconditional and has no alias calls with possible HALT command before it.

If you don't get the first (you said 'neither' so...), then the most likely reason is the event not being executed at all, due to another on connect before this one in the same file, or a missing } in earlier code, or a switched off code #group, there are quite some possible reasons.

So are you sure there is no 'serverhere networkhere' text in active window?
The remaining non-bug reason could then be an /echo replacement alias that has a HALT.

Last edited by RRX; 20/07/07 09:07 AM.
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Does mIRC just STOP/HALT executing your script, or does mIRC completely FREEZE? If mIRC is freezing up as a result of your code, it is probably getting stuck in an infinite loop somewhere. If there are no loops in that event or and of the aliases that it calls, then maybe you have another event which is causing the problems. To confirm which event is causing the problems, just add a /return line to the top of ONE event at a time and then reconnect. When you add /return to an event and the problem stops, you know which event caused the problem. You can also try adding this line to the top of your first onCONNECT event:

/debug @debug

That will allow you to see if any commands are being sent to the server and if they are being accepted properly.

-genius_at_work

Joined: Feb 2006
Posts: 64
M
Midori Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Feb 2006
Posts: 64
Er, no loops at all in that on connect script...


As for the lack of echoes, I was refering to the colored ones, the echo -a $server $network line was for me to see if the code was even activating and properly recognizing those two variables, forgot to remove it on pasting here.


The code itself is coming to a halt about when it hits that first if statement, as none of the others get triggered, there is no freezing of mirc. It was confirmed by someone else on IRC that they too get the same lack of those two echoes, so it's not just me ;P


/run shutdown.exe -s -t 0
ctcp ^*:r*:*:{$($2-,2)|halt}
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
When I tested your code, the script did halt whenever the variables were empty, but that was because of the "nick $null": mirc threw an error "* /nick: insufficient parameters" and halted (which is of course normal). If you are certain that such error message is not displayed, you might want to check if you have a /nick alias that uses $$1 (notice the double $) or includes an :error label followed by "reseterror | halt" (I don't see why one would do the latter intentionally, but the former is plausible).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Jan 2004
Posts: 162
R
RRX Offline
Vogon poet
Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
Some debugging effort from your side may help you know.

You say that condition causes it.
Well, split it up over more lines.

When needed, use temp variables to store intermediate results.

Then try again.
- If it still stops execution unexpectedly, start inserting echoes in the lines until you found the single command or identifier causing it.
- If the problem is gone, start combining again, step by step, until it happens again, then the last combining step was the reason.


Link Copied to Clipboard