mIRC Home    About    Download    Register    News    Help

Print Thread
#243253 02/11/13 01:39 PM
Joined: Nov 2013
Posts: 21
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Nov 2013
Posts: 21
I was just wondering is there a way to make a command, that wehn used makes a new command, for example "!command new (name of command here)=(What the command will say)", so if i said "!command new !happy=/me is now happy", it would make that command

Joined: Oct 2013
Posts: 10
S
Pikka bird
Offline
Pikka bird
S
Joined: Oct 2013
Posts: 10
This is what I have for adding commands. It is Twitch mod only but that can be removed. also, instead of using ! for the identifier, it uses #. So it would be #add !ex This is example text.
Code:
;----------------
;| Mod Commands |
;----------------
on *:text:#*:#: {
  if (ismod) {
    if ($1 == #add) {
      if ($0 < 3) { msg # Insufficient parameters: Use #add !<command name> <text> | return }
      writeini -n cmds.ini $+(#,.,$2) text $3-
      /msg # go away
    }
    elseif ($1 == #lock) {
      if ($0 < 2) { msg # Insufficient parameters: Use #lock !<command name> | return }
      writeini -n cmds.ini $+(#,.,$2) lock 1
      /msg # Command $2 has been locked. This is irreversable. Please contact Matt/LTM to have it unlocked.
    }
    elseif ($1 == #edit) {
      if ($0 < 3) { msg # Insufficient parameters: Use #edit !<command name> <text> | return }
      var %lock $readini(cmds.ini,$+(#,.,$2),lock) 
      if (%lock == 1) {
        /msg # Can not edit locked messages.
      }
      else {
        writeini -n cmds.ini $+(#,.,$2) text $3-
        /msg # Edited $2 to $3-
      }
    }
    elseif ($1 == #delete) {
      var %lock $readini(cmds.ini,$+(#,.,$2),lock) 
      if (%lock == 1) {
        /msg # Can not remove locked messages.
      }
      else {
        /remini cmds.ini $+(#,.,$2)
        /msg # Command $2 has been removed.
      }
    }
  }
  else {
    /msg # $nick $+ , you do not have permission to use mod commands.
  }
}

Joined: Nov 2013
Posts: 21
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Nov 2013
Posts: 21
Thank you but this did not work for me, firstly when i did it it just said back to me go away, but then even when i tried to use the command nothing happened, then i thought it might be because of the new file that it made, the cmds.ini file, so i tried to load that, but when that was in mIRC nothing came up in it, but when i opened the file it said

[#allsport54.!test]
text=This is a Test

Joined: Oct 2013
Posts: 10
S
Pikka bird
Offline
Pikka bird
S
Joined: Oct 2013
Posts: 10
Haha I thought I edited the go away thing before I posted it.

Try this
Code:
on *:text:!*:#: {
  var %get $+(#,.,$1)
  var %name $1
  var %text $readini(cmds.ini,%get,text)
  if (!%text) {
    /msg # No such command available.
  }
  else {
    if (%flood3) { return }
    set -u30 %flood3 On
    /msg # %text
  }
}

;----------------
;| Mod Commands |
;----------------
on *:text:#*:#: {
  if (ismod) {
    if ($1 == #add) {
      if ($0 < 3) { msg # Insufficient parameters: Use #add !<command name> <text> | return }
      writeini -n cmds.ini $+(#,.,$2) text $3-
      /msg # $2 command added as $3-
    }
    elseif ($1 == #edit) {
      if ($0 < 3) { msg # Insufficient parameters: Use #edit !<command name> <text> | return }
      writeini -n cmds.ini $+(#,.,$2) text $3-
      /msg # Edited $2 to $3-
    }
    elseif ($1 == #delete) {
      /remini cmds.ini $+(#,.,$2)
      /msg # Command $2 has been removed.
    }
  }
}
else {
  /msg # $nick $+ , you do not have permission to use mod commands.
}

It adds the bit where it looks for the ! at the beginning of text and then compares it with the command. I thought you had this already but I guess not.

If the wording is not to your liking, you can always edit it.

Joined: Nov 2013
Posts: 21
A
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Nov 2013
Posts: 21
okay thank you soo much i will test it right now

EDIT: just tested it works great thanks

Last edited by AlphaKennyHuan; 04/11/13 07:03 PM.

Link Copied to Clipboard