Aktuelle Zeit: 20. April 2024 14:49

Alle Zeiten sind UTC + 1 Stunde




 Seite 1 von 1 [ 1 Beitrag ] 
Autor Nachricht
 Betreff des Beitrags: /do command with "endless loop fix" (50% ;))
BeitragVerfasst: 18. März 2008 00:26 
Administrator
Benutzeravatar

Registriert: 17. März 2008 13:32
Beiträge: 96
Wohnort: NRW, Germany
alias do {
  if ($1 == -n) { tokenize 32 $2- | var %output.sendÿ = $true }
  var %t = $ticks,%f = $left($2,1),%o = $iif($istok(% $,%f,32) || $2- == $chr(35),return $2-,$2-),%output
  convert %o
  !.load -rs tmp.mrc
  %output = $protect.debugalias
  goto done
  :error
  %output = $gettok($error,$+(2-,$calc($findtok($error,$chr(40) $+ line,1,32) -1)),32)
  reseterror
  :done
  $iif($1 ischan,msg,.notice) $1 $iif(!%output.sendÿ,$2- ->) $iif(%output != $null,%output,<empty string>) - $ms($calc($ticks - %t))
  if ($isfile(tmp.mrc)) {
    !.unload -rs tmp.mrc
    !.remove tmp.mrc
  }
  unset %output
}
alias -l convert {
  var %t = $md5($ticks)
  var %o = $1-
  write -c tmp.mrc
  if (while isin $1- && ($chr(123) !isin $1- && $chr(125) !isin $1-)) { error Please use exact while loops: "while (ifmatch) $!chr(123) command $!chr(125) $!+ " | goto end }
  if ($count(%o,$chr(32) $+ $chr(123)) != $count(%o,$chr(32) $+ $chr(125))) { error Bracket mismatch | goto end }
  if ($len($1-) > 300) { error String to long | goto end }
  if (!$lines(tmp.mrc)) {
    add alias protect.debugalias $chr(123)
    add var % $+ %t = $!ticks
    if ($1 != return) {
      %o = $replace(%o,$+($chr(32),$chr(123),$chr(32)),$+($chr(32),$chr(123),$lf))
      %o = $replace(%o,$+($chr(32),$chr(124),$chr(32)),$lf)
      %o = $replace(%o,$+($chr(32),$chr(125),$chr(32)),$+($lf,$chr(125),$lf))
      %o = $replace(%o,$+($chr(32),$chr(125)),$+($chr(32),$lf,$chr(125)))
    }
    add %o
    var %x = $read(tmp.mrc,nw,while * $chr(123))
    var %newline = $readn
    if (%newline) {
      write -il $+ $calc(%newline +1) tmp.mrc if ($calc($ticks - % $+ %t $+ ) > 300000) $chr(123) break $chr(125)
    }
    add $chr(125)
  }
  ;checking while loops
  var %x = $read(tmp.mrc,nw,while *)
  if (%x) {
    if ($right(%x,1) != $chr(123)) { write -c tmp.mrc | error Please check your while loops (maybe you missed some brackets :p) | goto end }
    while ($read(tmp.mrc,nw,while *,$calc($readn +1))) {
      %x = $ifmatch
      if ($right(%x,1) != $chr(123)) { write -c tmp.mrc | error Please check your while loops (maybe you missed some brackets :p) | goto end }
    }
  }
  :end
}
alias -l error { add alias protect.debugalias return $1- }
alias -l add { write tmp.mrc $1- }
alias -l ms return $duration($left($1,-3)) $iif($int($right($1,3)) != $null,$ifmatch $+ ms)



_________________
one step closer to world domination
Cyberscripters Administrator/Founder
   
 
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
 Seite 1 von 1 [ 1 Beitrag ] 

Alle Zeiten sind UTC + 1 Stunde


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  

cron