mIRC Homepage
Posted By: Predatorfusion (Twitch) Help - 26/07/17 04:07 AM
Anyone have a !addcom !delcom and !editcom script that works with $2 $nick etc?
Posted By: KubosKube Re: (Twitch) Help - 20/08/17 02:47 PM
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
  }
}
Posted By: Wims Re: (Twitch) Help - 20/08/17 02:54 PM
Watch out for the tricky Mike
© mIRC Discussion Forums