Anarkis Gaming Wiki

Documentation Center for our games and mods

User Tools

Site Tools

[ Wiki Home ] - [ Anarkis Gaming Studio ] - [ Forums ] - [ Unending Galaxy Manual ]


ecs:news_system

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 :

  • plugin.id : The global variable you used to register (string)
  • news.title : News Title (string)
  • news.content : Main text of the news (string)
  • news.from : Who is sending this message (optional)

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 :

  • plugin.id : The global variable you used to register (string)
$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

  • plugin.id : The global variable you used to register (string)
$result = call script 'plugin.sk.ecs.news.clear' plugin.id = 'anarkis.pirate.plugin'
ecs/news_system.txt · Last modified: 2014/04/26 13:25 (external edit)