| View previous topic :: View next topic |
| Author |
Message |
Justdabomb2 Voice
Joined: 29 Sep 2006 Posts: 37 Location: United States of America
|
Posted: Sun Nov 12, 2006 11:22 am Post subject: How do I make a bind mask to a set range of numbers? |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Nov 12, 2006 11:43 am Post subject: |
|
|
What kind of bind? where is the "number" coming from? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Justdabomb2 Voice
Joined: 29 Sep 2006 Posts: 37 Location: United States of America
|
Posted: Sun Nov 12, 2006 11:48 am Post subject: |
|
|
The number would be set earlier in the script (DUUUH). and it would be a pub or pubm. _________________ Yeah! |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Sun Nov 12, 2006 1:22 pm Post subject: |
|
|
| You'd use a "for" or a "while" and increment a count-var. |
|
| Back to top |
|
 |
Justdabomb2 Voice
Joined: 29 Sep 2006 Posts: 37 Location: United States of America
|
Posted: Sun Nov 12, 2006 2:20 pm Post subject: |
|
|
show me how!.... pleasse _________________ Yeah! |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Nov 12, 2006 5:02 pm Post subject: |
|
|
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 |
|
 |
Justdabomb2 Voice
Joined: 29 Sep 2006 Posts: 37 Location: United States of America
|
Posted: Sun Nov 12, 2006 7:59 pm Post subject: |
|
|
yeah, I thought of that, but how would I do that...ince the numbers can range between 10,000 _________________ Yeah! |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Nov 12, 2006 10:29 pm Post subject: |
|
|
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 |
|
 |
|