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 

How do I make a bind mask to a set range of numbers?

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


Joined: 29 Sep 2006
Posts: 37
Location: United States of America

PostPosted: Sun Nov 12, 2006 11:22 am    Post subject: How do I make a bind mask to a set range of numbers? Reply with quote

I want to make a bind that will respond to any number between 0 and $number. How would I do that?

Thanks
_________________
Yeah!
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Nov 12, 2006 11:43 am    Post subject: Reply with quote

What kind of bind? where is the "number" coming from?
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Justdabomb2
Voice


Joined: 29 Sep 2006
Posts: 37
Location: United States of America

PostPosted: Sun Nov 12, 2006 11:48 am    Post subject: Reply with quote

The number would be set earlier in the script (DUUUH). and it would be a pub or pubm.
_________________
Yeah!
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Nov 12, 2006 1:22 pm    Post subject: Reply with quote

You'd use a "for" or a "while" and increment a count-var.
Back to top
View user's profile Send private message
Justdabomb2
Voice


Joined: 29 Sep 2006
Posts: 37
Location: United States of America

PostPosted: Sun Nov 12, 2006 2:20 pm    Post subject: Reply with quote

show me how!.... pleasse
_________________
Yeah!
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Nov 12, 2006 5:02 pm    Post subject: Reply with quote

Modify to suit your needs:
Code:
for {set i 0} {$i < $number} {incr i} {
 bind pub - $i yourproc
}


I'd suggest however you keep $number relatively small, since you're creating one new binding per number between 0 and $number. (the only other option would be to use a pubm-binding with "*" as mask and then check wether it's a number or not within the proc itself...)
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Justdabomb2
Voice


Joined: 29 Sep 2006
Posts: 37
Location: United States of America

PostPosted: Sun Nov 12, 2006 7:59 pm    Post subject: Reply with quote

yeah, I thought of that, but how would I do that...ince the numbers can range between 10,000
_________________
Yeah!
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Nov 12, 2006 10:29 pm    Post subject: Reply with quote

One way of doing it, using regular expressions...
Code:
bind pubm - * the_proc
proc the_proc {nick host handle channel text} {
 if {[regexp -- {^[[:digit:]]+$} $text]} {
  #$text was a number
 } {
  #$text was not a number
 }
}

_________________
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