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 

variables, globals?

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


Joined: 19 Sep 2006
Posts: 1

PostPosted: Tue Sep 19, 2006 10:55 pm    Post subject: variables, globals? Reply with quote

(Sorry for the poor subject, but i couldnt find a better one)

The following script listens on a socket and sends the result into an IRC channel.
It works.
I want it to not send identical messages in a row. Therefore I'd like to store the $msg before it is send out to the channel, and check the next time, before a message is sent, if the stored text is identical to $msg.
If so, the script should interrupt and wait for the next piece of incoming data.

My question basically is: What kind of variable do i need to store the message? a global, or var? I tried to set up a simple loop all night long but it just didnt work.

Here's the code:

Code:
 socket -server blubb 4711



proc blubb {cid addr port} {
   fconfigure $cid -buffering line -blocking 0;
   fileevent $cid readable "bbb $cid"
}


proc bbb {cid} {

   if {[gets $cid msg] == ""} {
      putserv "PRIVMSG #grill-bill :empty"
      close $cid; return
   }

   putserv "PRIVMSG #grill-bill :$msg"
   close $cid; return
}
[/code]
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