Hash Acronym

By GlobalAnomaly on Aug 18, 2009

Not completely sure if the entire script works, but here.

Commands:

/acroadd [acronym] [meaning]
/acrodel [acronym] [meaning]
/acrostart (This is only if for some reason the files don't load on start.)

I got some of the code from http://www.mirc.net/tutorial/hash[1064732500].php

This is my first hash table script thing, lol.

Positive feedback only.

;Got some of the script from http://www.mirc.net/tutorial/hash[1064732500].php since I referred to that while learning hash.
;The majority of the on input I got from the above link :(

;Easy stuff?
on *:load: {
  if (!$isfile(Acronyms.hsh)) { echo -s Type /acrostart to "install" the script. | halt }
  echo -s Acronym file previously loaded. will use that..
  hload acro Acronym.hsh
}
alias acrostart {
  if (!$isfile(Acronyms.hsh)) {
    .hmake acro 10
    .hadd acro brb Be Right Back!!
    .hadd acro bbl Be Back Later!!
    .hadd acro gtg Got To Go!!
    .hadd acro afk Away From Keyboard!!
    echo -s Acronym system installed. Type /acrocommands to get a list of commands.
    halt
  }
  else {
    echo -s File already exists!
    halt
  }
}
alias acrocommands {
  echo -s 7/acroadd [acronym] [what the acronym stands for] 1To add a new acronym.
  echo -s 7/acrodel [acronym] [value]1 To delete an existing acronym
 }
alias acroadd {
  if ($hget(acro,$strip($2-))) { echo -s $1 already exists! | halt }
  .hadd acro $strip($1) $strip($2-)
  echo -s Acronym $strip($1) added with the value $strip($2-) $+ .
  .hsave acro Acronyms.hsh
}
alias acrodel {
  echo -s acro $2 deleted.
  .hdel acro $strip($1) $strip(2-)
  .hsave acro Acronyms.hsh
}
alias acronym.init {
  .hadd acro brb Be Right Back!!
  .hadd acro bbl Be Back Later!!
  .hadd acro gtg Got To Go!!
  .hadd acro afk Away From Keyboard!!
}

on *:start: {
  .hmake acro 10
  if ($isfile(Acronyms.hsh)) {
    .hload acro Acronyms.hsh
  }
  else {
    acronym.init
    .hsave -o  acro Acronyms.hsh
  }
}
on *:exit: {
  .hsave -o acro Acronyms.hsh
  .hfree acro
}
;Now for the complicated stuff?
on *:input:*: {
  if ($left($1, 1) !isin $+(/,$readini($mircini, text, commandchar))) {
    var %w = 1
    var %text
    var %acro = ~<acro>~
    while ($gettok($1-, %w, 32)) {
      var %word = $ifmatch
      if ($hget(acro, %word) != $null) { var %text = %text $replace(%acro, <acro>, $ifmatch) }
      else var %text = %text %word
      inc %w
    }
    msg $active %text
    halt
  }
}

Comments

Sign in to comment.
Korvin   -  Aug 19, 2009

everyone stfu dont be stupid and use tutorials. bottom line

 Respond  
GlobalAnomaly   -  Aug 19, 2009

It isn't his script though, lol. I gave credit where it was due (the on input part)

this is ripped, its from a tutorial on another website i saw, and I KNOW ITS THIS ONE.

ripping is lame.

Not true. at all. Ripping is claiming code that is not yours.

I got some of the code from http://www.mirc.net/tutorial/hash[1064732500].php

I obviously GAVE THE URL TO THAT VERY TUTORIAL AND GAVE IT CREDIT ON WHAT I GOT FROM IT

and..

At least 25% of the code must be written by you.

The majority of the code is mine. Even using code fro the tutorial I CLEARLY STATED I USED I edited that a bit as well. credit is given to who it belongs as well as over 25% of the code being written by me.

Maybe you'll think and actually read the introduction AND THE FIRST TWO LINES OF THE CODE before you go off saying I ripped.

This script should've clearly noted 'By the courtesy of KingTomato, I hereby present you his script with some modification of my idea. All credits go to the original author.'

Why would I give the owner of the tutorial credit for something that is primarily mine? Again...I already gave him credit when it was due.

 Respond  
Jethro   -  Aug 19, 2009

This script should've clearly noted 'By the courtesy of KingTomato, I hereby present you his script with some modification of my idea. All credits go to the original author.'

 Respond  
Korvin   -  Aug 19, 2009

if youd read the description, youd see that he gave credit.

 Respond  
xplo   -  Aug 19, 2009

this is ripped, its from a tutorial on another website i saw, and I KNOW ITS THIS ONE.

ripping is lame.

 Respond  
GlobalAnomaly   -  Aug 18, 2009

I was looking at that earlier :P I might try it later on tonight. I moved on to a vivid discussion on Pokemon Games..

-edit-

I think some of this script is original to me, anyways..Not really but at least I didn't copy/paste it and claim it as mine xD..And I gave credit when due :(

 Respond  
Korvin   -  Aug 18, 2009

original is best, don't go taking ideas, anyways, you should work in my Hash Protection then you wouldn't lose your hash on restart

 Respond  
GlobalAnomaly   -  Aug 18, 2009

I figured acronyms would be easy, lol. I wasn't looking for original, just easy. I'll try original when I get better :P

 Respond  
Korvin   -  Aug 18, 2009

the thing about hash is that it all gets deleted when you restart your computer, other than that i guess good for your first try, wouldve been better if you did it on your own, or came up with an original idea.

 Respond  
GlobalAnomaly   -  Aug 18, 2009

Meh. It is what it is >_>

 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.