mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2012
Posts: 9
G
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Apr 2012
Posts: 9
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)
HALT
}
}

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)?

Joined: Feb 2011
Posts: 448
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 448
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


Code:
; 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
    halt
  }
}

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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.


Link Copied to Clipboard