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 

Autotext-Script

 
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
Plexton
Guest





PostPosted: Wed Jan 15, 2003 4:30 pm    Post subject: Autotext-Script Reply with quote

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

PostPosted: Wed Jan 15, 2003 5:43 pm    Post subject: Reply with quote

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





PostPosted: Thu Jan 16, 2003 4:44 am    Post subject: Reply with quote

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

PostPosted: Thu Jan 16, 2003 9:54 am    Post subject: Reply with quote

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





PostPosted: Thu Jan 16, 2003 10:29 am    Post subject: Reply with quote

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 Wink"
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. Sad
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

PostPosted: Thu Jan 16, 2003 11:14 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
Plexton
Guest





PostPosted: Thu Jan 16, 2003 11:31 am    Post subject: Reply with quote

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

PostPosted: Thu Jan 16, 2003 3:54 pm    Post subject: Reply with quote

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





PostPosted: Fri Jan 17, 2003 6:21 am    Post subject: Reply with quote

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
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