STAR TREK 2d20
  1. #1

    Updating Old Extension - Issue with Slash Commands

    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
    Code:
    <?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
    Code:
    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

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    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".
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Thanks, Trenloe!

    It was the slashes all along.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in