User Tag List

  • Crazy
  • Cool
  • Awesome
  • Angry
  • Happy
  • Hungry
  • Sad
  • Shy
  • Tired
  • Results 1 to 4 of 4

    Thread: for scripters: How to create events for the news system in XTC

    1. #1
      TXU Ultra Hero Trickmov's Avatar
      Credits
      132.99
      Points
      6,217
      Total Contributions For

      Trickmov      £ 0.00
      Main Info Status and Things Points and Credits Other
      This user has no status.
       
      I am:
      Happy
       
      Join Date
      20-04-2009
      Location
      Germany
      Posts
      1,225

      Default for scripters: How to create events for the news system in XTC

      How to create events for the newssystem in XTC



      1. First you have to have your script, which can do, whatever you want, but

      a) it should not run in a loop (the AL-Event-Handler will do that)
      b) it should have several waits included, to prevent timing problems with other tasks


      2. To include your script into the AL-Event-Handler, you will have to run plugin.XTC.Lib.Events.GetID.
      This will return you an ID for your script.


      3. Next step is to add your script with plugin.XTC.Lib.Events.Add

      the arguments are
      a) the previously obtained id
      b) the name of your script (string)
      c) the frequency (that can be random, once (for things that be executed only one time), or minutes (int))

      Ok, that's all, the AL-Event-Handler will execute now your script as specified in the frequency. Best place to do step 2 and 3 is in the setup-script.


      4. To show a fitting GNS-article, your script has to include an own text as article.

      a) run plugin.news.getid to get an ID for your article
      b) run plugin.news.add.news to add the article (for that you need several things aside from the id, as the sector or the race where the article has to be shown, the title of the article (string), the article itself (string), priority (unused atm), if the article shall vanish as soon the player has read it (show only one time/boolean), the maximum time to show the article (seconds/int) - the other options are optional (used for buttons inside the GNS - refer to the GNS-manual for that)).



      The short information given here, doesn't reflect all possibilities, refer to the GNS-documentation in the download for that purpose.

      5. [OPTIONAL] eventually your script will want to include bounties for killing one/some specified ship(s). For that purpose an own bounty-lib exists, usage similar easy to the above:


      plugin.XTC.Lib.Bounty.GetID to get an specific ID
      plugin.XTC.Lib.Bounty.Add to include the bounty, with informations like sector[-array], race, ships[-types/-classes], reward, time period of validity, author of the claiming message

      Have a look into plugin.XTC.Event.Invasion to get an example.

      Aside from this it should be mentioned, that all three scripts give the ability to remove the included thing by hand (not only automatic)... plugin.news.remove.news, plugin.XTC.Lib.Bounty.Remove and plugin.XTC.Lib.Events.Remove. Usage easy with just one argument: ID.
      While it's not necessary to remove by hand, it can be useful for removing included things on specific timing



      @moderators: I know, this isn't the right place for that - but I don't see a better fitting one, thus feel free to move or sticky it, if you wish

      Last edited by Trickmov; 14-02-2011 at 07:51 AM. Reason: added note about bountysystem
      Likes Sniper101 liked this post

    2. #2
      TXU New Member Obi1k's Avatar
      Credits
      25.55
      Points
      232
      Total Contributions For

      Obi1k      £ 0.00
      Main Info Status and Things Points and Credits Other
      This user has no status.
       
      I am:
      ----
       
      Join Date
      21-12-2010
      Posts
      31

      Default

      Could you perhaps add a short example of what a typical news script would look like? I've been thinking of maybe writing some generic articles for the news.


    3. #3
      TXU Legend Eliah's Avatar
      Credits
      6,618.74
      Points
      11,496
      Total Contributions For

      Eliah      £ 0.00
      Main Info Status and Things Points and Credits Other
      This user has no status.
       
      I am:
      Shy
       
      Join Date
      14-02-2007
      Location
      Sweden
      Posts
      3,095

      Default

      Generic articles aren't events. The GNS release topic (findable on txu and ES) should have information on that

      Thanks Obi1k, Trickmov thanked for this post

    4. #4
      TXU Ultra Hero Trickmov's Avatar
      Credits
      132.99
      Points
      6,217
      Total Contributions For

      Trickmov      £ 0.00
      Main Info Status and Things Points and Credits Other
      This user has no status.
       
      I am:
      Happy
       
      Join Date
      20-04-2009
      Location
      Germany
      Posts
      1,225

      Default

      Yeah, as Eliah said, generic articles are different from dynamic "event"-ones. For generic ones, in principle all you need is a textfile (in the right format) and a short setup-script to include your textfile.

      All described in the GNS-documentation, which I linked above.

      Thanks Obi1k thanked for this post

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •