mIRC Home    About    Download    Register    News    Help

Print Thread
#261073 26/07/17 04:07 AM
Joined: Sep 2016
Posts: 33
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Anyone have a !addcom !delcom and !editcom script that works with $2 $nick etc?

Joined: Jan 2017
Posts: 57
Babel fish
Offline
Babel fish
Joined: Jan 2017
Posts: 57
Assuming that "com" is "command",

and assuming that users can pick their command,

and assuming each user only gets one command,

and assuming you only want the command to return plain text,

This code will write to CustomCommands.ini and will reply with the saved command when prompted with "!cc" or "!customcommand".

You can optionally specify to use someone else's command.

For !delcom, only the user with a nick named Predatorfusion can delete a custom command that is not their own.
i.e., DarthVader can only delete DarthVader's custom command, but Predatorfusion can delete DarthVader's command AND DarthMaul's command.

As for "!editcom", you can just re-submit !addcom and it will overwrite the old command.

Code:
on *:TEXT:!c*c*:#: {
  if ($1 == !customcommand || $1 == !cc) {
    set %temp $nick
    if ($2) { set %temp $2 }
    msg $chan /me $readini(C:\FilePath\CustomCommands.ini, Commands, %temp)
  }
}

on *:TEXT:!addcom*:#: {
  writeini C:\FilePath\CustomCommands.ini Commands $nick $2-
}

on *:TEXT:!delcom*:#: {
  if ($nick == Predatorfusion) {
    remini C:\FilePath\CustomCommands.ini Commands $2
  }
  else {
    remini C:\FilePath\CustomCommands.ini Commands $nick
  }
}

KubosKube #261235 20/08/17 02:54 PM
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
Watch out for the tricky Mike


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard