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.

Autotext-Script

Old posts that have not been replied to for several years.
Locked
P
Plexton

Autotext-Script

Post by Plexton »

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
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

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?
P
Plexton

Post by Plexton »

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.
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

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?
P
Plexton

Post by Plexton »

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
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

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
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
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: Select all

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.
P
Plexton

Post by Plexton »

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.
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

he already told you what to do.
here's some help;

bind pub <flags> <command> <proc>
procname <nick> <user@host> <handle> <channel> <text>
photon?
P
Plexton

Post by Plexton »

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: Select all

###################################
# 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.
Locked