Table of Contents

Using the News System

Add an article to the news system

For the news system to display anything you'll have to feed it with articles, obviously related to your script. As an example when one of your ship is destroyed, or when you have built a new station. This is done by calling the plugin.sk.ecs.news.add script.

It needs 4 parameters :

It should return [TRUE] is everything is Ok. If will however return null if ECS can't find the script registered with this plugin.id.

Example

When one of my pirate base is attacked it will call it like this

$result = call script 'plugin.sk.ecs.news.add' 
    plugin.id   = 'anarkis.pirate.plugin'
    news.title  = 'Pirate Base under attack'
    news.content= 'This pirate base is currently under attack we need help'
    news.from   = [THIS]

Of course you can/should use variables instead of strings. and use readtext and sprintf commands to format your strings the way you want. ECS will automatically add the date at the end of your news.

Display the News System

Now that we have the news system filled with some articles, let's display the whole thing. It's as easy as calling plugin.sk.ecs.news.display.

Only one parameter :

$result = call script 'plugin.sk.ecs.news.display' plugin.id = 'anarkis.pirate.plugin'

When called it will show a nice looking menu with the latest items in chronological order, selecting a news a pressing enter will display the content in the same window.

Cleaning the news system

If for a reason or another you want to clear the newslist, call plugin.sk.ecs.news.clear. Here again, only one parameter

$result = call script 'plugin.sk.ecs.news.clear' plugin.id = 'anarkis.pirate.plugin'