View Full Version : Reskinning version notification

May 28th, 2012, 17:02
With reference to Trenloe's earlier post in the RMC forum:

I've also found it quite handy to add a startup message to the chat window (so you know which extensions are loaded - and which versions) when you start. Good for us checking what version we're running and also good for other's reporting issues!

It's pretty simple code, create a new .lua file (I usually call it "manager_extension.lua"), put the following onInit function in the file and call this file in the scripts section of your extension.

function onInit()
--Send extension startup text
RMCConstants.CopyrightText[#RMCConstants.CopyrightText+1]="*** Put your startup text here! ***";
Using #RMCConstants.CopyrightText+1 will add this to any existing copyright text and so allow multiple extensions to all add their own startup text to the chat window.

I've successfully completed an extension to modify the look of my CoC ruleset and, in a similar vein to the RMC ruleset extension I've begun, I wanted to display the version of my CoCskin in the chat box on start up. Unfortunately... I'm stumped.
I think it has something to do with the "addmessage instruction" as used in the chatmanger lua, but whilst I can call my cocskin.lua in the cocskin extension.xml, I cannot figure out what to put after function oninit(). Clever people... help!

Thanks in advance,

May 28th, 2012, 18:11
ChatManager.addMessage(...) I think

Moon Wizard
May 28th, 2012, 21:54
The chat manager master script for the ruleset needs to support the ability to register notification messages. I'm guessing that CoC does not have at this point, but could potentially be added by building an extension that uses the original CoC chatmanager script, and adds the launch notifications from 3.5E/4E.


May 28th, 2012, 22:40
Thank you Valarian for your advice. I did try your idea, but to no avail.
I will try to figure out your suggestion tomorrow moon wizard. Again, thank you.

June 1st, 2012, 15:41
Thank you Valarian for your advice. I did try your idea, but to no avail.
I will try to figure out your suggestion tomorrow moon wizard. Again, thank you.
I don't have the CoC ruleset so can't give specific advice. But, do a search in the ruleset for some of the copyright text that comes up when CoC starts (perhaps "trademark of Chaosium") and see how it is being displayed on startup. This will give you an idea of what to do in your extension.

Note: Use a text editor like Notepad++ to "find in files". If the CoC ruleset is in a .pak file you'll need to unzip it first.

June 2nd, 2012, 06:12
Thanks Trenloe for the excellent suggestion, unfortunately I have already tried that very method. Using the "find in folder" function I sort of unravelled where everything was connected, and tried various methods, from simply adding another start up "copyright message" to the add message lua script, to modifying one of the existing copyright messages in an attempt to gain some insight.
In short, I've put my ambition to see one side for the moment, but I'm still determined.
From what Moon_wizard was suggesting, I'm inclined to agree that the mere functionality of adding any additional text to the chat box just hasn't been allowed for.
The 3.5 launcher notification functionality is another lesson in lua yet to be understood, but it's good fun and not a priority, so I'll come back to it.

June 2nd, 2012, 09:19
I had a try this morning and have attached a couple of extensions for you. The first one is how I thought it would work, using the existing chat manager to add the message and just creating a script that would call it. This, as you found, doesn't work.

The second overrides the whole of the chat manager script, adding in the additional message. This is what MoonWizard was suggesting and does work.

June 2nd, 2012, 17:17
Wow! You're a gentleman Valarian. Thank you very much. I will try to understand what it is you have done, so you've not only provided me with a solution, but afforded me the opportunity to increase my understanding as well.
Thanks to everyone.