diff --git a/readme.md b/readme.md index 7917b9a..ee9bba9 100644 --- a/readme.md +++ b/readme.md @@ -12,6 +12,7 @@ Again, it's very generic. Because of that it supports pretty much anywhere that * Supports detecting areas using the mudlet mapper * Supports detecting enemies by creating temp triggers based on target names * Provides a function `bmDisable()` that will disable the basher so you can rig a flee/wimpy trigger/alias +* Can convert targets to lowercase for some weird muds that use proper casing in display but not in targetting # Can I use this on my mud? I don't know. Many muds have rules against this kind of script. Just as many muds don't care if you use a script like this. Yet more sit somewhere in the middle. It's your responsibility to know where the rules on your mud stand. diff --git a/src/aliases/bashmatic/BM_Config.lua b/src/aliases/bashmatic/BM_Config.lua index cdd2d75..df3f8e9 100644 --- a/src/aliases/bashmatic/BM_Config.lua +++ b/src/aliases/bashmatic/BM_Config.lua @@ -40,4 +40,9 @@ if Bashmatic.enemies.group then else cecho("\n-- Grouping Enemies by Areas: No") end +if Bashmatic.enemies.lowercase then + cecho("\n-- Sending Targets Lowercase: Yes") +else + cecho("\n-- Sending Targets Lowercase: No") +end cecho("") \ No newline at end of file diff --git a/src/aliases/bashmatic/BM_Configset.lua b/src/aliases/bashmatic/BM_Configset.lua index 164850d..a2da06d 100644 --- a/src/aliases/bashmatic/BM_Configset.lua +++ b/src/aliases/bashmatic/BM_Configset.lua @@ -6,7 +6,7 @@ if which == "phrase" then killTrigger(Bashmatic.death.event) end Bashmatic.death.phrase = matches[3] - Bashmatic.death.event = tempTrigger(Bashmatic.death.phrase,handleMobDeath) + Bashmatic.death.event = tempRegexTrigger(".*" .. Bashmatic.death.phrase .. ".*",handleMobDeath) cecho("Bashmatic: Reset the death event trigger phrase to " .. matches[3] .. ".") elseif which == "start" then -- starting battle command @@ -28,6 +28,14 @@ elseif which == "after" then -- after battle command Bashmatic.commands.after = matches[3] cecho("Bashmatic: Will send " .. matches[3] .. " after combat.") +elseif which == "lowercase" then + -- Converting target to lowercase in battle start command + Bashmatic.enemies.lowercase = not Bashmatic.enemies.lowercase + if Bashmatic.enemies.lowercase then + cecho("Bashmatic: Will now convert targets to lowercase in starting command.") + else + cecho("Bashmatic: Will no longer convert targets to lowercase in starting command.") + end elseif which == "group" then -- group by area if #getRooms() == 0 then diff --git a/src/aliases/bashmatic/BM_Help.lua b/src/aliases/bashmatic/BM_Help.lua index 7053412..23229e7 100644 --- a/src/aliases/bashmatic/BM_Help.lua +++ b/src/aliases/bashmatic/BM_Help.lua @@ -22,6 +22,7 @@ bmc during - commands to execute during combat. bmc duringTime - time delay between during command execution. Default 2 seconds. Wants a number. bmc after - commands to execute after the death trigger fires. bmc group - set to yes or no to toggle grouping enemies by mudlet mapper areas on or off +bmc lowercase - This will convert your target to lowercase before starting the fight (So Kill Rat becomes Kill rat) Aliases Available ----------------- diff --git a/src/scripts/bashmatic/bashmatic_init.lua b/src/scripts/bashmatic/bashmatic_init.lua index a5eb3c2..f6af3f9 100644 --- a/src/scripts/bashmatic/bashmatic_init.lua +++ b/src/scripts/bashmatic/bashmatic_init.lua @@ -14,7 +14,8 @@ Bashmatic = Bashmatic or { }, ["enemies"] = { group = false, - targets = {} + targets = {}, + lowercase = false }, ["enabled"] = false, ["bashing"] = false, @@ -24,9 +25,7 @@ Bashmatic = Bashmatic or { } function handleInstall(_, name) - if name:lower() == "Bashmatic" then - cecho("Bashmatic: Welcome to Bashmatic. See bm help to get started.") - end + cecho("\nBashmatic: Welcome to Bashmatic. See bm help to get started.") end registerAnonymousEventHandler("sysInstallPackage", handleInstall) @@ -50,7 +49,7 @@ function handleLoadEvent() end if Bashmatic.death.phrase ~= false then - Bashmatic.death.event = tempTrigger(Bashmatic.death.phrase,handleMobDeath) + Bashmatic.death.event = tempRegexTrigger(".*" .. Bashmatic.death.phrase .. ".*",handleMobDeath) end cecho("Bashmatic: Loaded settings. Let's bash some mobs.") @@ -97,6 +96,7 @@ function handleBashingMatches() killBashingTriggers() else if Bashmatic.commands.before then send(Bashmatic.commands.before) end + if Bashmatic.enemies.lowercase then keyword = keyword:lower() end send(Bashmatic.commands.start .. " " .. keyword) if Bashmatic.commands.during then tempTimer(Bashmatic.commands.duringTime,handleDuringTick) end end