PDA

View Full Version : Updating Old Extension - Issue with Slash Commands



tdewitt274
June 7th, 2020, 20:28
Hello, All

I was digging back through some old code and trying to get it to work. Sadly, it's from back in 2011 and I think there were some changes along the line. I was wondering if someone could help me get my slash commands working again.

extension.xml


<?xml version="1.0" encoding="iso-8859-1"?>
<root version="3.3" logo="images/pack_logo_mini.png">
<announcement text="Generic Extention, use '/pack' to start." font="emotefont" icon="logo"/>
<properties>
<name>Pack</name>
<version>0.1.20110108</version>
<author>tdewitt274</author>
<description></description>
<ruleset>Any</ruleset>
</properties>
<base>
<icon name="logo" file="images/pack_logo_mini.png" />
<script name="packSlashCommands" file="scripts/packchatmanager.lua" />
<includefile source="graphics.xml" />
<includefile source="pack.xml" />
<script>
</script>
</base>
</root>


packchatmanager.lua


function printMessage(text, sender, icon, diemodifier)
local msg = {font = "systemfont"};
msg.text = text;
msg.sender = sender;
msg.icon = icon;
msg.diemodifier = diemodifier;
Comm.addChatMessage(msg);
end
function packHelp()
printMessage("Commands:");
end
function onInit()
Comm.registerSlashHandler("/pack",packHelp);
registerSpecialMsgHandler("pack",packHelp);
end


I changed up the old "ChatManager" to the "Comm", but I can't seem to get the desired info to display in the chat. All I get is the standard "/help" message. It used to work, a decade ago, but I can't seem to find the appropriate search terms to get it to work.

Any help is appreciated!

Thanks!
Todd

Trenloe
June 7th, 2020, 20:49
Do a find in files for "registerSlashHandler" in any of the recent rulesets to get examples. The scripts\manager_chat.lua script file in CoreRPG will give you a few. I think the key thing is not to have the / - so use "pack" not "/pack".

tdewitt274
June 7th, 2020, 21:41
Thanks, Trenloe!

It was the slashes all along.