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 

lsearch and list
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Craig
Voice


Joined: 22 Feb 2006
Posts: 18

PostPosted: Thu Mar 22, 2007 4:00 pm    Post subject: Reply with quote

Code:
; set arg "lol http:// http://lol www.lol www ftp:// lol ftp://:P"
#101 (56 clicks) Tcl: lol http:// http://lol www.lol www ftp:// lol ftp://:P
; set arg [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]
#103 (121 clicks) Tcl: http:// http://lol www.lol ftp:// ftp://:P



i dont understand you, lsearch is working with $arg and also when i'll try "putquick : privmsg $chan $bwfound" it will return that words. :O

Code:
            set bwfound [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]
            putquick " privmsg $chan : BW FOUNDED: $bwfound"


>>

10.:142110·140010·140810:. 03«~Thiev03» http:// lol ftp:// lol http://lol lol ftp://lol lol
10.:142110·140010·140810:. 03«@dghnws03»  cos znalazlem! Very Happy
10.:142110·140010·140810:. 03«@dghnws03»  BW FOUNDED: http:// ftp:// http://lol ftp://lol
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Mar 22, 2007 4:03 pm    Post subject: Reply with quote

The problem is that arg can never contain a newline, yet you use a mask that does contain a newline... should be quite obvious the mask will never match..

And as for lsearch:ing arg, you're just getting away with with sheer luck.. should arg contain characters such as {[]} and similar, you'd be up for a "nice" surprise...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Craig
Voice


Joined: 22 Feb 2006
Posts: 18

PostPosted: Fri Mar 23, 2007 12:03 pm    Post subject: Reply with quote

tell me how to do thing like

if { ([string match -nocase "* $helpwanted *" $input] ===== 1

i want to it replay 0 when there is full zeros like
in $helpwanted is

bla
he
hi

andf return 0 if no one word match with $input ..
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Mar 23, 2007 1:52 pm    Post subject: Reply with quote

Use proper lists and do a foreach loop to use each list item as a pattern with "string match", don't expect "string match" to pick a part of the pattern and match it against the text-string.

That is, given that "patterns" holds a valid list structure and "text" the text string, something like this:
Code:
foreach item $patterns {
  if {[string match $item $text]} {
    puts stdout "It matched!!!"
    break
  }
}

_________________
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
Goto page Previous  1, 2
Page 2 of 2

 
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