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 

TCM.tcl..

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


Joined: 10 Aug 2010
Posts: 13
Location: Sofia, Bulgaria

PostPosted: Tue Sep 28, 2010 9:34 pm    Post subject: TCM.tcl.. Reply with quote

Hi, I play with a script and something I can not understand how to take the receiver only the variable ..

Code:
#Flood relay
proc *raw:flooder {from key arg} {
  global botnick servername fnick ochan fhost onserver target whatdoing
  if {[lindex $arg 5] == "Flooder"} {
  set fnick [lindex $arg 6]
  set fhost [lindex $arg 6]
  set onserver [lindex $arg 8]
  set target [lindex $arg 10]
  set whatdoing [lrange $arg 4 end]
   putquick "PRIVMSG $ochan :$whatdoing"
   putquick "PRIVMSG $fnick :$fnick, detect flood from your host ($fhost) Please stop flooding $target. Thank You!"
    return 0
  }
}


Quote:
Server notice is:
irc.server.com *** Notice -- Possible Flooder nick[id@0.0.0.0] on irc.server.com target: nick1


Can you tell me how to give nick ident@host from them last in the different values to allow the bot to send PRIMSG of that nickname and tell him that it has detected a violation by ident@host

I am writing here because I have no idea how to do this separation, since nick and hostname are held in arg 6

Quote:
To summarize:
1 = ***
2 = Notice
3 = -
4 = Possible
5 = Flooder
6 = nick [id@0.0.0.0]
........
10 = nick1


in tcl I need these values: $target $nickflooder $nickflooderID@HOST...

Thanks in advance and apologize for bad English
Back to top
View user's profile Send private message Visit poster's website
erotism
Voice


Joined: 10 Aug 2010
Posts: 13
Location: Sofia, Bulgaria

PostPosted: Wed Sep 29, 2010 12:36 pm    Post subject: Reply with quote

can we help me.. ? :/
Back to top
View user's profile Send private message Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed Sep 29, 2010 1:18 pm    Post subject: Reply with quote

erotism wrote:
can we help me.. ? :/


I'd like to try, but I'm afraid I don't fully understand the question.

Can you re-state it? Perhaps provide another example of what you want?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Sep 29, 2010 2:47 pm    Post subject: Reply with quote

Step 1: Learn to handle strings and lists properly.
$arg is a string in this context, don't use lindex on strings!
Use the split command to split a string into a list..
Code:
proc someproc1 {from key text} {
  set arg [split $text " "]
  if {[string equal [lindex $arg 4] "Flooder"]} {
    #...
    set temp [split [lindex $arg 5 {[]}]]
    set thenick [lindex $temp 0]
    set thehost [lindex $temp 1]
  }
}


Alternate Step 2: Use regexp to extract the value using regular expressions:
This should fetch all the values from the string in a single pass (without the need to convert the string to a list...)
Code:
proc someproc2 {from key text} {
  #...
  if {[regexp -- {^\*\*\* Notice -- Possible Flooder ([^[ ]+)\[([^] ]+)\] on ([^ ]+) target: ([^ ]+)$} $text match fnick fhost onserver target]} {
    #...
  }
}

_________________
NML_375, idling at #eggdrop@IrcNET
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