mIRC Homepage

replacing script needs revision

Posted By: geejeeNL

replacing script needs revision - 26/09/12 08:33 AM

Hi, im using this script for a long time, but on the latest version(s) of mIRC it doesn't work well anymore:

on *:INPUT:*: {
IF ($left($1,1) != /) {
msg $active $replace($1-,brb,Be Right Back,lol,Laughing Out Loud,jk,Just Kidding)

The problem is that the command filter on the beginning gives a faillure. Also i want to add 2 more options to this script:
1. Is it possible to add a ctcp action to another client when a replacing of words has taken place?
2. Is it possible to use an external .txt or .ini file where the replacing words are stored (trigger word v.s. replacing word)?
Posted By: KindOne

Re: replacing script needs revision - 29/09/12 06:58 AM

Load this in a new script under remote tab. Allow it to initiate.

This is designed for your 2nd request, store contents into a .txt file.

Really really crude crash course on how to add words:

/hadd <name> <item> <data>

/hadd words brb Be Right Back

<name> == words
<item> == brb
<data> == Be Right Back

The <item> can't have spaces.

This script basically replaces the <item> with <data>.

See: /help /hadd

; Syntax to add more words:
; /hadd words brb Be Right Back

on *:start:{ 
  if (!$hget(words)) { 
    hmake words 200
  if ($isfile(words.txt)) {
    hload words words.txt  

on *:unload:{ 
  if ($hget(words)) {
    ; Save words..
    hsave words words.txt
    hfree words

on *:exit:{ 
  ; Save words..
  hsave words words.txt

on *:input:*:{ 
  ; Don't trigger on command that begin with "/" or 
  ; when "CTRL+ENTER" is pressed.  
  if ($left($1,1) != /) && (!$ctrlenter) {
    var %x = 1
    var %y = $numtok($1-,32)
    var %temp = $1-
    while (%y) {
      var %a = $gettok($1-,%y,32)
      if ($hfind(words,%a)) {
        var %b $numtok($hget(words,%a),32) - 1
        var %temp = $puttok(%temp,$hget(words,%a),%y,32)
        inc %b
      dec %y
    msg $active %temp
Posted By: Tomao

Re: replacing script needs revision - 29/09/12 04:31 PM

The if condition to check if the hash table exists isn't needed because one has to reopen or restart mIRC for the start event to be activated. A Hash table is merely obliterated upon closing or existing mIRC.

Also, the $hfind() command can do the wildcard searching instead of go the extra mile with $gettok, $puttok and a while loop...

This is my constructive criticism; in no way do I intend to be cynical to comment on your approach in the code provided.
© 2020 mIRC Discussion Forums