send command to command line

Posted by Aardwanderer on Thu 20 Nov 2025 01:32 AM — 4 posts, 3,613 views.

#0
I am having issues sending a command to the command line.

I have Auto-repeat Command on and I use it quit often, so I don't want to turn it off. The issue I'm having is that the functions: DoAfterSpecial(.1, "", sendto.command) and SetCommand("") don't seem to work if there is already text in the command line. I confirmed that they do work if the command line is empty. I also tried creating a trigger and an alias with send_to="1" with the same result (worked if Auto-repeat Command is off, but not when on).

I tried inserting: SetOption("auto_repeat", 0) before the above functions hoping that would let them overwrite the command line text, but that didn't work.

Is there a command that will clear the command line or something I'm missing so those commands would work even with Auto-repeat Command on?

Here is my alias:

  <alias
   match="mgt *"
   enabled="y"
   group="mapper_alias"
   send_to="12"
   sequence="100"
  >
  <send>
  if "%1" == "mob" then
    Execute("mapper goto 1234")
    Execute("where mob")
    DoAfterSpecial(.1, "kill mob", sendto.command)
    --SetCommand("kill mob") --should do the same as line above, but without the .1 wait
  else
    Execute("mapper goto %1")
  end --if
  </send>
  </alias>
Amended on Thu 20 Nov 2025 03:24 AM by Aardwanderer
USA Global Moderator #1
This is the documented behavior of SetCommand. Try instead using SetCommandSelection followed by PasteCommand.
#2
Thank you for the response. I indeed did not read the page for SetCommand() carefully.

With those commands, I was able to get my script to work. However, I wasn't able to get them to work directly. Instead, I had to combine them with DoAfterSpecial(). I am using these inside a plugin not directly in Mushclient.


<alias
   match="mgt *"
   enabled="y"
   group="mapper_alias"
   send_to="12"
   sequence="100"
  >
  <send>
  if "%1" == "mob1" then
    Execute("mapper goto 12345")
    DoAfterSpecial(.1, "SetCommandSelection (1, -1)", sendto.script)
    DoAfterSpecial(.1, "s = PasteCommand ('kill mob1')", sendto.script)
  else
    Note("Error in 'mgt *' alias")
  end
 </send>
 </alias>

The above works.

I'm unsure why, but the following does not work.

<alias
   match="mgt *"
   enabled="y"
   group="mapper_alias"
   send_to="12"
   sequence="100"
  >
  <send>
  if "%1" == "mob1" then
    Execute("mapper goto 12345")
    SetCommandSelection (1, -1)
    PasteCommand("kill mob1")
  else
    Note("Error in 'mgt *' alias")
  end
 </send>
 </alias>


I tried removing the 'mapper goto' command to see if there was a delay issue, but that was not the case. The below only works after the .3 second pause, again, not sure why not unless using DoAfterSpecial().

<alias
   match="pc test"
   enabled="y"
   group="mapper_alias"
   send_to="12"
   sequence="100"
  >
  <send>
    SetCommandSelection (1, -1)
    PasteCommand("kill mob1")
    Note("command: 'kill mob1' entered?")
    DoAfterSpecial(.3, "SetCommandSelection (1, -1)", sendto.script)
    DoAfterSpecial(.3, "PasteCommand ('kill mob1')", sendto.script)
  </send>
</alias>

Again, thank you for your help.
Amended on Tue 02 Dec 2025 08:47 PM by Aardwanderer
USA Global Moderator #3
Just remember that stacking a combat command after a movement command is not allowed on Aardwolf, so your movement had better be complete before you hit enter again.