Command Spam Prevention
Posted: Tue May 23, 2023 11:49 am
Maybe I'm reinventing the wheel but I could not find an option like in mushclient that sends another command after 'x' number of similar commands. This is for some MUD's that kick you out after repeating a command 30 or 50 times etc. So I figured I would make an alias that captures anything sent and checks if it is the same.
This works fine except it will cause any other alias command to be repeated. Is there some way to write a check for another alias without having to write a bunch of if statements for each alias that might be used?
current alias code is:
pattern: (.+)
command_count is a function:
This works fine except it will cause any other alias command to be repeated. Is there some way to write a check for another alias without having to write a bunch of if statements for each alias that might be used?
current alias code is:
pattern: (.+)
Code: Select all
currentCommand = matches[2]
if currentCommand == lastCommand then
command_count(1)
else
command_count(0)
end
lastCommand = currentCommand
send(matches[1],false)
Code: Select all
function command_count(counter)
if commandCountKill == nil then
commandCountKill = 1
end --if
if counter == 0 then
commandCountKill = 0
end --if
commandCountKill = commandCountKill + counter
if commandCountKill >= 28 then
send("look")
commandCountKill = 1
end --if
end --fxn