This script allows you to change where your command text is sent based on defined channels (it works really well with a tabbed chat window) ``` local Chats = { "New", "Pub", "OOC", "Auction", "Update" } SelectedMode = "None" changeCMDInput = false --capture chat line and prepend channel to beginning function controlInput(_, command) if changeCMDInput and SelectedMode ~= "None" then changeCMDInput = false --set this if check to false to it doesn't occur every input --Also set the bool check BEFORE any send() functions within a sysDataSendRequest function send(SelectedMode .. " " .. command, false) --Duplicate and unknown command denyCurrentSend() --Deny the original command, not the commands sent with sendAll. changeCMDInput = true end end --remove the chat redirection function UnregisterChatHandler() killAnonymousEventHandler(myevent) end --enable speaking only in selected channel mode function SetChatMode(ModeToSet) if (table.contains(Chats, ModeToSet)) then SelectedMode = ModeToSet else SelectedMode = "None" end changeCMDInput = true end --setup the chat function SetupChatMode() --generate aliases for all enabled chats for k, v in pairs(Chats) do local realCode = 'SetChatMode("' .. v .. '")' local StringToCheck = "^" .. "SetChatModeTo" .. v .. "$" tempAlias(StringToCheck, realCode) end --setup the disable and removal aliases tempAlias("^setChatModeToNone$", [[SetChatMode("None")]]) tempAlias("^RemoveChatMode$", [[UnregisterChatHandler()]]) --register the chat redirection event myevent = myevent or registerAnonymousEventHandler("sysDataSendRequest", "controlInput") end ```
author | jfmherokiller |
---|---|
permlink | a-script-for-mudlet-to-setup-channel-specific-chat-modes |
category | programming |
json_metadata | {"tags":["programming","technology","mudlet","lua"],"app":"hiveblog/0.1","format":"markdown"} |
created | 2020-07-07 07:21:00 |
last_update | 2020-07-07 07:21:00 |
depth | 0 |
children | 2 |
last_payout | 2020-07-14 07:21:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.076 HBD |
curator_payout_value | 0.074 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,751 |
author_reputation | 311,353,057,143 |
root_title | "a script for mudlet to setup channel specific chat modes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,385,436 |
net_rshares | 623,187,558,059 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
onealfa | 0 | 59,058,723,221 | 3% | ||
tykee | 0 | 3,016,472,865 | 50% | ||
muksihs | 0 | 2,632,746,248 | 100% | ||
kamchore | 0 | 164,847,381,593 | 100% | ||
bala41288 | 0 | 40,496,055,973 | 20% | ||
laissez-faire | 0 | 36,186,022 | 100% | ||
bleuxwolf | 0 | 273,381,167,026 | 100% | ||
limka | 0 | 52,233,534 | 100% | ||
yggdrasil.laguna | 0 | 164,255,784 | 40% | ||
gitplait | 0 | 79,502,335,793 | 100% |
Great works man. Thanks for sharing <sub> **Your post has been submitted to be manually curated by @gitplait community account because this is the kind of publications we like to see in our community.** </sub> Join our [Community on Hive](https://hive.blog/trending/hive-103590) and Chat with us on [Discord](https://discord.gg/CWCj3rw). [[Gitplait-Team]](https://gitplait.tech/)
author | gitplait-mod2 |
---|---|
permlink | re-jfmherokiller-qd38jb |
category | programming |
json_metadata | {"tags":["programming"],"app":"peakd/2020.07.1"} |
created | 2020-07-07 07:23:36 |
last_update | 2020-07-07 07:23:36 |
depth | 1 |
children | 1 |
last_payout | 2020-07-14 07:23:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 384 |
author_reputation | 28,898,670,427 |
root_title | "a script for mudlet to setup channel specific chat modes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,385,460 |
net_rshares | 959,178,666 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
jfmherokiller | 0 | 959,178,666 | 100% |
What suprised me the most was that I was able to "construct" regex strings manually before passing them to the function
author | jfmherokiller |
---|---|
permlink | qd38q4 |
category | programming |
json_metadata | {"app":"hiveblog/0.1"} |
created | 2020-07-07 07:27:54 |
last_update | 2020-07-07 07:27:54 |
depth | 2 |
children | 0 |
last_payout | 2020-07-14 07:27:54 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 119 |
author_reputation | 311,353,057,143 |
root_title | "a script for mudlet to setup channel specific chat modes" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 98,385,532 |
net_rshares | 0 |