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 

\n dosnt' work :s

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


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Mon Jun 05, 2006 11:20 am    Post subject: \n dosnt' work :s Reply with quote

Ok i have managed to get this far, most of this script works but on the last function for some reason \n isnt' working, it says the first line and thats it... here's the code..

Code:

set url "http://www.lynxfm.info/stream.html"
set djtrigger "!dj"
set tracktrigger "!track"
set listenerstrigger "!listeners"
set alltrigger "!all"

set channel "#LynxFM"

### Current DJ ###

if {![info exists egghttp(version)]} {
  putlog "egghttp.tcl was NOT successfully loaded."
  putlog "shoutcast.tcl has not been loaded as a result."
} else {
  proc current_dj {sock} {

    global channel

    set headers [egghttp:headers $sock]
    set body [egghttp:data $sock]

    regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)</font></tr>} $body - dj


    puthelp "PRIVMSG $channel :\0032\004The current DJ is: \0034$dj"

  }

  bind pub -|* $djtrigger top:djtrigger
  proc top:djtrigger {nick host hand chan text} {
    global url
    set sock [egghttp:geturl $url current_dj]
    return 1
  }


### Current Track ###


proc current_track {sock} {

    global channel

    set headers [egghttp:headers $sock]
    set body1 [egghttp:data $sock]

    regexp {<td height="39" valign="top" id="song"><font color="white" face="verdana" size="2">(.*?)</font></td>} $body1 - track


    puthelp "PRIVMSG $channel :\0032\004The current Track is: \0034 $track"

  }

  bind pub -|* $tracktrigger top:tracktrigger
  proc top:tracktrigger {nick host hand chan text} {
    global url
    set sock [egghttp:geturl $url current_track]
    return 1
  }

### Current Listeners ###

proc current_listeners {sock} {

    global channel

    set headers [egghttp:headers $sock]
    set body2 [egghttp:data $sock]

    regexp {<td height="21" valign="top" id="listeners"><font color="white" face="verdana" size="2">(.*?)</font></td>} $body2 - listeners


    puthelp "PRIVMSG $channel :\0032\004Current Listeners: \0034 $listeners"

  }

  bind pub -|* $listenerstrigger top:listenerstrigger
  proc top:listenerstrigger {nick host hand chan text} {
    global url
    set sock [egghttp:geturl $url current_listeners]
    return 1
  }

### All Stats ###

proc show_all {sock} {

    global channel

    set headers [egghttp:headers $sock]
    set all1 [egghttp:data $sock]
    set all2 [egghttp:data $sock]
    set all3 [egghttp:data $sock]

    regexp { <td height="39" valign="top" id="description"><font color="white" face="verdana" size="2">(.*)</font></tr>} $all1 - dj
    regexp {<td height="39" valign="top" id="song"><font color="white" face="verdana" size="2">(.*?)</font></td>} $all2 - track
    regexp {<td height="21" valign="top" id="listeners"><font color="white" face="verdana" size="2">(.*?)</font></td>} $all3 - listeners


    puthelp "PRIVMSG $channel :\0032\004Current Status:\n \0034 The current DJ is:$dj \n The current track is: $track \n With listeners: $listeners"

  }

  bind pub -|* $alltrigger top:alltrigger
  proc top:alltrigger {nick host hand chan text} {
    global url
    set sock [egghttp:geturl $url show_all]
    return 1
  }


 putlog "shoutcast.tcl has been successfully loaded."
}


Any thoughts ? Sad
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Mon Jun 05, 2006 3:18 pm    Post subject: Reply with quote

split that last puthelp:

Code:
puthelp "PRIVMSG $channel :\0032\004Current Status:"
puthelp "PRIVMSG $channel :\0034 The current DJ is:$dj"
puthelp "PRIVMSG $channel :The current track is: $track"
puthelp "PRIVMSG $channel :With listeners: $listeners"
Back to top
View user's profile Send private message
NTHosts
Op


Joined: 10 Oct 2005
Posts: 100
Location: UK

PostPosted: Mon Jun 05, 2006 4:26 pm    Post subject: hehe Reply with quote

Thanks, works perfect.. I shoulda guessed that myself eh Razz

Oh well another day gone and a little bit more learnt Very Happy thanks again Very Happy
_________________
www.NT-Hosts.Net - More than just a host
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
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