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 

else problem

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


Joined: 18 Nov 2002
Posts: 200
Location: Auckland, New Zealand

PostPosted: Sun Feb 12, 2006 8:44 pm    Post subject: else problem Reply with quote

Hi - I have a script to retrieve a line of data from a webpage. The line is either:
<p>and-the-info-here

or, if there is no info just:
<p>
Code:

to send this into the room, the script after the socket stuff is:

    if {[string match "*<p>CENTRAL*" $line]} {
   regexp {<p>CENTRAL(.*).</p><br>} $line - central
    putserv "PRIVMSG $channel :$central"
    } else {
    putserv "PRIVMSG $channel :No Info Available"
  }
 }
}

however, it is sending both lines to the room even if there is data. I've tried putting returns in after, but then it only does the second line.

Thanks for any help?
_________________
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Mon Feb 13, 2006 2:29 am    Post subject: Reply with quote

Did you try common sense? Wink
Code:
 if {[string match "*<p>CENTRAL*" $line]} {
  if {[regexp {<p>CENTRAL(.*).</p>} $line - central] && [string length $central] >= 1} {
    putserv "PRIVMSG $channel :$central"
  } else {
    putserv "PRIVMSG $channel :No Info Available"
  }
}


(I added the string length check to see if anything is actually in the variable)
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