| View previous topic :: View next topic |
| Author |
Message |
martpen69 Voice
Joined: 20 Jun 2005 Posts: 32
|
Posted: Sun Aug 07, 2005 7:15 pm Post subject: newbie question |
|
|
| im trying to make a very simple script that when you type !rules it will display rules in channel. and when you type !faq it will display faq in channel. I started looking at the text being stored in seperate files but gave up cause im very new to this but trying :). So now im trying to include all the commands and all the text in 1 tcl file. I downloaded rules.tcl and tried to modifiy it with 2 binds. Then i tried running 2 rules.tcl along side each other with 2 different binds in each. I will get there but could use some help please.:) |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Aug 07, 2005 7:48 pm Post subject: |
|
|
| Code: | set faqs {
"faq1"
"faq2"
"faq3"
}
set rules {
"rule1"
"rule2"
"rule3"
}
bind pubm - !* rule:faq
proc rule:faq {nick uhost hand chan arg} {
global rules faqs
switch -- [lindex [split $arg] 0] {
"!rules" {
foreach rule $rules {
puthelp "PRIVMSG $chan :$rule"
}
}
"!faq" {
foreach faq $faqs {
puthelp "PRIVMSG $chan :$faq"
}
}
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
martpen69 Voice
Joined: 20 Jun 2005 Posts: 32
|
Posted: Sun Aug 07, 2005 8:01 pm Post subject: |
|
|
Thank you for your quick reply.
To add more i would do this
set faqs {
"faq1"
"faq2"
"faq3"
}
set rules {
"rule1"
"rule2"
"rule3"
}
set next {
"next1"
"next2"
"next3"
}
bind pubm - !* rule:faq:next
proc rule:faq:next {nick uhost hand chan arg} {
global rules faqs next
switch -- [lindex [split $arg] 0] {
"!rules" {
foreach rule $rules {
puthelp "PRIVMSG $chan :$rule"
}
}
"!faq" {
foreach faq $faqs {
puthelp "PRIVMSG $chan :$faq"
}
}
"!next" {
foreach next $next {
puthelp "PRIVMSG $chan :$next"
}
}
}
}
and just carry on like this. I plan to have about 5 or 6 in total |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Aug 07, 2005 8:12 pm Post subject: |
|
|
Yeah that should work fine, but try not to use "next" twice
| Code: | foreach next $next {
puthelp "PRIVMSG $chan :$next" |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
martpen69 Voice
Joined: 20 Jun 2005 Posts: 32
|
Posted: Sun Aug 07, 2005 8:21 pm Post subject: sorry |
|
|
I just copied and pasted your code into help.tcl and loaded it in the scripts sections and added the line in the config and restarted the bot just to see what it should do before i messed with it and i cant get it to work. Sorry i did say i was a newbie and i bet its something realy silly .
Any clues
Thanks
And sorry for being a pain
Mart |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sun Aug 07, 2005 9:43 pm Post subject: |
|
|
| Quote: | | i cant get it to work |
... really says nothing
Post any error(s) that were generated. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
martpen69 Voice
Joined: 20 Jun 2005 Posts: 32
|
Posted: Mon Aug 08, 2005 3:44 am Post subject: |
|
|
| Well I did everything like any other script there are no errors that come up. The bot is set to die on any errors its starts fine i even put a putlog line at the end just to see if it loaded and was reading the file. I go onto the channel where my egg is and perform the !faq command and nothing happens. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Aug 08, 2005 4:53 am Post subject: |
|
|
| change bind mask to "% !*" |
|
| Back to top |
|
 |
martpen69 Voice
Joined: 20 Jun 2005 Posts: 32
|
Posted: Mon Aug 08, 2005 5:08 am Post subject: |
|
|
Thanks,
I tried that so i now have
bind pubm - %!* rule:faq
But still the same thing no errors and no response. |
|
| Back to top |
|
 |
greenbear Owner
Joined: 24 Sep 2001 Posts: 733 Location: Norway
|
Posted: Mon Aug 08, 2005 5:18 am Post subject: |
|
|
| demond said "% !*" not %!* |
|
| Back to top |
|
 |
martpen69 Voice
Joined: 20 Jun 2005 Posts: 32
|
Posted: Mon Aug 08, 2005 5:25 am Post subject: |
|
|
woohoo :P
Thank you very much.
For the patience and the help.
:lol: |
|
| Back to top |
|
 |
|