Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > d32723226591f0b84848642e251e06f4 > files > 208

eggdrop-1.8.4-1.mga7.aarch64.rpm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Your First Eggdrop Script &mdash; Eggdrop 1.8.4 documentation</title>
    
    <link rel="stylesheet" href="../_static/eggdrop.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.8.4',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="Eggdrop 1.8.4 documentation" href="../index.html" />
    <link rel="up" title="&lt;no title&gt;" href="index.html" />
    <link rel="prev" title="Weird Messages That Get Logged" href="weird-msgs.html" /> 
  </head>
  <body>
    <div class="header-wrapper">
      <div class="header">
          <p class="logo"><a href="../index.html">
            <img class="logo" src="../_static/eggman.png.gif" alt="Logo"/>
          </a></p>
        <div class="headertitle"><a
          href="../index.html">Eggdrop 1.8.4 documentation</a></div>
        <div class="rel">
          <a href="weird-msgs.html" title="Weird Messages That Get Logged"
             accesskey="P">previous</a>
        </div>
       </div>
    </div>

    <div class="content-wrapper">
      <div class="content">
        <div class="document">
            
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <p>Your First Eggdrop Script
Last revised: December 07, 2003</p>
<div class="section" id="your-first-eggdrop-script">
<h1>Your First Eggdrop Script<a class="headerlink" href="#your-first-eggdrop-script" title="Permalink to this headline">ΒΆ</a></h1>
<p>So you want to write an Eggdrop script, but you don't really know where
to begin. This file will give you a very basic idea about what Eggdrop
scripting is like. There are far too many topics to be covered all at
once, but this may help you get started with your own scripts.</p>
<p>This guide assumes you know a bit about Eggdrops and IRC. You should have
already installed Eggdrop. The bot should not be on any important or busy
channels (development bots can be annoying if your script has bugs). If you
plan on doing a lot of development, enable the .tcl and .set commands, and
make sure nobody else has access to your bot. The .tcl and .set commands
are helpful in debugging and testing your code.</p>
<p>First, read through the script. You may be unfamiliar with some of the
commands, especially if you haven't at least browsed through
tcl-commands.doc. You may find it helpful to open up tcl-commands.doc in
another window so that you can immediately look up commands you don't know.</p>
<p>Then, open up another window and copy the script into its own file. If you
have the .tcl command enabled, you can type '.tcl source scripts/file.tcl'
to load it. Otherwise, add it to your config file like normal and '.rehash'
or '.restart' your bot.</p>
<p>From your own IRC client, join the bot's channel and type some lines that
start with &quot;hello&quot;. Example: hello I love you won't you tell me your name</p>
<p>After your thrill abates, try playing around with your copy of the script.
Get it to change the text it says, make it send notices instead of messages.
Try changing the names of some variables (uhost -&gt; userhost maybe).</p>
<div class="highlight-python"><div class="highlight"><pre>#
# Here&#39;s the start of the script.
# The &#39;#&#39; in Tcl means this line is a comment and doesn&#39;t get executed.
#

#
# Most scripts start off with a configuration section.
#

# Change this to the channel you want this script to work on.
set our_chan &quot;#baa&quot;

# After configuration, scripts generally do a bit of initialization work.
# This could include checking the validity of the config variables, setting
# timers, loading helper scripts, establishing database connections, or
# most frequently, creating our Eggdrop binds.
#
# A bind lets you attach your script to events that Eggdrop encounters. Events
# include IRC events (someone joining a channel, talking, etc), botnet events,
# and internal events (like receiving signals via the kill command).
#

# This bind will make Eggdrop call &quot;my_talk_handler&quot; whenever someone
# says hello on one of our channels.
bind pub - hello my_talk_handler

# Here is where we define &quot;my_talk_handler&quot;
proc my_talk_handler {nick uhost hand chan text} {
  #
  # nick - the person&#39;s nickname
  # uhost - the person&#39;s user@host
  # hand - the person&#39;s bothandle (if he is a valid user)
  # chan - the channel this event happened on
  # text - the text the person said (not counting the trigger word)
  #
  # You can name these variables any way you want, but these names
  # are pretty much standard.
  #

  # The &#39;global&#39; command imports global variables into our local scope.
  # Any variable set outside of a procedure (like in the config section)
  # is a global variable.
  global our_chan

  # We only want to respond on the $our_chan channel.
  # The string tolower command converts a string to lowercase.
  if {[string tolower $chan] != $our_chan} {
    return 0
  }

  # The putserv commands lets us send text to the server.
  putserv &quot;privmsg $chan :$text too!&quot;

  # All done! Log this command by returning 1.
  return 1
}

# Here&#39;s the end of the script.
</pre></div>
</div>
<p>Copyright (C) 2003 - 2018 Eggheads Development Team</p>
</div>


          </div>
        </div>
      </div>
        </div>
        <div class="sidebar">
          <h3>Table Of Contents</h3>
          <ul>
<li class="toctree-l1"><a class="reference internal" href="../installAndSetup/readme.html">README</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installAndSetup/install.html">Installing Eggdrop</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installAndSetup/faq.html">Frequently Asked Questions</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/about.html">About Eggdrop</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/features.html">Eggdrop Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/users.html">Users and Flags</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/partyline.html">The Party Line</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/bans.html">Bans, Invites, and Exempts</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/botnet.html">Botnet Sharing and Linking</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/patch.html">Patch How-To</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/tcl-commands.html">Eggdrop Tcl Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/ipv6.html">IPv6 support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../mainDocs/tls.html">TLS support</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/core.html">Eggdrop Core Settings</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/modules.html">Eggdrop Module Information</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/assoc.html">Assoc Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/blowfish.html">Blowfish Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/channels.html">Channels Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/compress.html">Compress Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/console.html">Console Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/ctcp.html">CTCP Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/dns.html">DNS Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/filesys.html">Filesys Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/irc.html">IRC Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/notes.html">Notes Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/seen.html">Seen Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/server.html">Server Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/share.html">Share Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/transfer.html">Transfer Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/uptime.html">Uptime Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="../coreDocs/woobie.html">Woobie Module</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="known-probs.html">Known Problems</a></li>
<li class="toctree-l1"><a class="reference internal" href="tricks.html">Eggdrop Tricks</a></li>
<li class="toctree-l1"><a class="reference internal" href="text-sub.html">Textfile Substitutions</a></li>
<li class="toctree-l1"><a class="reference internal" href="weird-msgs.html">Weird Messages That Get Logged</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Your First Eggdrop Script</a></li>
</ul>

          <h3 style="margin-top: 1.5em;">Search</h3>
          <form class="search" action="../search.html" method="get">
            <input type="text" name="q" />
            <input type="submit" value="Go" />
            <input type="hidden" name="check_keywords" value="yes" />
            <input type="hidden" name="area" value="default" />
          </form>
          <p class="searchtip" style="font-size: 90%">
            Enter search terms or a module, class or function name.
          </p>
        </div>
        <div class="clearer"></div>
      </div>
    </div>

    <div class="footer-wrapper">
      <div class="footer">
        <div class="left">
          <a href="weird-msgs.html" title="Weird Messages That Get Logged"
             >previous</a>
        </div>

        <div class="right">
          
    <div class="footer">
        &copy; Copyright 2018, Eggheads.
      Last updated on Dec 27, 2018.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
    </div>
        </div>
        <div class="clearer"></div>
      </div>
    </div>

  </body>
</html>