mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 76
G
Babel fish
OP Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
I'm trying to make my script work with its own script files and not the *.ini's. After editing the mirc.ini file to load the popup files, aliases and remotes (*.mage) and running mirc, it hangs and i have to use Alt+Ctrl+del to close it. I don't understand what's wrong with it, so i give you the code:

on 1:START: {
iecho Executing virus-check...
var %a, %v, %x
set %a 1
while ($script(%a)) {
set %v $ifmatch
set %x $nopath(%v)
if ($gettok(%x,2,46) != mage) {
unload -rs %x
iecho Possible virus 4( $+  $+ %x $+  $+ )1 found and unloaded! } } }

Please help! I'm in dispared! confused

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Code:
on *:START:{ 
  echo Executing virus-check...
  var %a, %v, %x
  set %a 1 
  while ($script(%a)) { 
    set %v $ifmatch
    set %x $nopath(%v)
    if ($gettok(%x,2,46) != mage) { 
      unload -rs %v
      echo Possible virus 4( $+  $+ %x $+  $+ ) found and unloaded! 
    } 
    inc %a
  }
}

Joined: Feb 2003
Posts: 76
G
Babel fish
OP Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
Thanks man... Really helped! smile

Joined: Feb 2003
Posts: 76
G
Babel fish
OP Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
Here I am again having problems! I wrote this code to load every alias or remote when the script starts:
Code:
 on 1:START: { 
  iecho Loading script files...
  var %a, %b, %c, %d
  set %a 1
  while ($findfile($mircdir,*.mage,%a)) { 
    set %b $ifmatch
    set %c $nopath(%b)
    set %d $read(%c,1)
    if (%d == ;[scriptfile]) { 
      load -rs %c
    } 
    elseif (%d == ;[aliasfile]) { 
      load -a %c
    } 
  inc %a
} 

The thing is that it won't work and it'll only say "ΠΟΰ΅±" in the remote code. That REALLY seems weird! (Of course, all aliases have their first line ";[aliasfile] and all remotes ";[scriptfile]"). Need your help again message board! confused

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
mIRC won't parse if " ;[chars])" , the ";" char screws up when it (or any following char) is followed by a bracket
Try using no brackets...
Code:
    set %d $read(%c,1)
    if %d == ;[scriptfile] { load -rs %c }
    elseif %d == ;[aliasfile] { load -a %c }


Joined: Feb 2003
Posts: 76
G
Babel fish
OP Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
Oh hell it won't work by any means... I tried out removing the {} brackets, the [] brackets and even the ";"! Do you have any other ideas how it could possibly work?
Thanks anyway smile

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Code:
on *:START:{
  iecho Loading script files...
  .!echo -q $findfile($mircdir,*.mage,0,mageload $1-)
}
mageload {
  var %a = $+(",$1-,"),%b = $read(%a,1)
  if %b == ;[scriptfile] { load -rs %a }
  elseif %b == ;[aliasfile] { load -a %a }
}

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
There is a logical error in this loop, which can result in certain items (in this case, script files) being skipped. For example: if you are checking the 5th file and find it infected, you /unload the script. But doing so, the 6th script (as reported by $script(%a)) now becomes the 5th script, the 7th becomes the 6th etc. However, %a is still incremented, so when you move on to the 6th script, it is actually the 7th. The result is that the (initial) 6th file is skipped.

You have to either
1) insert an "else" in front of "inc %a" or
2) insert a "continue" right below the echo command or
3) make the loop decrementing, starting from $script(%a), where %a is initially set to $script(0) and /dec-ing %a

On a sidenote, I'd use the -n switch in /unload, to avoid triggering a possible on UNLOAD event in that script. Also, I'd use the ! prefix for commands, to avoid problems in case that script has aliased mirc's built-in commands.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Feb 2003
Posts: 76
G
Babel fish
OP Offline
Babel fish
G
Joined: Feb 2003
Posts: 76
The heck... The problem is not in this piece of code! I tried out removing it and the problem is still there no matter what i did. Thanks anyway guys, i really should have checked that possibility. I'll see what i can do. smirk


Link Copied to Clipboard