3

I would like to program my mIRC bot so every time someone writes "W" in the chat, the bot simulates the W key on my keyboard.

I have tried:

on *:text:W:#:sendkeys {W}
alias sendkeys var %a = $ticks
 .comopen %a WScript.Shell | if !$comerr {
 .comclose %a $com(%a,SendKeys,3,bstr,$1-) 
}

This doesn't seem to be working. Any advice?

user1172897
  • 99
  • 1
  • 4
  • 8

1 Answers1

1

The code is fine, the blocks in which you execute that code are incorrect. Due to a lack of brackets, your alias will only execute the var command, and be done after that.

Taken from the mIRC help files:

The { } brackets: You can create multi-line scripts by using the { } brackets. This allows you to create an alias which performs several commands.

alias sendkeys {
  var %a = $ticks
  .comopen %a WScript.Shell
  if !$comerr {
    .comclose %a $com(%a,SendKeys,3,bstr,$1-) 
  }
}
Patrickdev
  • 2,341
  • 1
  • 21
  • 29