This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

newbie question

Old posts that have not been replied to for several years.
Locked
m
martpen69
Voice
Posts: 32
Joined: Mon Jun 20, 2005 3:56 pm

newbie question

Post by martpen69 »

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.:)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

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"
   }
  }
 }
}
m
martpen69
Voice
Posts: 32
Joined: Mon Jun 20, 2005 3:56 pm

Post by martpen69 »

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
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Yeah that should work fine, but try not to use "next" twice

Code: Select all

foreach next $next { 
puthelp "PRIVMSG $chan :$next"
m
martpen69
Voice
Posts: 32
Joined: Mon Jun 20, 2005 3:56 pm

sorry

Post by martpen69 »

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
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

i cant get it to work
... really says nothing :P

Post any error(s) that were generated.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
m
martpen69
Voice
Posts: 32
Joined: Mon Jun 20, 2005 3:56 pm

Post by martpen69 »

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.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

change bind mask to "% !*"
m
martpen69
Voice
Posts: 32
Joined: Mon Jun 20, 2005 3:56 pm

Post by martpen69 »

Thanks,

I tried that so i now have

bind pubm - %!* rule:faq

But still the same thing no errors and no response.
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

demond said "% !*" not %!*
m
martpen69
Voice
Posts: 32
Joined: Mon Jun 20, 2005 3:56 pm

Post by martpen69 »

woohoo :P

Thank you very much.

For the patience and the help.

:lol:
Locked