Friendcodes script

By Justdabomb2 on Sep 26, 2006

Instructions and everything else are in the snippet. Just read -- I did make this myself, do not change it and pass it off as your own! or it will be BAD!

##################################################################################################
##                                                                                              ##
##  Author: Justdabomb2           <email: edngravy@sbcglobal.net>                               ##
##  Script: Friendcodes                                                                         ##
##  Version: v1.1                                                                               ##
##  Date: 09/26/2006                                                                            ##
##                                                                                              ##
##  Commands:     !add<game> <code> - Adds code to a the specified game file.                   ##
##                  - Don't forget that there is no space in between !add and <game>.           ##
##                                                                                              ##
##                !find<game> <nick> - Gets a code for <nick> from the specified game file.     ##
##                  - Don't forget that there is no space in between !find and <game>.          ##
##                                                                                              ##
##  Installation: 1. Save in your script directory as "friendcodes.tcl".                        ##
##                2. add line "source scripts/friendcodes.tcl to the bottom of your eggdrop     ##
##                   configuration file.                                                        ##
##   (optional) - 3. CTRL+F search for 'set noticecolor "1"' and change 1 to the color number   ##
##                   you want to the bot to send notices in (use the color key below).          ##
##                4. Rehash or restart your bot, and type "!friendcodes" in the channel to      ##
##                   get started.                                                               ##
##                                                                                              ##
##  Bugs:         - Script is Case-Sensitve when searching for a person's friendcode(s).        ##
##                - Bot greets itself when it joins the channel.                                ##
##                                                                                              ##
##  Game Initial Key:                                                                           ##
##                                                                                              ##
##                       ||=----------------------------=||=--------=||                         ##
##                       ||           Game Name          || Initials ||                         ##
##                       ||=----------------------------=||=--------=||                         ##
##                       || Animal Crossing: Wild World  ||   ACWW   ||                         ##
##                       || Mario Kart DS                ||   MKDS   ||                         ##
##                       || Metroid Prime Hunters        ||   MPHT   ||                         ##
##                       || Tony Hawk's American Sk8Land ||   THAS   ||                         ##
##                       || LostMagic                    ||   LSMG   ||                         ##
##                       || Tetris DS                    ||   TETR   ||                         ##
##                       || Starfox Command              ||   STFX   ||                         ##
##                       || Mario vs Donkey Kong         ||   MDK2   ||                         ##
##                       || Tenchu Dark Secret           ||   TNCH   ||                         ##
##                       ||=----------------------------=||=--------=||                         ##
##                                                                                              ##
##                                                                                              ##
##  Color Key:                                                                                  ##
##                                                                                              ##
##                               ||=-------------=||=--------=||                                ##
##                               ||   Color Name  ||  Number  ||                                ##
##                               ||=-------------=||=--------=||                                ##
##                               || White         ||    0     ||                                ##
##                               || Black         ||    1     ||                                ##
##                               || Dark Blue     ||    2     ||                                ##
##                               || Green         ||    3     ||                                ##
##                               || Red           ||    4     ||                                ##
##                               || Brown         ||    5     ||                                ##
##                               || Purple        ||    6     ||                                ##
##                               || Orange        ||    7     ||                                ##
##                               || Yellow        ||    8     ||                                ##
##                               || Light Green   ||    9     ||                                ##
##                               || Teal          ||    10    ||                                ##
##                               || Light Blue    ||    11    ||                                ##
##                               || Blue          ||    12    ||                                ##
##                               || Pink          ||    13    ||                                ##
##                               || Dark Grey     ||    14    ||                                ##
##                               || Light Grey    ||    15    ||                                ##
##                               ||=-------------=||=--------=||                                ##
##                                                                                              ##
##                                                                                              ##
##                                                                                              ##
##  You do NOT need to change anything in this script (besides what it tells you to change in   ## 
##             the installation), it should work the way it is right now.                       ##
##                                                                                              ##
##                                                                                              ##
##  If you would like a version of the script with out a greet, and you do not know how to      ##
##               remove that part of the script yourself, just email me.                        ##
##                                                                                              ##
##                                                                                              ##
##  Newer versions on this script will be out as new Wi-Fi enabled games are released.          ##
##                                                                                              ##
##                                                                                              ##
##  If you notice any other bugs, problems, or issues, please e-mail me them! Thanks            ##
##                                                                                              ##
##                                                                                              ##
##  Please do not re-distribute a modified version of this script. If you do re-distribute      ##
##  it in it's original form, please give credit to me, and do not claim it as your own.        ##
##                                                                                              ##
##                                                                   ~Thank you!                ##
##                                                                                              ##
##################################################################################################

###########################################################
## This tells the bot where the friendcode files are put ##
###########################################################

set mphtfile "scripts/codes/mphtcodes.txt" 
if {![file exists $mphtfile]} { 
  catch {close [open $mphtfile w]} 
} 

set acwwfile "scripts/acwwcodes.txt" 
if {![file exists $acwwfile]} { 
  catch {close [open $acwwfile w]} 
} 

set mkdsfile "scripts/mkdscodes.txt" 
if {![file exists $mkdsfile]} { 
  catch {close [open $mkdsfile w]} 
} 

set lsmgfile "scripts/lsmgcodes.txt" 
if {![file exists $lsmgfile]} { 
  catch {close [open $lsmgfile w]} 
} 

set stfxfile "scripts/stfxcodes.txt" 
if {![file exists $stfxfile]} { 
  catch {close [open $stfxfile w]} 
} 

set tetrfile "scripts/tetrcodes.txt" 
if {![file exists $tetrfile]} { 
  catch {close [open $tetrfile w]} 
} 

set thasfile "scripts/thascodes.txt" 
if {![file exists $thasfile]} { 
  catch {close [open $thasfile w]} 
}

set mdk2file "scripts/mdk2codes.txt" 
if {![file exists $mdk2file]} { 
  catch {close [open $mdk2file w]} 
} 

set tnchfile "scripts/tnchcodes.txt" 
if {![file exists $tnchfile]} { 
  catch {close [open $tnchfile w]} 
}  

#############################################################
## You can change this variable! (step 3 on installation)  ##
#############################################################

set noticecolor "1"

###########################################
## Please do not change these variables! ##
###########################################

set fccreator "Justdabomb2"
set fcversion "v1.1"
set gameamount "9"
set createdate "09/26/2006"

###############################################################
## These are the commands to add a friendcode to a game file ##
###############################################################

bind pub - !addmpht add:mpht
bind pub - !addacww add:acww
bind pub - !addmkds add:mkds
bind pub - !addlsmg add:lsmg
bind pub - !addstfx add:stfx
bind pub - !addtetr add:tetr
bind pub - !addthas add:thas
bind pub - !addmdk2 add:mdk2
bind pub - !addtnch add:tnch

#################################################################
## These are the commands to get a friendcode from a game file ##
#################################################################

bind pub - !findmpht find:mpht
bind pub - !findacww find:acww
bind pub - !findmkds find:mkds
bind pub - !findlsmg find:lsmg
bind pub - !findstfx find:stfx
bind pub - !findtetr find:tetr
bind pub - !findthas find:thas
bind pub - !findmdk2 find:mdk2
bind pub - !findtnch find:tnch

##################################################################
## These are the commands for users to get help with the script ##
##################################################################

bind pub - !gamekey info:key
bind pub - !add info:add
bind pub - !find info:find
bind pub - !friendcodes info:fcmenu
bind pub - !about info:about
bind join - * info:greet

############################################################
## This is where the !add<game> part of the script starts ##
############################################################

proc add:mpht {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::mphtfile r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd 
    putquick "NOTICE $nick :$noticecolor Your code for MPHT has been added." 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addmpht <code>" 
  } 
} 

proc add:acww {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::acwwfile r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd
    putquick "NOTICE $nick :$noticecolor Your code for ACWW has been added."  
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addacww <code>" 
  } 
} 

proc add:mkds {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::mkdsfile r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd 
    putquick "NOTICE $nick :$noticecolor Your code for MKDS has been added." 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addmkds <code>" 
  } 
} 

proc add:lsmg {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::lsmgfile r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd 
    putquick "NOTICE $nick :$noticecolor Your code for LSMG has been added." 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addlsmg <code>" 
  } 
} 

proc add:stfx {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::stfxfile r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd 
    putquick "NOTICE $nick :$noticecolor Your code for STFX has been added." 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addstfx <code>" 
  } 
} 

proc add:tetr {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::tetrfile r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd 
    putquick "NOTICE $nick :$noticecolor Your code for TETR has been added." 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addtetr <code>" 
  } 
} 

proc add:thas {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::thasfile r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd
    putquick "NOTICE $nick :$noticecolor Your code for THAS has been added."  
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addthas <code>" 
  } 
} 

proc add:mdk2 {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::mdk2file r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd
    putquick "NOTICE $nick :$noticecolor Your code for MDK2 has been added."  
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addmdk2 <code>" 
  } 
}

proc add:tnch {nick uhost hand chan arg} { 
  global noticecolor
  set gamer $nick 
  set code [lindex [split $arg] 0] 
  if {$gamer != "" && $code != ""} { 
    set fd [open $::tnchfile r+] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    if {[lindex $list end] == ""} { 
      set list [lreplace $list end end] 
    } 
    lappend list "\[$nick\] <$gamer> <$code>" 
    seek $fd 0 
    puts -nonewline $fd [join $list \n] 
    close $fd
    putquick "NOTICE $nick :$noticecolor Your code for TNCH has been added."  
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !addtnch <code>" 
  } 
}

#############################################################
## This is where the !find<game> part of the script starts ##
#############################################################

proc find:mpht {nick uhost hand chan arg} { 
  global noticecolor mphtfile 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::mphtfile r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for MPHT is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode."    
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !findmpht <nick>" 
  } 
}

proc find:acww {nick uhost hand chan arg} {
  global noticecolor acwwfile 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::acwwfile r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for ACWW is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode."  
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !findacww <nick>" 
  } 
}

proc find:mkds {nick uhost hand chan arg} { 
  global noticecolor mkdsfile 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::mkdsfile r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for MKDS is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode."  
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !findmkds <nick>" 
  } 
}

proc find:lsmg {nick uhost hand chan arg} { 
  global noticecolor lsmgfile 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::lsmgfile r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for LSMG is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode."  
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !findlsmg <nick>" 
  } 
}

proc find:stfx {nick uhost hand chan arg} { 
  global noticecolor stfxfile 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::stfxfile r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for STFX is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode." 
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor  Type !findstfx <nick>" 
  } 
}

proc find:tetr {nick uhost hand chan arg} { 
  global noticecolor tetrfile 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::tetrfile r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for TETR is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode."  
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !findtetr <nick>" 
  } 
}

proc find:thas {nick uhost hand chan arg} { 
  global noticecolor thasfile 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::thasfile r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for THAS is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode."  
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !findthas <nick>" 
  } 
}

proc find:mdk2 {nick uhost hand chan arg} { 
  global noticecolor mdk2file 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::mdk2file r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for MDK2 is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode."  
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !findmdk2 <nick>" 
  } 
}

proc find:tnch {nick uhost hand chan arg} { 
  global noticecolor tnchfile 
  set name [lindex [split $arg] 0] 
  if {$name != ""} { 
    set fd [open $::tnchfile r] 
    while {![eof $fd]} { 
      lappend list [gets $fd] 
    } 
    close $fd 
    if {[set le [lsearch -glob $list "*$name*"]] != -1} { 
      set line [lindex $list $le] 
      set code [string map {< "" > ""} [lindex $line 2]] 
      putquick "NOTICE $nick :$noticecolor $name's code for TNCH is: $code ." 
      } else { 
      putquick "NOTICE $nick :$noticecolor That name was not found."
      putquick "NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode."  
    } 
    } else { 
    putquick "NOTICE $nick :$noticecolor Type !findtnch <nick>" 
  } 
}

######################################################
## This is where the info part of the script starts ##
######################################################

proc info:key {nick uhost hand rest txt} { 
  global noticecolor
  putquick "NOTICE $nick :$noticecolor These are the initials to use for each game:"
  putquick "NOTICE $nick :$noticecolor -----"
  putquick "NOTICE $nick :$noticecolor  ACWW - Animal Crossing: Wild World"
  putquick "NOTICE $nick :$noticecolor  MKDS - Mario Kart DS"
  putquick "NOTICE $nick :$noticecolor  MPHT - Metroid Prime Hunters"
  putquick "NOTICE $nick :$noticecolor  THAS - Tony Hawk's American Sk8Land"
  putquick "NOTICE $nick :$noticecolor  LSMG - LostMagic"
  putquick "NOTICE $nick :$noticecolor  TETR - Tetris DS"
  putquick "NOTICE $nick :$noticecolor  STFX - Starfox Command"
  putquick "NOTICE $nick :$noticecolor  MDK2 - Mario vs Donkey Kong"
  putquick "NOTICE $nick :$noticecolor  TNCH - Tenchu Dark Secret"
}

proc info:add {nick uhost hand rest txt} { 
  global noticecolor
  putquick "NOTICE $nick :$noticecolor To add your friendcode,"
  putquick "NOTICE $nick :$noticecolor type , !add<game> <code>"
  putquick "NOTICE $nick :$noticecolor Remember there is no space in between !add and <game>"
  putquick "NOTICE $nick :$noticecolor Type !gamekey to see the initials of each game."
}

proc info:find {nick uhost hand rest txt} { 
  global noticecolor
  putquick "NOTICE $nick :$noticecolor To find someone's friendcode,"
  putquick "NOTICE $nick :$noticecolor type , !find<game> <nick>"
  putquick "NOTICE $nick :$noticecolor Remember there is no space in between !find and <game>"
  putquick "NOTICE $nick :$noticecolor When searching for a friendcode, keep in mind, their nick is Case-Sensitive."
  putquick "NOTICE $nick :$noticecolor Type !gamekey to see the initials of each game."
}

proc info:fcmenu {nick host handle chan txt} { 
  global fccreator noticecolor
  putquick "NOTICE $nick :$noticecolor Hey $nick, Thanks for using my Friendcodes Script!"
  putquick "NOTICE $nick :$noticecolor -----"
  putquick "NOTICE $nick :$noticecolor The commands to this script are:"
  putquick "NOTICE $nick :$noticecolor !add - shows how to add your friendcode."
  putquick "NOTICE $nick :$noticecolor !find - shows how to find someone's friendcode."
  putquick "NOTICE $nick :$noticecolor !gamekey - see the initials to use of each game."
  putquick "NOTICE $nick :$noticecolor !about - see a little about this script."
  putquick "NOTICE $nick :$noticecolor -----"
  putquick "NOTICE $nick :$noticecolor This is script was made by3 $fccreator"
}

proc info:about {nick host handle chan txt} { 
  global fccreator fcversion gameamount createdate noticecolor
  putquick "NOTICE $nick :10 Friend11codes$noticecolor $fcversion was made by3 $fccreator."
  putquick "NOTICE $nick :$noticecolor This is script was created on $createdate."
  putquick "NOTICE $nick :$noticecolor Currently this script has7 $gameamount 10Wi-Fi$noticecolor games."
}

proc info:greet {nick host handle chan} {
  putserv "NOTICE $nick :13,1Welcome to $chan, $nick!9,1 Type !friendcodes to see how to add your friendcode(s) from your favorite 10,1Wi-Fi9,1 game(s)!"
}

putlog "Justdabot's Friendcodes Script Loaded"

Comments

Sign in to comment.
napa182   -  Feb 26, 2008

damn man next time please use:

script here

it makes it easier to read that way....

 Respond  
juble   -  Feb 25, 2008

##################################################################################################

Author: Justdabomb2 <email: edngravy@sbcglobal.net>

Script: Friendcodes

Version: v1.1

Date: 09/26/2006

Commands: !add - Adds code to a the specified game file.

- Don\'t forget that there is no space in between !add and .

!find - Gets a code for from the specified game file.

- Don\'t forget that there is no space in between !find and .

Installation: 1. Save in your script directory as \"friendcodes.tcl\".

2. add line \"source scripts/friendcodes.tcl to the bottom of your eggdrop

configuration file.

(optional) - 3. CTRL+F search for \'set noticecolor \"1\"\' and change 1 to the color number

you want to the bot to send notices in (use the color key below).

4. Rehash or restart your bot, and type \"!friendcodes\" in the channel to

get started.

Bugs: - Script is Case-Sensitve when searching for a person\'s friendcode(s).

- Bot greets itself when it joins the channel.

Game Initial Key:

||=----------------------------=||=--------=||

|| Game Name || Initials ||

||=----------------------------=||=--------=||

|| Animal Crossing: Wild World || ACWW ||

|| Mario Kart DS || MKDS ||

|| Metroid Prime Hunters || MPHT ||

|| Tony Hawk\'s American Sk8Land || THAS ||

|| LostMagic || LSMG ||

|| Tetris DS || TETR ||

|| Starfox Command || STFX ||

|| Mario vs Donkey Kong || MDK2 ||

|| Tenchu Dark Secret || TNCH ||

||=----------------------------=||=--------=||

Color Key:

||=-------------=||=--------=||

|| Color Name || Number ||

||=-------------=||=--------=||

|| White || 0 ||

|| Black || 1 ||

|| Dark Blue || 2 ||

|| Green || 3 ||

|| Red || 4 ||

|| Brown || 5 ||

|| Purple || 6 ||

|| Orange || 7 ||

|| Yellow || 8 ||

|| Light Green || 9 ||

|| Teal || 10 ||

|| Light Blue || 11 ||

|| Blue || 12 ||

|| Pink || 13 ||

|| Dark Grey || 14 ||

|| Light Grey || 15 ||

||=-------------=||=--------=||

You do NOT need to change anything in this script (besides what it tells you to change in

the installation), it should work the way it is right now.

If you would like a version of the script with out a greet, and you do not know how to

remove that part of the script yourself, just email me.

Newer versions on this script will be out as new Wi-Fi enabled games are released.

If you notice any other bugs, problems, or issues, please e-mail me them! Thanks

Please do not re-distribute a modified version of this script. If you do re-distribute

it in it\'s original form, please give credit to me, and do not claim it as your own.

~Thank you!

##################################################################################################

###########################################################

This tells the bot where the friendcode files are put

###########################################################

set mphtfile \"scripts/codes/mphtcodes.txt\"
if {![file exists $mphtfile]} {
catch {close [open $mphtfile w]}
}

set acwwfile \"scripts/acwwcodes.txt\"
if {![file exists $acwwfile]} {
catch {close [open $acwwfile w]}
}

set mkdsfile \"scripts/mkdscodes.txt\"
if {![file exists $mkdsfile]} {
catch {close [open $mkdsfile w]}
}

set lsmgfile \"scripts/lsmgcodes.txt\"
if {![file exists $lsmgfile]} {
catch {close [open $lsmgfile w]}
}

set stfxfile \"scripts/stfxcodes.txt\"
if {![file exists $stfxfile]} {
catch {close [open $stfxfile w]}
}

set tetrfile \"scripts/tetrcodes.txt\"
if {![file exists $tetrfile]} {
catch {close [open $tetrfile w]}
}

set thasfile \"scripts/thascodes.txt\"
if {![file exists $thasfile]} {
catch {close [open $thasfile w]}
}

set mdk2file \"scripts/mdk2codes.txt\"
if {![file exists $mdk2file]} {
catch {close [open $mdk2file w]}
}

set tnchfile \"scripts/tnchcodes.txt\"
if {![file exists $tnchfile]} {
catch {close [open $tnchfile w]}
}

#############################################################

You can change this variable! (step 3 on installation)

#############################################################

set noticecolor \"1\"

###########################################

Please do not change these variables!

###########################################

set fccreator \"Justdabomb2\"
set fcversion \"v1.1\"
set gameamount \"9\"
set createdate \"09/26/2006\"

###############################################################

These are the commands to add a friendcode to a game file

###############################################################

bind pub - !addmpht add:mpht
bind pub - !addacww add:acww
bind pub - !addmkds add:mkds
bind pub - !addlsmg add:lsmg
bind pub - !addstfx add:stfx
bind pub - !addtetr add:tetr
bind pub - !addthas add:thas
bind pub - !addmdk2 add:mdk2
bind pub - !addtnch add:tnch

#################################################################

These are the commands to get a friendcode from a game file

#################################################################

bind pub - !findmpht find:mpht
bind pub - !findacww find:acww
bind pub - !findmkds find:mkds
bind pub - !findlsmg find:lsmg
bind pub - !findstfx find:stfx
bind pub - !findtetr find:tetr
bind pub - !findthas find:thas
bind pub - !findmdk2 find:mdk2
bind pub - !findtnch find:tnch

##################################################################

These are the commands for users to get help with the script

##################################################################

bind pub - !gamekey info:key
bind pub - !add info:add
bind pub - !find info:find
bind pub - !friendcodes info:fcmenu
bind pub - !about info:about
bind join - * info:greet

############################################################

This is where the !add part of the script starts

############################################################

proc add:mpht {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::mphtfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for MPHT has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addmpht \"
}
}

proc add:acww {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::acwwfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for ACWW has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addacww \"
}
}

proc add:mkds {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::mkdsfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for MKDS has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addmkds \"
}
}

proc add:lsmg {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::lsmgfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for LSMG has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addlsmg \"
}
}

proc add:stfx {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::stfxfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for STFX has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addstfx \"
}
}

proc add:tetr {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::tetrfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for TETR has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addtetr \"
}
}

proc add:thas {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::thasfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for THAS has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addthas \"
}
}

proc add:mdk2 {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::mdk2file r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for MDK2 has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addmdk2 \"
}
}

proc add:tnch {nick uhost hand chan arg} {
global noticecolor
set gamer $nick
set code [lindex [split $arg] 0]
if {$gamer != \"\" && $code != \"\"} {
set fd [open $::tnchfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == \"\"} {
set list [lreplace $list end end]
}
lappend list \"\[$nick\] <$gamer> <$code>\"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick \"NOTICE $nick :$noticecolor Your code for TNCH has been added.\"
} else {
putquick \"NOTICE $nick :$noticecolor Type !addtnch \"
}
}

#############################################################

This is where the !find part of the script starts

#############################################################

proc find:mpht {nick uhost hand chan arg} {
global noticecolor mphtfile
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::mphtfile r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for MPHT is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findmpht \"
}
}

proc find:acww {nick uhost hand chan arg} {
global noticecolor acwwfile
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::acwwfile r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for ACWW is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findacww \"
}
}

proc find:mkds {nick uhost hand chan arg} {
global noticecolor mkdsfile
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::mkdsfile r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for MKDS is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findmkds \"
}
}

proc find:lsmg {nick uhost hand chan arg} {
global noticecolor lsmgfile
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::lsmgfile r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for LSMG is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findlsmg \"
}
}

proc find:stfx {nick uhost hand chan arg} {
global noticecolor stfxfile
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::stfxfile r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for STFX is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findstfx \"
}
}

proc find:tetr {nick uhost hand chan arg} {
global noticecolor tetrfile
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::tetrfile r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for TETR is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findtetr \"
}
}

proc find:thas {nick uhost hand chan arg} {
global noticecolor thasfile
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::thasfile r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for THAS is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findthas \"
}
}

proc find:mdk2 {nick uhost hand chan arg} {
global noticecolor mdk2file
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::mdk2file r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for MDK2 is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findmdk2 \"
}
}

proc find:tnch {nick uhost hand chan arg} {
global noticecolor tnchfile
set name [lindex [split $arg] 0]
if {$name != \"\"} {
set fd [open $::tnchfile r]
while {![eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list \"$name\"]] != -1} {
set line [lindex $list $le]
set code [string map {< \"\" > \"\"} [lindex $line 2]]
putquick \"NOTICE $nick :$noticecolor $name\'s code for TNCH is: $code .\"
} else {
putquick \"NOTICE $nick :$noticecolor That name was not found.\"
putquick \"NOTICE $nick :$noticecolor Please keep in mind that this script is Case-Sensitive when finding a friendcode.\"
}
} else {
putquick \"NOTICE $nick :$noticecolor Type !findtnch \"
}
}

######################################################

This is where the info part of the script starts

######################################################

proc info:key {nick uhost hand rest txt} {
global noticecolor
putquick \"NOTICE $nick :$noticecolor These are the initials to use for each game:\"
putquick \"NOTICE $nick :$noticecolor -----\"
putquick \"NOTICE $nick :$noticecolor ACWW - Animal Crossing: Wild World\"
putquick \"NOTICE $nick :$noticecolor MKDS - Mario Kart DS\"
putquick \"NOTICE $nick :$noticecolor MPHT - Metroid Prime Hunters\"
putquick \"NOTICE $nick :$noticecolor THAS - Tony Hawk\'s American Sk8Land\"
putquick \"NOTICE $nick :$noticecolor LSMG - LostMagic\"
putquick \"NOTICE $nick :$noticecolor TETR - Tetris DS\"
putquick \"NOTICE $nick :$noticecolor STFX - Starfox Command\"
putquick \"NOTICE $nick :$noticecolor MDK2 - Mario vs Donkey Kong\"
putquick \"NOTICE $nick :$noticecolor TNCH - Tenchu Dark Secret\"
}

proc info:add {nick uhost hand rest txt} {
global noticecolor
putquick \"NOTICE $nick :$noticecolor To add your friendcode,\"
putquick \"NOTICE $nick :$noticecolor type , !add\"
putquick \"NOTICE $nick :$noticecolor Remember there is no space in between !add and \"
putquick \"NOTICE $nick :$noticecolor Type !gamekey to see the initials of each game.\"
}

proc info:find {nick uhost hand rest txt} {
global noticecolor
putquick \"NOTICE $nick :$noticecolor To find someone\'s friendcode,\"
putquick \"NOTICE $nick :$noticecolor type , !find\"
putquick \"NOTICE $nick :$noticecolor Remember there is no space in between !find and \"
putquick \"NOTICE $nick :$noticecolor When searching for a friendcode, keep in mind, their nick is Case-Sensitive.\"
putquick \"NOTICE $nick :$noticecolor Type !gamekey to see the initials of each game.\"
}

proc info:fcmenu {nick host handle chan txt} {
global fccreator noticecolor
putquick \"NOTICE $nick :$noticecolor Hey $nick, Thanks for using my Friendcodes Script!\"
putquick \"NOTICE $nick :$noticecolor -----\"
putquick \"NOTICE $nick :$noticecolor The commands to this script are:\"
putquick \"NOTICE $nick :$noticecolor !add - shows how to add your friendcode.\"
putquick \"NOTICE $nick :$noticecolor !find - shows how to find someone\'s friendcode.\"
putquick \"NOTICE $nick :$noticecolor !gamekey - see the initials to use of each game.\"
putquick \"NOTICE $nick :$noticecolor !about - see a little about this script.\"
putquick \"NOTICE $nick :$noticecolor -----\"
putquick \"NOTICE $nick :$noticecolor This is script was made by3 $fccreator\"
}

proc info:about {nick host handle chan txt} {
global fccreator fcversion gameamount createdate noticecolor
putquick \"NOTICE $nick :10 Friend11codes$noticecolor $fcversion was made by3 $fccreator.\"
putquick \"NOTICE $nick :$noticecolor This is script was created on $createdate.\"
putquick \"NOTICE $nick :$noticecolor Currently this script has7 $gameamount 10Wi-Fi$noticecolor games.\"
}

proc info:greet {nick host handle chan} {
putserv \"NOTICE $nick :13,1Welcome to $chan, $nick!9,1 Type !friendcodes to see how to add your friendcode(s) from your favorite 10,1Wi-Fi9,1 game(s)!\"
}

putlog \"Justdabot\'s Friendcodes Script Loaded\"
?
?
?
?
?
?

 Respond  
Justdabomb2   -  Oct 01, 2006

It\'s supposed to be TcL, thats why it is in the TcL section of the website.

 Respond  
F*U*R*B*Y*   -  Sep 27, 2006

dude way too many spaces in the credits just have it as

Version: 1.01

not what you have.

besides that i think you need to add what it does and all that in the instructions to give people the idea of what it is, Friendcodes don\'t really cover the main details or maybe i\'m just wrong :P

 Respond  
Chainchomp   -  Sep 27, 2006

Ive already done one :P

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.