Script:  GreetWondeR
Version: 1.3
Finished on: Sat May 22 13:45:46 MEST 1999 
Required: Eggdrop 1.3.x
Author:  Wingman <Wingman@Defiant.vilstal.net>
         http://defiant.vilstal.net/~wingman/

Please send any suggestions and bugreports to:
Wingman@Defiant.vilstal.net

If u want to contact me on IRC, use irc.webbernet.net or irc.stealth.net 
(IRCNet) and go to channel(s) #Star_Trek or #Quake2.ger. (or Undernet@#Eggdrop)

 ------------------------------------------------------------------------------
|  [introduction] [features] [a short guide] [known bugs] [history] [credits]  |
 ------------------------------------------------------------------------------

INTRODUCTION
------------
First of all - i should say sorry, cause of my english - it's not the best ;).
If u want to edit any of the messages, which are integrated in the tcl, send
your suggestions and i'll add/remove/modify them as soon as possible.
There a lot of greet.tcl's on sodre.net, eggdrop.net or tclslave.net, but i 
didn't like them very much. So why don't write your own tcl? :). A few of the 
scripts are coded very well and some are even better (coded) than this. But this
tcl is highly configurable through dcc chat/partyline and this - i think - is 
very important for any tcl. 

FEATURES:
---------
 - full multi channel support
 - each chan owner can set individual greets for his chan...
 - supports flag greets
 - can either msg/notice all users, just non-users or only known users
 - greets can be turned off
 - all settings can be changed via dcc
 - simple floot protection (in case of flood joins, the tcl will shut
   down itself and restart at a certain number of mins)
 - supports var replacing, e.g. if u add a greet
   ".+greet Welcome greet-nick to greet-chan - For a help try /msg greet-botnick
   help"
   and let's say Wingman joins #Eggdrop, he'll see:
   Welcome Wingman to #Eggdrop - For a help try /msg Eggie help
 - and many more... (try .greethelp for a commandlist)

A SHORT GUIDE (it's the same as .greethelp guide) 
-------------

1. If you want to add a greet for #test, which should get all users...
  .+greet #test Hi greet-nick - Welcome to greet-chan
   .greetwho #test all

2. If you want flag specific greets, try...
   .+greet #test +n Hi greet-nick - You are an Owner on greet-chan!
   You can define up to x lines (x is defined at the top of the tcl) for every 
   flag or greet.

3. If you want to greet a nick with a specific line, then use...
   .+greetnick Nickname pub Hi Nick, what's up?
   (Only nicknames, which are in the userlist are allowed)

4. A feature of this tcl is its varreplacing:
   greet-nick, greet-chan and greet-botnick are replaced by the tcl vars,
   which means, if let's say Wingman joins #Eggdrop and the Botnick
   is Eggie, he will see (if there's greet like
   Hi greet-nick! Welcome to greet-chan - For a help try /msg greet-botnick help
   Hi Wingman! Welcome to #Eggdrop - For a help try /msg Eggie help

KNOWN "BUGS"
------------
I don't like, how the greets are saved, all greets, flags and normal greets are
messed up in one file for each channel.

HISTORY/CHANGES 
---------------

Version 1.0.0
 - uhm, added a lot of stuff and fixed a lot of bugs ;)

Version 1.0.1
 Foundby   Fixedby   What...
           Wingman   added .+/-greetnick <handle> (<how> <text>)
 Cocko     Wingman   forgot a close $file at +greet, whick 'caused
                     a tcl error: too many open files
           Wingman   rewrote the init code for a better update of older
                     versions
           Wingman   modified .greetstatus
Cocko      Wingman   forgot a ) in proc greet:join *grmml*
Cocko      Wingman   he's really lazy... ;) modified -greet, now u don't
                     need to enter the whole greet text, just the first
                     words...
           Wingman   added .greetnickview for a list of nick-greets
Wingman    Wingman   nick was not greeted, if a nick-greet was set...

Wingman    Wingman   f%#ck typo... unkown -> unknown, 'cause of this
                     typo, it's hard to update without removing all
                     greets...

Version 1.0.2
 Foundby   Fixedby   What...
 Wingman   Wingman   greet(max) didn't work anymore after update to
                     .+greet <flags>
 Wingman   Wingman   again - rewriting of the init code 'cause of this
                     lame typo (unkown -> unknown)...
 Cocko     Wingman   and again...forgot a close $file in greet:join
 Cocko     Wingman   global +o did`nt get the chan +o greet...
 Wingman   Wingman   forgot check at .greetstatus, if file exists
                     $greet(nicks)
           Wingman   some minor bugfixings
 Wingman   Wingman   forgot to remove a exec rm (part of the old code),
                     which 'caused a tcl error, if u del all greets
                     on #chan and tried a .greetview...
           Wingman   moved .greetall -> greetwho <all/known/unknown>
           Wingman   added .greetreset for a complete greet reset
 Cocko     Wingman   argh, bug in getvar... (close $file ;))
 Wingman   Wingman   .greethelp -> greetwho [channel] <0/1/2> should be
                     greetwho [channel] <all/known/unknown>
 Cocko     Wingman   forgot a global greet in the flood subroutines,
                     which cause a tcl error and a seg fault :)
 Wingman   Wingman   nick-greet -> matched $nick and not $handle
           Wingman   tried to shorten the proc greet:join code...

Version 1.0.3
 Foundby   Fixedby   What...
           Wingman   several smaller bugfixes
           Wingman   moved name SimpleGreet -> GreetWondeR
                     _Simple_ did'nt get it anymore ;)
           Wingman   added GreetWondeR motd (can be turned off via .gmotd)
           Wingman   modified .+greet, now all flags are allowed
           Wingman   rewrote the init code 'cause of now supporting all
                     flags...
           Wingman   rewrote greetsaving (+/-greet) and greetstatus
           Wingman   rewrote the greet code...
                     Now there are no more file-readings on joins
           Wingman   *grrrr* on first start of eggdrop, [channel] == ""
                     this suxx ->> let's write proc [channels] new :)
                     Usage: getchannels 
                     returns: a list of the channel, the bot (should) be on
                              (gets chaninfo from chanfile)
           Wingman   Added a short introduction (.greethelp guide)

Version 1.0.4
 Foundby   Fixedby   What...
           Wingman   fixed some minor bugs...
           Wingman   moved proc init -> greet:init (no more confusion
                     with other tcl's)
           Wingman   added eggdrop version test (now the tcl will not
                     not run on eggdrops < 1.3)
 Wingman   Wingman   .+greet <noflags> greet and there are $greet(max)
                     <flag> greets saved, no more <noflag> greets are
                     allowed. fixed
 Wingman   Wingman   .greetview didn't show the <noflag> greets
 Cocko     Wingman   in proc:join greetb was not definied, if there
                     were no <nonflag> greets saved. fixed
 Cocko     Wingman   greetnicks now with Varreplacings...

---
Version 1.1
 Foundby   Fixedby   What...
           Wingman   several smaller bugfixes
           Wingman   hmmm, i guess unbind is a very unstabil tcl command
                     the recoding of the flood code didn't fix it and even
                     on a system with tcl8.0, there are tcl crashes...
                     I've removed the unbind commands and handle the
                     flood protect over vars...
           Wingman   moved history + a short guide to file gw_info.txt
           Wingman   bind'ed .greet n|n to owner only
           Wingman   added proc getfile
           Wingman   removed some debugging putlogs
           Wingman   moved tcl name greetwonder[ver].tcl -> greetwonder.tcl
           Wingman   moved infofile gw_info.txt          -> greetwonder.txt
           Wingman   recoded (again) flood code - now handling over bind flud
           Wingman   removed var greet(flood) joins:secs
           Wingman   added var greet(init) 0/1 -> extended startup screen?
           Wingman   modified greetstatus
           Wingman   .+greet +n bla [test] bla -> greet = bla {[test]} bla
                     this sucks ;) - added proc lend { start string }
                     Usage: lend <startnumber> <text>
                     returns: words from <startnr> to end from <text>
                     (similar to [lrange] but w/o endnumber) 
           Wingman   uhm -greet didn't work like i want...fixed :)

Version 1.2 
  Foundby   Fixedby   What...
  Wingman   Wingman   .+greet +n {a b} c -> sets greet to "a b c"
  Wingman   Wingman   forgot the cmd putlog in proc gmotd (fixed)
  Wingman   Wingman   2 typos in the settings "sould" -> "should"
  Wingman   Wingman   .greetstatus sometimes didn't "set c" (fixed)
  Wingman   Wingman   .greetreset showed some putlogs, which d only be
                      available on a .rehash (fixed)
  Wingman   Wingman   if console was *, then $chan == * (fixed)
  Wingman   Wingman   did some modifications on .greetstatus 
  Wingman   Wingman   Now greetwonder can be runned on eggdrops != 1.3.x 
                      But don't blame me, if a cmd doesn't work. If u find an
		      error, send a mail :)
  Wingman   Wingman   moved bindings to procs (no longer listed at the top)
  Wingman             modified .greethow [channel] - Now you can change each
                      flag-greet to a different way of greeting (msg or notice)
                      -> .greethow [channel] [flag] <msg/notice>
  Wingman             added proc greet:debug, writes debug file on an error and
                      suggests to send this file to my email adress
                      Usage: greet:debug <handle> <idx> <command> <arg>
                      (writes Eggdrop Version, date, time, handle, command, arg
                      and greet.dat to greet-debug.date)
  Wingman             modified .greetview
  Wingman             removed .chaninfo modification (now: standard)
  Wingman             moved [flag] -> [+flag] (a bit confusing cause [flag] 
                      didn't work...)
  Wingman             1.3.27 (and above?) adds putlogs itself :-/
		      -> added proc greet:putlog - checks if version >= 1.3.27*
                      if match -> then no putlogs, else putlog cmd
Version 1.3
  Foundby   Fixedby   What...
  Wingman   Wingman   FIXED: smaller bugs (typos etc.)
  Wingman   Wingman   FIXED: forgot a ] in greet:join (1.2+greet:joinfix)
  Wingman   Wingman   FIXED: .-greetnick <nick> did'nt worked in some cases
  Wingman   Wingman   FIXED: .greetnickview got confused cause of -greetnick
  Wingman   Wingman   FIXED: the Greet-MOTD didn't work with |n users
  Wingman   Wingman   FIXED: in file greet(data), the new version was added
                             at the top, but the old headers were not removed
  Wingman             NEW: moved proc greet:sucks -> greet:replace
                           usage: greet:replace <nick> <chan> <line>
			   returns: string
  Wingman             NEW: moved (nick), (chan) and (botnick) to greet-nick
                           greet-chan and greet-botnick. Now these strings are
			   replaced by the proc vars (also if, there's a char 
			   in front of or at the end of the word.
  Wingman             NEW: .+greetnick <nick> <msg/notice/pub/act> <text>
                           Now nicks can be greeted via /me (ACTION)
  Wingman             NEW: added Init Updater - (nick), (chan) and (botnick) are
                           replaced by greet-nick, greet-chan, greet-botnick

CREDITS
-------
Cocko - Thx for the suggestions and the betatesting/bugreportings ;)
^AP^  - he's my tcl teacher =)
Sara  - She was the first, which mail'ed cause of this tcl ;) 
