|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
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
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
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2003
Posts: 300 |
i have done a bit of debugging and moved a few things around, this should! should! work, but doesnt,
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
|
|
|
|
Joined: Dec 2002
Posts: 774
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 774 |
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...
//if ( khaled isgod ) echo yes | else echo no
|
|
|
|
Joined: Apr 2003
Posts: 300
Fjord artisan
|
OP
Fjord artisan
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
|
|
|
|
|