All pastes #396949 Raw Edit

Someone

public text v1 · immutable
·published 2007-03-16 03:18 UTC
rendered paste body
;;;;;;;[ XCdictionary v1.0 ];;;;;;;
;;;;;;;[Written by  Setever];;;;;;;

;Author's Notes: I added a $dcolor and $enddcolor for those of you who'd like to add color to all of the statements in the script. Just add a color and an ending after the 'return' in the aliases. If you don't understand this, don't attempt it!
;Author's Notes Part Two: You MUST view the admin panel! type: /dadmin

alias dcolor { return }

alias enddcolor { return }


alias dadmin {
  //echo -a $dcolor This is the XCdictionary project, or more commonly and plainly, the 'Dictionary'. The following are your commands. $enddcolor
  //echo -a $dcolor BANS - You can ban members, or even addresses from accessing the dictionary. $enddcolor
  //echo -a $dcolor * !nickban - You can ban a person's nick from using the dictionary and its features. $enddcolor
  //echo -a $dcolor * !addressban - You can ban a person's address by just adding their nick afterwards. $enddcolor
  //echo -a $dcolor * !removebans - You can remove a ban you've set. You must add the exact address you find from /viewbans if you are trying to remove an address. $enddcolor
  //echo -a $dcolor * /viewbans - Will show all of the bans you've made, both addresses and nicks. $enddcolor 
  //echo -a $dcolor REPORTS - People can report errors or comments, and you can look or check them with these commands. $enddcolor
  //echo -a $dcolor * /viewreports - Will show all the reported words. The first word in the report is the reported words, and the rest are the report comments. $enddcolor
  //echo -a $dcolor * /clearreport - You can clear the reports that you think have been taken care of. You follow the command with the report number found in /viewreports
  //echo -a $dcolor PROTECTED WORDS - You can protect a word so that nobody can add definitions on it. You can do this to keep the definitions as they are, or restrict a bad word.
  //echo -a $dcolor * /protectword - Just add the word after the command.
  //echo -a $dcolor * /listprotected - You can view all of the protected words you've set with command.
  //echo -a $dcolor * /removeprotect - You can use this to take the protection off of a word. Just add the word after the command.
  //echo -a $dcolor DELETION AND CHECK - You can delete words, or definitions, and check them with these commands.
  //echo -a $dcolor * /ddelete - You can delete a specific definition, or a complete word. If you're deleting a definition, you must use the specific ID, found in the definition, the number that goes after the !UP or !DOWN command. $enddcolor
  //echo -a $dcolor * /dword - You can view the word and all definitions that go along with it by adding the word after the command! $enddcolor 
}

on *:TEXT:!dhelp:#: {
  if ($istok(%dictionary_address_banned_list,$address($nick,4),44)) { notice $nick You have banned banned from the dictionary and its functions. }
  else {
    if ($istok(%dictionary_nick_banned_list,$nick,44)) { notice $nick Your nick has been banned from the dictionary and its functions. }
    else {
      notice $nick $dcolor This is the XCdictionary project made by Setever, to help define the world! $enddcolor
      notice $nick $dcolor Commands: !dictionary [word], !find [word], !define [word] [definition], !report [word] [comments] $enddcolor
    }
  }
}

on *:TEXT:!dictionary*:#: {
  if ($istok(%dictionary_address_banned_list,$address($nick,4),44)) { notice $nick You have banned banned from the dictionary and its functions. }
  else {
    if ($istok(%dictionary_nick_banned_list,$nick,44)) { notice $nick Your nick has been banned from the dictionary and its functions. }
    else {
      if ($2) {
        if ($istok(%defined_words,$2,44)) {
          msg $chan $dcolor %xcdictionary_word_ [ $+ [ $2 ] ] $+ . $2  $enddcolor
          msg $chan $dcolor There are $numtok(%xcdictionary_word_total_definitions_ [ $+ [ $2 ] ],44) definitions for: $2 $+ . To view them, type !find $2 $+ . $enddcolor
        }
        else {
          msg $chan $dcolor The definition of $2 has yet to be recorded! Add your own! $enddcolor
          msg $chan $dcolor To add your own definition, type: !define WORD [definition] $+ . $enddcolor
        }
      }
      else { notice $nick You need to add a word after! Correct Syntax: !dictionary WORD }
    }
  }
}

on *:TEXT:!define*:#: {
  if ($istok(%dictionary_address_banned_list,$address($nick,4),44)) { notice $nick You have banned banned from the dictionary and its functions. }
  else {
    if ($istok(%dictionary_nick_banned_list,$nick,44)) { notice $nick Your nick has been banned from the dictionary and its functions. }
    else {
      if ($istok(%protected_words,$2,44)) { notice $nick That word has been protected. You may not define it! }
      else {
        if (!$2) { notice $nick You must add a word after the !define command! Correct Syntax: !define WORD [definition] }
        elseif (!$3) { notice $nick You must add a definition! Correct Syntax: !define WORD [definition] }
        else {
          if (!$istok(%defined_words,$2,44)) {
            inc %individual_id 1
            set %defined_words $addtok(%defined_words,$2,44)
            set %xcdictionary_word_ [ $+ [ $2 ] ] %individual_id
            inc %individual_id 1
            set %xcdictionary_word_total_definitions_ [ $+ [ $2 ] ] $addtok(%xcdictionary_word_total_definitions_ [ $+ [ $2 ] ],%individual_id,44)
            set %xcdictionary_definition_ [ $+ [ %individual_id ] ] $3-
            set %xcdictionary_definition_adder_ [ $+ [ %individual_id ] ] $nick
            set %total_up_votings_ [ $+ [ %individual_id ] ] 0
            set %total_down_votings_ [ $+ [ %individual_id ] ] 0
            set %total_definition_up_down_possible $addtok(%total_definition_up_down_possible,%individual_id,44)
            msg $chan $dcolor Definition for Word ' $+ $2 $+ ' added. Definition: $3- $+ . To see the definitions, type: !find $2 $enddcolor
            set %xcdictionary_total_definitions $addtok(%xcdictionary_total_definitions,%individual_id,44)
            set %xcdictionary_individual_id_word_ [ $+ [ %individual_id ] ] $2
          }
          else {
            inc %individual_id 1
            set %xcdictionary_word_total_definitions_ [ $+ [ $2 ] ] $addtok(%xcdictionary_word_total_definitions_ [ $+ [ $2 ] ],%individual_id,44)
            set %xcdictionary_definition_ [ $+ [ %individual_id ] ] $3-
            set %xcdictionary_definition_adder_ [ $+ [ %individual_id ] ] $nick
            set %total_up_votings_ [ $+ [ %individual_id ] ] 0
            set %total_down_votings_ [ $+ [ %individual_id ] ] 0
            set %total_definition_up_down_possible $addtok(%total_definition_up_down_possible,%individual_id,44)
            msg $chan $dcolor Definition for Word ' $+ $2 $+ ' added. Definition: $3- $+ . To see the definitions, type: !find $2 $enddcolor
            set %xcdictionary_total_definitions $addtok(%xcdictionary_total_definitions,%individual_id,44)
            set %xcdictionary_individual_id_word_ [ $+ [ %individual_id ] ] $2
          }
        }
      }
    }
  }
}

on *:TEXT:!find*:#: {
  if ($istok(%dictionary_address_banned_list,$address($nick,4),44)) { notice $nick You have banned banned from the dictionary and its functions. }
  else {
    if ($istok(%dictionary_nick_banned_list,$nick,44)) { notice $nick Your nick has been banned from the dictionary and its functions. }
    else {
      if (!$2) { notice $nick $dcolor You must add a word after the !find command! Correct Syntax: !find WORD $enddcolor }
      else {
        if (!$istok(%defined_words,$2,44)) {
          notice $nick $dcolor The definition of $2 has yet to be recorded! Add your own! $enddcolor
          notice $nick $dcolor To add your own definition, type: !define WORD [definiton] $+ . $enddcolor
        }
        else {
          notice $nick $dcolor Definitions of $2 $+ :
          var %x = $numtok(%xcdictionary_word_total_definitions_ [ $+ [ $2 ] ],44)
          var %newdefinition 0
          while (%newdefinition < %x) {
            inc %newdefinition 1
            var %superx = $gettok(%xcdictionary_word_total_definitions_ [ $+ [ $2 ] ],%newdefinition,44)
            notice $nick Definition %newdefinition $+ : %xcdictionary_definition_ [ $+ [ %superx ] ] (Added by: %xcdictionary_definition_adder_ [ $+ [ %superx ] ] $+ ) [Ratings: Up: $calc( $numtok(%total_up_votings_ [ $+ [ %superx ] ],44) - 1) . Down: $calc( $numtok(%total_down_votings_ [ $+ [ %superx ] ],44) - 1) To UP this definition, type !UP %superx $+ . To DOWN this definition, type !DOWN %superx $+ . ] 
          }
        }
      }
    }
  }
}


on *:TEXT:!up*:#: {
  if ($istok(%dictionary_address_banned_list,$address($nick,4),44)) { notice $nick You have banned banned from the dictionary and its functions. }
  else {
    if ($istok(%dictionary_nick_banned_list,$nick,44)) { notice $nick Your nick has been banned from the dictionary and its functions. }
    else {
      if (!$2) { notice $nick You must add the specific ID number after your command! Correct Syntax: !up NUMBER }
      else {
        if ($2 !isnum) { notice $nick You must add only numbers after your command! Correct Syntax: !up NUMBER }
        else {
          if (!$istok(%xcdictionary_total_definitions,$2,44)) { notice $nick That is not a proper ID number! Type !find WORD to find the right number. }
          else {
            if ($istok(%total_up_votings_ [ $+ [ $2 ] ],$nick,44)) { notice $nick You have already voted Number $2 Up! }
            else {
              if ($istok(%total_down_votings_ [ $+ [ $2 ] ],$nick,44)) { 
                set %total_up_votings_ [ $+ [ $2 ] ] $addtok(%total_up_votings_ [ $+ [ $2 ] ],$nick,44)
                set %total_down_votings_ [ $+ [ $2 ] ] $remtok(%total_down_votings_ [ $+ [ $2 ] ],$nick,44)
                msg $chan $dcolor $nick changed their vote from Down to Up for definition $2 $+ ! $enddcolor
              }
              else {
                set %total_up_votings_ [ $+ [ $2 ] ] $addtok(%total_up_votings_ [ $+ [ $2 ] ],$nick,44)
                msg $chan $dcolor $nick voted Up for definition $2 $+ ! $enddcolor
              }
            }
          }
        }
      }
    }
  }
}

on *:TEXT:!down*:#: {
  if ($istok(%dictionary_address_banned_list,$address($nick,4),44)) { notice $nick You have banned banned from the dictionary and its functions. }
  else {
    if ($istok(%dictionary_nick_banned_list,$nick,44)) { notice $nick Your nick has been banned from the dictionary and its functions. }
    else {
      if (!$2) { notice $nick You must add the specific ID number after your command! Correct Syntax: !up NUMBER }
      else {
        if ($2 !isnum) { notice $nick You must add only numbers after your command! Correct Syntax: !up NUMBER }
        else {
          if (!$istok(%xcdictionary_total_definitions,$2,44)) { notice $nick That is not a proper ID number! Type !find WORD to find the right number. }
          else {
            if ($istok(%total_down_votings_ [ $+ [ $2 ] ],$nick,44)) { notice $nick You have already voted Number $2 Up! }
            else {
              if ($istok(%total_up_votings_ [ $+ [ $2 ] ],$nick,44)) { 
                set %total_down_votings_ [ $+ [ $2 ] ] $addtok(%total_down_votings_ [ $+ [ $2 ] ],$nick,44)
                set %total_up_votings_ [ $+ [ $2 ] ] $remtok(%total_up_votings_ [ $+ [ $2 ] ],$nick,44)
                msg $chan $dcolor $nick changed their vote from Up to Down for definition $2 $+ ! $enddcolor
              }
              else {
                set %total_down_votings_ [ $+ [ $2 ] ] $addtok(%total_down_votings_ [ $+ [ $2 ] ],$nick,44)
                msg $chan $dcolor $nick voted Down for definition $2 $+ ! $enddcolor
              }
            }
          }
        }
      }
    }
  }
}

on *:TEXT:!report*:#: {
  if ($istok(%dictionary_address_banned_list,$address($nick,4),44)) { notice $nick You have banned banned from the dictionary and its functions. }
  else {
    if ($istok(%dictionary_nick_banned_list,$nick,44)) { notice $nick Your nick has been banned from the dictionary and its functions. }
    else {
      if (!$2) { notice $nick You must add the word of which you're reporting! Correct Syntax: !report WORD [comments] }
      else {
        if (!$3) { notice $nick You must add a description of what you're reporting. Add your command! Correct Syntax: !report WORD [comments] }
        else {
          if ($istok(%defined_words,$2,44)) {
            var %report_number 1
            :new
            while ($gettok(%xcdictionary_reports_number,%report_number,47)) {
              inc %report_number
              goto new
            }
            set %xcdictionary_reports_number $addtok(%xcdictionary_reports_number,%report_number,47)
            set %xcdictionary_reports_direct $addtok(%xcdictionary_reports_direct,$2-,47)
            msg $chan $dcolor Report for word $2 added: $3- $+ ! $enddcolor
          }
          elseif ($2 == GENERALREPORT) { 
            var %report_number 1
            :new
            while ($gettok(%xcdictionary_reports_number,%report_number,47)) {
              inc %report_number
              goto new
            }
            set %xcdictionary_reports_number $addtok(%xcdictionary_reports_number,%report_number,47)
            set %xcdictionary_reports_direct $addtok(%xcdictionary_reports_direct,$2-,47)
            msg $chan $dcolor A general report has been recorded: $3- $+ ! $enddcolor
          }       
          else { notice $nick That word has not been defined; therefore, there does not need to be a report on it. If you'd like to make a general report, type: !report GENERALREPORT [comments] }
        }
      }
    }
  }
}

alias viewreports {
  var %report_number2 0
  :neww
  while ($gettok(%xcdictionary_reports_number,%report_number2,47)) {
    inc %report_number2
    //echo -a $dcolor Current report( $+ %report_number2 $+ ): $gettok(%xcdictionary_reports_direct,%report_number2,47) $enddcolor
    goto neww
  }
}

on *:INPUT:#: {
  if ($1 == !nickban) { 
    if ($istok(%dictionary_nick_banned_list,$2-,44)) { /timer 1 1 //echo -a $dcolor That nick has already been banned. $enddcolor }
    else {
      set %dictionary_nick_banned_list $addtok(%dictionary_nick_banned_list,$2-,44)
      /timer 1 1 /msg $chan $dcolor The Nick Restricted List has a new addition: $2- $+ ! $enddcolor
    }
  }
  elseif ($1 == !addressban) {
    if ($istok(%dictionary_address_banned_list,$address($2,4),44)) { /timer 1 1 //echo -a $dcolor That address has already been banned. $enddcolor }
    else {
      set %dictionary_address_banned_list $addtok(%dictionary_address_banned_list,$address($2,4),44)
      /timer 1 1 /msg $chan $dcolor The Address Restricted List has a new addition: $2- $enddcolor
    }
  }
  elseif ($1 == !removeban) {
    if ($regex($2-,/\@/) == 1) { 
      if ($istok(%dictionary_address_banned_list,$2-,44)) { 
        set %dictionary_address_banned_list $remtok(%dictionary_address_banned_list,$2-,44)
        /timer 1 1 /msg $chan $dcolor The Ban of $2- has been removed! $enddcolor
      }
      else { /timer 1 1 //echo -a That ban is not listed. To view the bans, type /viewbans }
    }
    else {
      if ($istok(%dictionary_nick_banned_list,$2-,44)) {
        set %dictionary_nick_banned_list $remtok(%dictionary_nick_banned_list,$2-,44)
        /timer 1 1 /msg $chan $dcolor The Nick ban of $2- has been removed! $enddcolor
      }
      else { /timer 1 1 //echo -a $dcolor That nick ban is not listed. To view the bans, type /viewbans $enddcolor }
    }
  }
}

alias viewbans {
  //echo -a $dcolor Addresses Banned: %dictionary_address_banned_list $enddcolor
  //echo -a $dcolor Nicks Banned: %dictionary_nick_banned_list  $enddcolor
}

alias clearreport { 
  if ($gettok(%xcdictionary_reports_number,$1,44)) {
    var %part1 = $gettok(%xcdictionary_reports_number,$1,44)
    set %xcdictionary_reports_number $remtok(%xcdictionary_reports_number,%part1,44)
    var %part2 = $gettok(%xcdictionary_reports_direct,$1,44)
    set %xcdictionary_reports_direct $remtok(%xcdictionary_reports_direct,%part2,44)
    //echo -a Report of ' $+ %part2 $+ ' cleared.
  }
  else { //echo -a $dcolor You didn't select a correct number. $enddcolor }
}

alias dword {
  if ($istok(%defined_words,$1,44)) {
    //echo -a $dcolor Definitions of $1 $+ :
    var %x = $numtok(%xcdictionary_word_total_definitions_ [ $+ [ $1 ] ],44)
    var %newdefinition 0
    while (%newdefinition < %x) {
      inc %newdefinition 1
      var %superx = $gettok(%xcdictionary_word_total_definitions_ [ $+ [ $1 ] ],%newdefinition,44)
      //echo -a $dcolor Definition %newdefinition $+ : %xcdictionary_definition_ [ $+ [ %superx ] ] (Added by: %xcdictionary_definition_adder_ [ $+ [ %superx ] ] $+ ) [Ratings: Up: $calc( $numtok(%total_up_votings_ [ $+ [ %superx ] ],44) - 1) . Down: $calc( $numtok(%total_down_votings_ [ $+ [ %superx ] ],44) - 1) To UP this definition, type !UP %superx $+ . To DOWN this definition, type !DOWN %superx $+ . ]  $enddcolor
    }
  }
  else { //echo -a $dcolor That word has not yet been defined. $enddcolor }
}

alias ddelete {
  if ($1 isletter) {
    if ($istok(%defined_words,$1,44)) {
      set %defined_words $remtok(%defined_words,$1,44)
      var %word_number = $numtok(%xcdictionary_word_total_definitions_ [ $+ [ $1 ] ],44)
      var %delete_definition = 1
      while (%delete_definition <= %word_number) {
        var %ddelete = $gettok(%xcdictionary_word_total_definitions_ [ $+ [ $1 ] ],%delete_definition,44)
        unset %xcdictionary_definition_ [ $+ [ %ddelete ] ]
        unset %xcdictionary_definition_adder_ [ $+ [ %ddelete ] ]
        unset %total_up_votings_ [ $+ [ %ddelete ] ]
        unset %xcdictionary_word_total_definitions_ [ $+ [ $1 ] ]
        unset %total_down_votings_ [ $+ [ %ddelete ] ]
        unset %xcdictionary_word_ [ $+ [ $1 ] ]
        set %total_definition_up_down_possible $remtok(%total_definition_up_down_possible,%ddelete,44)
        set %xcdictionary_total_definitions $remtok(%xcdictionary_total_definitions,%ddelete,44)
        inc %delete_definition
        unset %xcdictionary_individual_id_word_ [ $+ [ $1 ] ]
        //echo -a $dcolor Definition of ' $+ $1 $+ ' has been deleted! $enddcolor
      }
    }
    else { //echo -a $dcolor Word ' $+ $1 $+ ' is not a definition. $enddcolor }
  }
  elseif ($1 isnum) {
    if ($istok(%xcdictionary_total_definitions,$1,44)) {
      var %current_deletion = %xcdictionary_individual_id_word_ [ $+ [ $1 ] ]
      if ($numtok(%current_deletion,44) == 1) { 
        set %defined_words $remtok(%defined_words,%current_deletion,44)
        unset %xcdictionary_word_ [ $+ [ %current_deletion ] ]
        unset %xcdictionary_word_total_definitions_ [ $+ [ %current_deletion ] ]
      }
      set %total_definition_up_down_possible $remtok(%total_definition_up_down_possible,$1,44)
      set %xcdictionary_total_definitions $remtok(%xcdictionary_total_definitions,$1,44)
      var %current_deletion = %xcdictionary_individual_id_word_ [ $+ [ $1 ] ]
      set %xcdictionary_word_total_definitions_ [ $+ [ $1 ] ] $remtok(%xcdictionary_word_total_definitions_ [ $+ [ $1 ] ],$1,44)
      unset %xcdictionary_definition_ [ $+ [ $1 ] ]
      unset %xcdictionary_definition_adder_ [ $+ [ $1 ] ]
      unset %total_up_votings_ [ $+ [ $1 ] ]
      unset %total_down_votings_ [ $+ [ $1 ] ]
      set %total_definition_up_down_possible $remtok(%total_definition_up_down_possible,$1,44)
      set %xcdictionary_total_definitions $remtok(%xcdictionary_total_definitions,$1,44)
      unset %xcdictionary_individual_id_word_ [ $+ [ $1 ] ]
      unset %xcdictionary_word_total_definitions_ [ $+ [ $1 ] ]
      //echo -a $dcolor Definition Number ' $+ $1 $+ ' has been deleted! $enddcolor
    }
    else { //echo -a $dcolor That is not a correct definition ID. Type /dword WORD to see the ID. $enddcolor }
  }
}

alias protectword { 
  if ($istok(%protected_words,$1,44)) { //echo -a $dcolor This word has already been protected. $enddcolor }
  else {
    set %protected_words $addtok(%protected_words,$1,44)
    //echo -a $dcolor The word ' $+ $1 $+ ' has been protected. $enddcolor
  }
}

alias listprotected {
  if (%protected_words !== $null) { //echo -a $dcolor Protected Word List: %protected_words $enddcolor }
  else { //echo -a $dcolor There are no protected words that you've set. $enddcolor }
}

alias removeprotect {
  if (!$istok(%protected_words,$1,44)) { //echo -a $dcolor The word ' $+ $1 $+ ' has not been protected. $enddcolor }
  else {
    set %protected_words $remtok(%protected_words,$1,44)
    //echo -a $dcolor The word ' $+ $1 $+ ' has been removed from the protected list! $enddcolor
  }
}