Home

Module evt

Event system Lua bindings. An example would be:
 evt.finish() -- finishes the event
 

Functions

evt.claim (systems) Tries to claim systems.
evt.finish (properly) Finishes the event.
evt.npcAdd (func, name, portrait, desc, priority) Adds an NPC.
evt.npcRm (id) Removes an NPC.
evt.save (enable) Saves an event.


Functions

evt.claim (systems)
Tries to claim systems. Claiming systems is a way to avoid mission/event collisions preemptively. Note it does not actually claim the systems if it fails to claim. It also does not work more then once.

Parameters

  • systems: Table of systems to claim or a single system.

Usage

  • if not evt.claim( { system.get("Gamma Polaris") } ) then evt.finish( false ) end
  • if not evt.claim( system.get("Gamma Polaris") ) then evt.finish( false ) end

Return value:

true if was able to claim, false otherwise.
evt.finish (properly)
Finishes the event.

Parameters

  • properly: If true and the event is unique it marks the event as completed. If false or nil it deletes the event but doesn't mark it as completed.
evt.npcAdd (func, name, portrait, desc, priority)
Adds an NPC.

Parameters

  • func: Name of the function to run when approaching, gets passed the npc_id when called.
  • name: Name of the NPC
  • portrait: Portrait to use for the NPC (from GFX_PATH/portraits/).
  • desc: Description associated to the NPC.
  • priority: Optional priority argument (defaults to 5, highest is 0, lowest is 10).

Usage:

npc_id = evt.npcAdd( "my_func", "Mr. Test", "none", "A test." ) -- Creates an NPC.

Return value:

The ID of the NPC to pass to npcRm.
evt.npcRm (id)
Removes an NPC.

Parameters

  • id: ID of the NPC to remove.

Usage:

evt.npcRm( npc_id )
evt.save (enable)
Saves an event.

Parameters

  • enable: If true or nil sets the event to save, otherwise tells the event to not save.

Usage:

evt.save() -- Saves an event, which is by default disabled.

Valid XHTML 1.0!