Hash Replace /hrep

By MoshMage on Mar 08, 2011

for attempting porpuses. it seems /hadd already does it.

alias hrep {
  if ($0 >= 3) {
    if ($hget($1,$2).item == $3-) return 0
    else {
      if ($hget($1,$2)) hdel $1 $2
      hadd $1 $2 $3
      return 1
    }
  }
  else return 0
}

Comments

Sign in to comment.
MoshMage   -  Mar 09, 2011

failed silently, tho that code does work

 Respond  
jaytea   -  Mar 08, 2011

does it throw an error or fail silently?

what does the following produce on your mIRC:

//!hadd -m a a a | !echo -a -> $hget(a, a) | !hadd a a b | !echo -a -> $hget(a, a)
 Respond  
MoshMage   -  Mar 08, 2011

Somehow that is not happening here, god know why. otherwise i wouldnt have "all that trouble". but yeah, i must've fast forward the mIRC help thingy.

Still, doesn't happen to replace the hash item value on my mirc version

 Respond  
Jethro   -  Mar 08, 2011

I second Firstmate's notion. Nice experiment you've attempted, Mosh.

 Respond  
Firstmate   -  Mar 08, 2011

When you use:

/hadd [table] [item] [value]
If an item with the same name already exists, mIRC will automatically replace it with the new value.

From the help file:

If the item you are adding already exists, the old item is replaced.

That being said, this is not an identifier. So you really don't need to place return statements. Rather, /echo out Invalid parameters or some other suitable error.

 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.