Kirjautuminen

Haku

Tehtävät

Keskustelu: Ohjelmointikysymykset: muu kieli: TCL/Eggdrop

Hellami [18.09.2004 03:00:54]

#

Löysin eggdroppiin juuri tarvitsemani scriptin...
Mutta scriptissä on pieni ongelma, kun poistaa "tietokannasta"
tiedon jättää scripti silti kyseisen rivin tiedostoon, eli tyhjentää ainostaan rivin, ei poista. Alla on siis kaikki kohdat jota käytetään tiedon poistamiseen

    for {set x 0} {$x<[llength $war_list]} {incr x} {
      if {[lindex [lindex $war_list $x] 0]==[lindex $arg 0]} {
        set war_list [lreplace $war_list $x $x]
        war_savefiles
        set team [lindex $infos 3]
        putserv "NOTICE $nick : �5War against $team has been deleted."
        war_automanagement
        return 0
      }
    }

proc war_savefiles {} {
  global war_list
  set fileio [open War_Archives "w"]
  puts $fileio $war_list
  flush $fileio
  close $fileio
}


proc war_automanagement {} {
  global war_list war_privchan war_topiclength
  set topic [topic $war_privchan]
  set limitdate 0
  set limitdate [expr [unixtime]+86400]
  set war_upcoming [list ]
  foreach war $war_list {
    if {([lrange $war 3 4]=="n/a n/a")&&([lindex $war 1]>[unixtime])} {
      set war_upcoming [linsert $war_upcoming end $war]
      if {[lindex $war 1]>$limitdate} {
        break
      }
    }
  }
  if {[llength $war_upcoming]==0} {
    if {[string first "�2|�4|�2|�" $topic]==-1} {
      putserv "TOPIC $war_privchan :War Status:� No war planned ��2|�4|�2|� $topic"
      return 0
    }
    if {![string match "*War Status:� No war planned �*" $topic]} {
      set topic [string range $topic [expr [string first "�2|�4|�2|�" $topic]+10] end]
      putserv "TOPIC $war_privchan :War Status:� No war planned ��2|�4|�2|�$topic"
      return 0
    }
    return 0
  }
  set infos [war_getinfos [lindex [lindex $war_upcoming 0] 0] 1]
  set hour [lindex $infos 1]
  if {"[clock format [lindex [lindex $war_upcoming 0] 1] -format %y][clock format [lindex [lindex $war_upcoming 0] 1] -format %m%d]"=="[clock format [unixtime] -format %y][clock format [unixtime] -format %m%d]"} {
    set date "Today �at�"
  } else {
    set date [lindex $infos 2]
  }
  set team [lindex $infos 3]
  set players [lindex $infos 7]
  set number [lindex $infos 9]
  set actual [lindex $infos 10]
  set topicmsg "Next War:� $date $hour �vs� $team �- Players:� $players�"
  set war_missing [list ]
  foreach war $war_upcoming {
    if {[lindex $war 1]>$limitdate} {
      break
    }
    if {[lindex $war 6]=="n/a"} {
      set war_missing [linsert $war_missing end "[lindex $war 0] $number"]
    } elseif {$actual<$number} {
      set war_missing [linsert $war_missing end "[lindex $war 0] [expr $number-$actual]"]
    }
  }
  set topicmsg2 ""
  if {[llength $war_missing]>0} {
    set infos [war_getinfos [lindex [lindex $war_missing 0] 0] 0]
    set hour [lindex $infos 1]
    set date [lindex $infos 2]
    set team [lindex $infos 3]
    set player [lindex [lindex $war_missing 0] 1]
    set topicmsg2 " �2-�4|�2-���4 $player ��players needed on� $date �at� $hour �vs� $team�"
    for {set x 1} {$x<[llength $war_missing]} {incr x} {
      set infos [war_getinfos [lindex [lindex $war_missing $x] 0] 0]
      set hour [lindex $infos 1]
      set date [lindex $infos 2]
      set team [lindex $infos 3]
      set player [lindex [lindex $war_missing $x] 1]
      set topicmsg2 "$topicmsg2 �4-�2/�4-��4 $player ��players needed on� $date �at� $hour �vs� $team�"
    }
  }
  set topicmsg "$topicmsg$topicmsg2"
  if {[string length $topicmsg]>$war_topiclength} {
    set topicmsg [string range $topicmsg 0 [expr $war_topiclength-12]]
  }
  set topicmsg "$topicmsg �2|�4|�2|�"
  if {[string first "�2|�4|�2|�" $topic]==-1} {
    putserv "TOPIC $war_privchan :$topicmsg $topic"
    return 0
  }
  if {![string match "*$topicmsg*" $topic]} {
    set topic [string range $topic [expr [string first "�2|�4|�2|�" $topic]+10] end]
    putserv "TOPIC $war_privchan :$topicmsg$topic"
  }
}

Itse ymmärsin tuosta sen, että tossa pitäisi olla kaikki tarvittava sen muokkaamiseen... jos kuitenki joku osaa sanoa, että vika ei ole missään kyseisessä osassa niin koko scriptin voi ladata:
http://www.tclscript.com/cgi-bin/dbs.cgi?get=warmanager1.7b.zip
Kiitokset jos joku osaa/jaksaa vaivautua :)

Vastaus

Aihe on jo aika vanha, joten et voi enää vastata siihen.

Tietoa sivustosta