mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2007
Posts: 21
M
marco50 Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Aug 2007
Posts: 21
the timing when loading a script seems different in 6.3, compared with 6.21. in 6.21, this code worked well
(winXP SP2. mirc clean, begun from scratch, no additional scripts):
Code:
on *:START: {
 /toolbar -az3y100 afk "a tip" myicon.ico /myalias
 if ($toolbar(afk)) /echo -s * toolbar ok
 /hmake -s wconn 20
}
on *:ACTIVE:*: {
 /toolbar -y100 afk
 /hadd wconn active $cid 
}

in 6.21, the output is:
* toolbar ok
* Made hash table 'wconn' (100)

In 6.3, the output is:
/toolbar: no such button 'afk' (line 7, script1.ini)
* toolbar ok
* Made hash table 'wconn' (100)

If I swap the two commands in the onActive section, in 6.3 I get the error that the hash table does not exist.

My conclusion: in 6.21, the onACTIVE code gets active after the completion of the onSTART code. In 6.3, it lookes like both parts get active somehow simultaeously.
My workaround:
Code:
on *:START: {
  if (!$toolbar(afk)) /toolbar -az3y100 afk "a tip" myicon.ico /myalias
  if ($toolbar(afk)) /echo -s * toolbar ok
  if (!$hget(wconn)) /hmake -s wconn
}
on *:ACTIVE:*: {
  if (!$toolbar(afk)) /toolbar -az3y100 afk "a tip" myicon.ico /myalias
  /toolbar -y100 afk
  if (!$hget(wconn)) /hmake -s wconn
  /hadd wconn blah 123 
}

Awkward. I had to add the if-statement for the hash table too. otherwise I'd get a no-such-table error.
also, I hat to add the if-statements in the onSTART code to stay compatible with 6.21
(my preliminary, incomplete examination here )

Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks, it appears that a change in the way scripts are loaded on startup was allowing events to be triggered before the on START event. This has been fixed for the next version.


Link Copied to Clipboard