mIRC Home    About    Download    Register    News    Help

Print Thread
#50399 20/09/03 02:46 PM
Joined: Apr 2003
Posts: 300
A
andymps Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Apr 2003
Posts: 300
this script, when reads froma log, and the line is
[15:47:44] Loading level C&C_Field.mix
it frezes, stops, does nothing, yet it should tokenize the line, the notice me $2
Code:
alias run1 {
  /.set %log %logpath $+ renlog_ $+ $date(m-d-yyyy) $+ .txt
  if ($read(%log, 1) != $null) {
    if (*load* !iswm $read(%log ,1)) && (*loading* !iswm $read(%log ,1)) {
      /tokenize 32 $read(%log,1)
      if (($1 != $null) && ($2 == $null)) {
        /write -dl1 %log
      }
      else {
        /tokenize 32 $read(%log,1) 
        if ($2 == $null) { 
          /write -dl1 %log
        }
        elseif ($2 != $null) {
          /.notice $me $2- 
          /.write FDS_Log_ $+ $date(m-d-yyyy) $+ .txt $read(%log, 1) 
          /.write -dl1 %log
        }
      }
    }
  }
  elseif (*loading* !iswm $read(%log ,1)) {
    .write -dl1 %log
  }
  elseif (*loading* iswm $read(%log ,1)) {
    /tokenize 32 $read(%log,1) | /.notice $me $2- | /.write FDS_Log_ $+ $date(m-d-yyyy) $+ .txt $read(%log , 1) | /.write -dl1 %log
  }
}

what is wrong with it, i cannot spot the problem


Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
#50400 21/09/03 08:25 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
You need to learn some things about debugging. For instance, does the first if statement even check out as $true? You can simply check by putting a echo behind it. When your filepath has spaces in it, I'm going with no btw.

Also - it would be a lot easier if we knew what this code is supoposed to do.

suggestions:
you use $read(filename,N) a lot, I'd suggest doing that once and dumping the output in a variable and then working with that.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#50401 21/09/03 07:03 PM
Joined: Apr 2003
Posts: 300
A
andymps Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Apr 2003
Posts: 300
i have done a bit of debugging and moved a few things around, this should! should! work, but doesnt,
Code:
lias run1 {
  /.set %log %logpath $+ renlog_ $+ $date(m-d-yyyy) $+ .txt
  if ($read(%log, 1) != $null) {
    if (*load* !iswm $read(%log ,1)) && (*loading* !iswm $read(%log ,1)) {
      /tokenize 32 $read(%log,1)
      if (($1 != $null) && ($2 == $null)) {
        /write -dl1 %log
        elseif ($2 != $null) {
          /.notice $me $2- 
          /.write FDS_Log_ $+ $date(m-d-yyyy) $+ .txt $read(%log, 1) 
          /.write -dl1 %log
        }
      }
      elseif (*loading* !iswm $read(%log ,1)) && (*load iswm $read(%log ,1)) {
        .write -dl1 %log
      }
      elseif (*loading* iswm $read(%log ,1)) {
        /tokenize 32 $read(%log,1) 
        /.notice $me $2- 
        /write FDS_Log_ $+ $date(m-d-yyyy) $+ .txt $read(%log , 1) 
        /write -dl1 %log
      }
    }
  }
}
;i did 
//if (*loading* iswm $read(%log ,1)) { echo #EVO-Scripting hi }
;echoed hi as expected, so that means it should do
        /tokenize 32 $read(%log,1) 
        /.notice $me $2- 
        /write FDS_Log_ $+ $date(m-d-yyyy) $+ .txt $read(%log, 1)
;but doesnt, i have looked over and over but cannot work out why, someone plz help me



Liek OMG Yuo Stoleded my MageHurtzzzz!!!11
#50402 21/09/03 07:56 PM
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
Code:
 
alias run1 {
  .set %log %logpath $+ renlog_ $+ $date(m-d-yyyy) $+ .txt
  var %read = $read(%log, 1)

  ;$read is SLOW... so why to do it many many many many times in single alias???

  tokenize 32 %read

  ;tokenize ain't so slow that it would hurt the script even if it's run everytime alias runs

  if ( %read != $null ) {
    if ( *load* !iswm %read ) {

      ; *load* matches everything *loading* matches

      if (( $1 != $null ) && ( $2 == $null )) {
        write -dl1 %log

        ;Missing bracket here, look at the identation, I see no if before elseif?????

        elseif ( $2 != $null ) {
          .notice $me $2- 

          ;sending notice to self is just plain stupid? why not use echo????

          .write FDS_Log_ $+ $date(m-d-yyyy) $+ .txt %read 
          .write -dl1 %log
        }
      }
      elseif (( *loading* !iswm %read ) && ( *load iswm %read )) {
        .write -dl1 %log
      }
      elseif (* loading* iswm %read ) {
        .notice $me $2- 
        write FDS_Log_ $+ $date(m-d-yyyy) $+ .txt %read
        write -dl1 %log
      }
    }
  }
}
 


just a few I could spot... Also added some spaces & brackets to ifs...


Code:
//if ( khaled isgod ) echo yes | else echo no
#50403 21/09/03 09:07 PM
Joined: Apr 2003
Posts: 300
A
andymps Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Apr 2003
Posts: 300
i dont know why but it doesnt work, just doesnt go.
from the %log -> [19:34:00] Loading level C&C_Field.mix
thats the line it doesnt like, but i dont know why
well appart from the loading, the load and loading it wornt do, everthing else it will


Liek OMG Yuo Stoleded my MageHurtzzzz!!!11

Link Copied to Clipboard