egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Basic script, writing info to file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Nara
Halfop


Joined: 23 Jul 2006
Posts: 40

PostPosted: Wed Sep 20, 2006 6:30 pm    Post subject: Basic script, writing info to file Reply with quote

Code:
proc battle:flagsong { nick host hand chan text } {
   global head tail delim dj
   set chan [string tolower $chan]
   if !{ [channel get $chan advertonly] } {
      if !{ [string equal $text ""] } {
      putlog "\002Radio:\002 $nick \($hand\) flagged a song."
      set song [battle:getxml]
      if !{ [string equal $song ""] } {
         regexp {<SONGTITLE>(.*?)<\/SONGTITLE>} $song match song
         regsub -all {&#x27;} $song "'" song
         regsub -all {&lt;} $song "<" song
         regsub -all {&gt;} $song ">" song
         regsub -all {&amp;} $song "&" song
         regsub -all {&#xFF;} $song "ñ" song
                   regsub -all {&#xB0;} $song "º" song
         regsub -all {&#x26;} $song "&" song
         }
         if { [string equal $dj ""] } {
         set $currentdj "AutoDJ"
         } else {
            set $currentdj $dj
         }
         set r [open flaggedsongs.txt a+]
         puts $r "[strftime "%d %b %Y, %H:%M %z"]: $song was played on air and flagged by $nick \($hand\). DJ onair was $currentdj. Reason: $text"
         close $r
         putserv "PRIVMSG $nick :$head I have flagged the current song, which was \($song\). It will be reviewed by management. Reason provided: $text $tail"
      } else {
      putserv "PRIVMSG $nick :$head You must provide a reason. $tail"
      }
   }
}


It errors after
Code:
   if !{ [channel get $chan advertonly] } {
with a 'Tcl error [battle:flagsong]: missing close-brace'

~Nara
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Wed Sep 20, 2006 6:57 pm    Post subject: Reply with quote

Try:

Code:
proc battle:flagsong {nick host hand chan text} {
    global head tail delim dj
    if {[channel get $chan advertonly]} { return }
    if {$text != ""} {
        putlog "\002Radio:\002 $nick \($hand\) flagged a song."
        set song [battle:getxml]
        if {$song != ""} {
            regexp {<SONGTITLE>(.*?)<\/SONGTITLE>} $song match song
            regsub -all {&#x27;} $song "'" song
            regsub -all {&lt;} $song "<" song
            regsub -all {&gt;} $song ">" song
            regsub -all {&amp;} $song "&" song
            regsub -all {&#xFF;} $song "ñ" song
            regsub -all {&#xB0;} $song "º" song
            regsub -all {&#x26;} $song "&" song
        }
        if {$dj == ""} {
            set currentdj "AutoDj"
        } else {
            set currentdj $dj
        }
        set r [open flaggedsongs.txt a+]
        puts $r "[strftime "%d %b %Y, %H:%M %z"]: $song was played on air and flagged by $nick \($hand\). DJ onair was $currentdj. Reason: $text"
        close $r
        putserv "PRIVMSG $nick :$head I have flagged the current song, which was \($song\). It will be reviewed by management. Reason provided: $text $tail"
    } else {
        putserv "PRIVMSG $nick :$head You must provide a reason. $tail"
    }
}

_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
Nara
Halfop


Joined: 23 Jul 2006
Posts: 40

PostPosted: Wed Sep 20, 2006 7:03 pm    Post subject: Reply with quote

That worked. Thanks.

~Nara
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber