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 

newbie question

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
martpen69
Voice


Joined: 20 Jun 2005
Posts: 32

PostPosted: Sun Aug 07, 2005 7:15 pm    Post subject: newbie question Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Aug 07, 2005 7:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
martpen69
Voice


Joined: 20 Jun 2005
Posts: 32

PostPosted: Sun Aug 07, 2005 8:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Aug 07, 2005 8:12 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
martpen69
Voice


Joined: 20 Jun 2005
Posts: 32

PostPosted: Sun Aug 07, 2005 8:21 pm    Post subject: sorry Reply with quote

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
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sun Aug 07, 2005 9:43 pm    Post subject: Reply with quote

Quote:
i cant get it to work

... really says nothing Razz

Post any error(s) that were generated.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
martpen69
Voice


Joined: 20 Jun 2005
Posts: 32

PostPosted: Mon Aug 08, 2005 3:44 am    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Aug 08, 2005 4:53 am    Post subject: Reply with quote

change bind mask to "% !*"
Back to top
View user's profile Send private message Visit poster's website
martpen69
Voice


Joined: 20 Jun 2005
Posts: 32

PostPosted: Mon Aug 08, 2005 5:08 am    Post subject: Reply with quote

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
View user's profile Send private message
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Mon Aug 08, 2005 5:18 am    Post subject: Reply with quote

demond said "% !*" not %!*
Back to top
View user's profile Send private message Send e-mail
martpen69
Voice


Joined: 20 Jun 2005
Posts: 32

PostPosted: Mon Aug 08, 2005 5:25 am    Post subject: Reply with quote

woohoo :P

Thank you very much.

For the patience and the help.

:lol:
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive 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