| View previous topic :: View next topic |
| Author |
Message |
Plexton Guest
|
Posted: Wed Jan 15, 2003 4:30 pm Post subject: Autotext-Script |
|
|
Where can I find a autotext-script?
for exemple:
The eggrop reply the ip of our gamingserver, when an user types !ip.
thx 4 reply |
|
| Back to top |
|
 |
spock Master
Joined: 12 Dec 2002 Posts: 319
|
Posted: Wed Jan 15, 2003 5:43 pm Post subject: |
|
|
here is such a script in a very simple form.
other things you would probably want in it
are rate-limiting and custom access-flags.
bind pub - !ip pub:!ip
proc pub:info {nick host handle chan text} {
set gameserver "1.2.3.4"
puthelp "PRIVMSG $nick :$gameserver"
putlog "$nick ($handle) requested gameserver on $chan"
} _________________ photon? |
|
| Back to top |
|
 |
Plexton Guest
|
Posted: Thu Jan 16, 2003 4:44 am Post subject: |
|
|
Thank you, spock!
But what is, when I want to use many commands like !ip, !homepage !news, !member, etc...
Is is possible to tell the tcl-script to read out an extern text-file and put this result into the bot-reply?
When I do it as you written it down above, I must go into the script to make changes and this looks a little bit complicated, when I have to change something. |
|
| Back to top |
|
 |
spock Master
Joined: 12 Dec 2002 Posts: 319
|
Posted: Thu Jan 16, 2003 9:54 am Post subject: |
|
|
yes the things you want are very possible :>
so i suggest you start reading some tcl guides.
or search for a "public command" script
which already does those things. _________________ photon? |
|
| Back to top |
|
 |
Plexton Guest
|
Posted: Thu Jan 16, 2003 10:29 am Post subject: |
|
|
Never mind:
I've written something by my self like that:
putlog "Autotext script version 0.0.1b by |Plexton| loaded"
putlog "use !help in channel for comands."
proc commandchar {} {
return "!"
}
bind pub - [commandchar]help help
bind pub - [commandchar]ip ip
bind pub - [commandchar]homepage homepage
bind pub - [commandchar]hp homepage
bind pub - [commandchar]channel channel
proc help {nick host handle text} {
putserv "notice $nick : Mit den folgenden Befehlen kannst Du folgende Infos abrufen:"
putserv "notice $nick : ------------------------------------------------------------"
putserv "notice $nick : [commandchar]help - zeigt Dir das hier "
putserv "notice $nick : [commandchar]ip - zeigt Dir die IP's unserer Server"
putserv "notice $nick : [commandchar]homepage oder [commandchar]hp - zeigt Dir die urls der Clanseite(n)"
putserv "notice $nick : ------------------------------------------------------------"
putserv "notice $nick : Wenn Du weitere Befehle vermisst oder Ergänzungen hast"
putserv "notice $nick : dann poste sie ins Forum:"
putserv "notice $nick : http://www.jedi-power.de/phpBB2/viewtopic.php?t=14"
putserv "notice $nick : ------------------------------------------------------------"
}
proc ip {nick host handle text} {
putserv "notice $nick : Die aktuellen Server-IP's lauten:"
putserv "notice $nick : ------------------------------------------------------"
putserv "notice $nick : Jedi-Server:"
putserv "notice $nick : bis zum 31.01.03 213.146.190.160:27020 20 slots public"
putserv "notice $nick : 62.93.205.133:27015 20 slots public"
putserv "notice $nick : ------------------------------------------------------"
putserv "notice $nick : STD-Server"
putserv "notice $nick : bis zum 31.01.03 213.146.190.167:27005 20 slots public"
putserv "notice $nick : 62.93.205.134:27015 20 slots public"
putserv "notice $nick : ------------------------------------------------------"
}
proc homepage {nick host handle text} {
putserv "notice $nick : Die urls der Clanseiten lauten:"
putserv "notice $nick : ---------------------------------"
putserv "notice $nick : JEDI-HP: www.jedi-power.de"
putserv "notice $nick : STD--HP: www.std-counterstrike.de"
putserv "notice $nick : ---------------------------------"
}
proc channel {nick host handle text} {
putserv "notice $nick : Die irc-channels lauten:"
putserv "notice $nick : -------------------------------------"
putserv "notice $nick : JEDI-Channel #JEDI-Power"
putserv "notice $nick : STD--Channel #-=\]STD-\[=-Clan"
putserv "notice $nick : JEDI-Live #JEDI-Server ; in Arbeit"
putserv "notice $nick : -------------------------------------"
}
But it does not work.
Could anybody say me, what I've made wrong?
thx |
|
| Back to top |
|
 |
ppslim Revered One
Joined: 23 Sep 2001 Posts: 3914 Location: Liverpool, England
|
Posted: Thu Jan 16, 2003 11:14 am Post subject: |
|
|
This has resulted in a number off issues that will most likely break most or even all your loaded scripts.
First off, you are using the PUB type bind. In your proc's, you are using the format
| Quote: |
proc help {nick host handle text} {
|
There are not enough arguments here, to accept all information sent. I can allmost gurentee the message you get here is
| Quote: |
Called "help" with too many arguments
|
See tcl-commans.doc, for the required amount of arguments and there meaning, for the PUB and other type binds.
In one of your commands, you create a proc called "channel". This command is allready in use by eggdrop. As such, any script trying to use it will break.
When naiming your commands, give them a unique name.
When I create a script, I use
| Code: |
proc scriptname:purpose {args} {
body
}
|
Replaceing "scriptname" with the name of the script, and "purpose" with a single word purpose for the function.
This will allow for a unique naming scripture, free from conflicts. _________________ PlusNet Supported Customer - Low cost UK ISP services |
|
| Back to top |
|
 |
Plexton Guest
|
Posted: Thu Jan 16, 2003 11:31 am Post subject: |
|
|
Thank you, ppslim.
But I have so much trouble with my english. Can you give me a correct working example for that:
users types !ip
and bot answer with the notice : The Server-IP is 1.2.3.4:5
Thanks a lot for helping me. |
|
| Back to top |
|
 |
spock Master
Joined: 12 Dec 2002 Posts: 319
|
Posted: Thu Jan 16, 2003 3:54 pm Post subject: |
|
|
he already told you what to do.
here's some help;
bind pub <flags> <command> <proc>
procname <nick> <user@host> <handle> <channel> <text> _________________ photon? |
|
| Back to top |
|
 |
Plexton Guest
|
Posted: Fri Jan 17, 2003 6:21 am Post subject: |
|
|
I've found a script called ai.tcl. It does everything I want.
But it one thing it doesn't:
I want that the script answer in more than one line. Would you be so kind and say me, how can I make it so?
And yes, I'am a fool and very very stupid.
| Code: | ###################################
# Ai.tcl by KuNgFo0 (#eggfaq@efnet)
#VERSION 0.3
#DESCRIPTION Responds to certain words said in the set channels.
# Set the next lines as the triggers and random responses you want
# (wildcards may be used)
set ai_data {
{"*trigger #1A*" "*trigger #1B*"} {
"trigger #1 response #1"
"trigger #1 response #2"
}
{"*trigger #2A*" "*trigger #2B*"} {
"trigger #2 response #1"
"trigger #2 response #2"
}
{"Hello" "Hi" "Hey"} {
"Hey what's up, $nick?"
"Yo"
"Hello!"
}
{"What time is it?" "What is the time?" "What's the time?" "Anyone have the time?"} {
"$nick, it's [clock format [clock seconds]]"
}
}
# Set the next line as the channels you want to run in
set ai_chans "#testchannel1 #testchannel2"
proc pub_ai {nick uhost hand chan arg} {
global ai_data ai_chans botnick
if {(([lsearch -exact [string tolower $ai_chans] [string tolower $chan]] != -1) || ($ai_chans == "*")) && (![matchattr $hand b]) && ($nick != $botnick)} {
foreach {triggers responses} $ai_data {
foreach trigger $triggers {
if {[string match [string tolower $trigger] [string tolower $arg]]} { putserv "PRIVMSG $chan :[subst [lindex $responses [rand [llength $responses]]]]" ; return }
}
}
}
}
bind pubm - * pub_ai
putlog "*** Ai.tcl 0.3 by KuNgFo0 loaded"
|
Thanks for help. |
|
| Back to top |
|
 |
|