/help on input

To allow replacing the text anywhere in a message:
Code:
on *:input:#: {
  var %message = $replacex($1-,brb,Be right back,ty,Thank you,wb,Welcome back)
  msg $chan %message
  halt
}


An alternative if you only want to replace the text if it's the only thing typed:
Code:
on *:input:#: {
  if ($1 == brb) { msg $chan Be right back }
  elseif ($1 == ty) { msg $chan Thank you }
  elseif ($1 == wb) { msg $chan Welcome back }
  halt
}


Yet one more option similar to the first that limits it to only when you type the one thing:
Code:
on *:input:#: {
  if (!$2) {
    var %message = $replacex($1,brb,Be right back,ty,Thank you,wb,Welcome back)
    msg $chan %message
    halt
  }
}


There are a variety of other methods as well, depending on how many "words" you want to add. If you wanted to have hundreds of these, you could set it up in a hash table or INI file to greatly improve the script, for example. But if you're only using 10 or even 20, then these should work fine for what you're doing.

* Be aware that the $replacex() examples will replace any occurrence of the "word" even if it's not by itself. For example, "ty" is common in other words, such as "Capacity". These $replacex() examples would end up changing that to "CapaciThank you", which is obviously not what you'd want. I would recommend not using these examples with "ty" or any other combination of letters that are likely to be in your text. Things like brb and wb are fine. If you want to include the other items, you'll be better off with regex or using example 2.


Invision Support
#Invision on irc.irchighway.net