Sounds like great fun, I'll do it! heh

Edited: Try this out.
Code:
on *:text:*:#: {
  if ($1 == ?) {
    var %text = $2- =>
    %text = $read(learnt.txt, w, %text $+ *)
    ;if "this entry*" is found at the beginning of a line,
    if (%text) {
      var %term = $reptok(%text,=>,is,1,32)
      msg $chan hmm, %term
    }
  }
  if ($1 == !append) {
    var %islocation = $findtok($2-,is,1,32)
    if (%islocation) {
      var %text = $2-
      %text = $reptok(%text,is,=>,1,32)
      var %newentry = $gettok(%text,1- $+ %islocation,32)
      var %findentry = $read(learnt.txt,w,%newentry $+ *)
      var %foundentry = $gettok(%findentry,1- $+ %islocation,32)
      if (%newentry == %foundentry) {
        var %append = $gettok(%text,$calc(%islocation +1) $+ -,32)
        write -l $+ $readn learnt.txt %findentry or %append
        msg $chan Appended data.
      }
    }
  }
  if ($1 == !replace) {
    var %islocation = $findtok($2-,is,1,32)
    if (%islocation) {
      var %text = $2-
      %text = $reptok(%text,is,=>,1,32)
      write -l $+ $readn learnt.txt %text
      msg $chan Replaced entry.
    }
  }
  if ($1 == !learn) {
    var %islocation = $findtok($2-,is,1,32)
    if (%islocation) {
      var %text = $2-
      %text = $reptok(%text,is,=>,1,32)
      var %newentry = $gettok(%text,1- $+ %islocation,32)
      var %findentry = $read(learnt.txt,w,%newentry $+ *)
      var %foundentry = $gettok(%findentry,1- $+ %islocation,32)
      if (%newentry == %foundentry) {
        msg $chan Already have something for that.
      }
      else {
        write learnt.txt %text
        ;write this to a file: this entry => that info
        ;after it's done writing verify that the data did write to the file and if so have it tell you "ok".
        if ($read(learnt.txt,w,%text)) { msg $chan ok }
        else { msg $chan I pooped my pants }
      }
    }
  }
}

[12:42:53] <Sporc> !learn variable is a percent
[12:42:53] <@Scorpwanna> ok
[12:43:13] <Sporc> !learn variable is yo momma
[12:43:13] <@Scorpwanna> Already have something for that.
[12:43:25] <Sporc> !replace variable is yo momma
[12:43:25] <@Scorpwanna> Replaced entry.
[12:43:50] <Sporc> !append variable is bringing down the house
[12:43:50] <@Scorpwanna> Appended data.
[12:43:57] <Sporc> ? variable
[12:43:57] <@Scorpwanna> hmm, variable is yo momma or bringing down the house

Last edited by Scorpwanna; 22/09/06 05:46 PM.

We don't just write the scripts, we put them to the test! (ScriptBusters)