Sword

By slub77 on Jan 08, 2010

Simple little snippet it just Numbers in an ini file And starts off ith the letter S.

Mike:S1
bot:S1: WAHOO this is number 1

And also a menu that tells you how many words you have gone up to say if you made it up to 30 Swords, it says well 30 .

Along side that an action for people as well !alls It is the same as the menu just tells people who asks.

As a safety precaution i have put in a limit so say you have only got 10 swords and someone asks for S15, instead of doing an infinite loop it will tell them that you have not gone that far.

So all n all it's just a snippet to note things, and then for people to see what you noted.

EDIT
[list=1]
[]Fixed the bug with it saying that the last one does is not there.
[
]Added a view word option to the menu
[/list]

on 2:TEXT:s*:*:{
  if $2 == $true  { halt }
  else {
    set %left $right($1,1)
    if %left isnum {
      var %x 1
      var %done $calc($lines(sword.ini) + 1)
      var %doneline 1
      :name

      if %doneline == %done { notice $nick Sorry we have not got up to that number yet :) }
      else {
        if $readini(sword.ini, word, $+(s,%x)) && $+(s,%x) == $1 { notice $nick  $1 : $readini(sword.ini, word, $+(s,%x)) }
        else {
          inc %x
          inc %doneline
          goto name
        }
      }
    }
    else { halt }
  }
}

menu channel {
  Swords
  .$style(2) Total Swords $lines(sword.ini) : noop
  .Add words:{
    var %a $lines(sword.ini)
    var %x $?="Enter the words for line $+(s,%a) "

    if $! = $null { echo Nothink was written }
    else {
      writeini sword.ini word $+(s,%a) $!
      echo Wrote
    }
  }
  .View Sword:{
    $?="What number would you like to see, so far you have $lines(sword.ini) Saved"
    if !$! { halt }
    else { 
      var %x 1
      var %done $calc($lines(sword.ini) + 1)
      var %doneline 1
      :name

      if %doneline == %done { echo Sorry we have not got up to that number yet :) }
      else {
        if $readini(sword.ini, word, $+(s,%x)) && %x == $! { echo  $+(S,$!) : $readini(sword.ini, word, $+(s,%x)) }
        else {
          inc %x
          inc %doneline
        goto name }

      }
    }
  }
}

on *:TEXT:!alls:*:{
  notice $nick Sword goes up to $calc($lines(sword.ini) - 1)
}

Comments

Sign in to comment.
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.