Module events

Functions for events

Global functions

Event.all () returns an iterator over all events.
Event.create (name) creates a new event
Event.getFromId (id) finds any event by ID
Event.getFromName (name) finds any event by name

Class Event

event:addBroadcast (message) adds a new broadcast to the event
event:addEffect (clan) adds a new effect to the event
event:broadcasts () returns an iterator over all broadcasts in an event
event:delete () deletes an event
event:effects () returns an iterator over all effects in an event
event:getBroadcast (id) gets an event broadcast by ID
event:getDuration () get the event's duration
event:getEffect (id) gets an event effect by ID
event:getEndDate () get the event's end date
event:getFrequency () get the event's broadcast frequency
event:getId () returns the id of the event
event:getName () get the name of the event
event:getStartDate () get the event's start date
event:getStatus () get the status of the event
event:isActive () checks if the event is currently running
event:isPending () checks if the event is pending a future start date
event:setDuration (duration, increment) set the event's duration
event:setEndDate (date, timezone) set the event's end date
event:setFrequency (frequency, increment) set the event's broadcast frequency
event:setName (name) set the event's name
event:setStartDate (date, timezone) set the event's start date.
event:start (hard, announce) starts an event
event:stop (hardstop) stops an event

Class Broadcast

broadcast:delete () deletes the specific broadcast
broadcast:getDecay () get the specific broadcast's decay rate
broadcast:getFrequency () get the specific broadcast's frequency
broadcast:getMessage () returns the broadcast's message text
broadcast:getNum () returns the relative number of the broadcast
broadcast:setDecay (decay) set the specific broadcast's decay rate
broadcast:setFrequency (frequency, increment) set the specific broadcast's frequency
broadcast:setText (message) sets the broadcast message

Class Effect

effect:addPlanet (planet) adds a planet to the effect
effect:delete () deletes the specific effect
effect:getClan () returns the clan tied to the effect
effect:getCrime () get the effect's crime rating modifier
effect:getMilitary () get the effect's military rating modifier
effect:getNum () returns the relative number of the effect
effect:getOpinion () get the effect's public opinion modifier
effect:planets () returns an iterator over all planets in an effect
effect:removePlanet (planet) removes a planet from the effect
effect:setClan (clan) changes the clan tied to the effect
effect:setCrime (modifier) set the effect's crime rating modifier
effect:setMilitary (modifier) set the effect's military rating modifier
effect:setOpinion (modifier) set the effect's public opinion modifier


Global functions

Event.all ()
returns an iterator over all events.

Returns:

    an iterator of Event

Usage:

    for event in Event.all() do
      -- do something
    end
Event.create (name)
creates a new event

Parameters:

  • name string the event name.

Returns:

    Event the event
Event.getFromId (id)
finds any event by ID

Parameters:

  • id number the event id.

Returns:

    Event the event, or nil if not found
Event.getFromName (name)
finds any event by name

Parameters:

  • name string the event name.

Returns:

    Event the event, or nil if not found

Class Event

Functions on event variables
event:addBroadcast (message)
adds a new broadcast to the event

Parameters:

  • message string the broadcast message

Returns:

    Broadcast the new broadcast, for call chaining.

Usage:

    event:addBroadcast("This is a breaking news alert...")
event:addEffect (clan)
adds a new effect to the event

Parameters:

  • clan clan the clan the effect is tied to

Returns:

    Effect the new effect, for call chaining.

Usage:

    local empire = Clan.getFromName("The Galactic Empire")
    event:addEffect(empire)
event:broadcasts ()
returns an iterator over all broadcasts in an event

Returns:

    an iterator of Broadcast

Usage:

    for broadcast in event:broadcasts() do
      -- do something
    end
event:delete ()
deletes an event
event:effects ()
returns an iterator over all effects in an event

Returns:

    an iterator of Effect

Usage:

    for effect in event:effects() do
      -- do something
    end
event:getBroadcast (id)
gets an event broadcast by ID

Parameters:

  • id number the broadcast ID

Returns:

    Broadcast the broadcast, or nil if not found

Usage:

    event:getBroadcast(4)
event:getDuration ()
get the event's duration

Returns:

    number the event's duration (in hours)
event:getEffect (id)
gets an event effect by ID

Parameters:

  • id number the effect ID

Returns:

    Effect the effect, or nil if not found

Usage:

    event:getEffect(4)
event:getEndDate ()
get the event's end date

Returns:

    number the event's end date (as a raw number)
event:getFrequency ()
get the event's broadcast frequency

Returns:

    number the event's broadcast frequency (in minutes)
event:getId ()
returns the id of the event

Returns:

    number the event id
event:getName ()
get the name of the event

Returns:

    string the event name
event:getStartDate ()
get the event's start date

Returns:

    number the event's start date (as a raw time value)
event:getStatus ()
get the status of the event

Returns:

    string the event status
event:isActive ()
checks if the event is currently running

Returns:

    boolean True if the event is active, false otherwise.

Usage:

    if event:isActive() do
      ch:say("The event's running!")
    end
event:isPending ()
checks if the event is pending a future start date

Returns:

    boolean True if the event is pending, false otherwise.

Usage:

    if event:isPending() do
      ch:say("The event's pending and will start on: " .. ch:getCTime( event:getStartDate() ) )
    end
event:setDuration (duration, increment)
set the event's duration

Parameters:

  • duration number the amount of time
  • increment string "hours" or "days" (optional, defaults to hours)

Returns:

    Event this event, for call chaining.

Usage:

    event:setDuration(5)
event:setEndDate (date, timezone)
set the event's end date

Parameters:

  • date string the date/time (using natural language)
  • timezone number the timezone value (optional, or use 0 for system time)

Returns:

    Event this event, for call chaining.

Usage:

    event:setEndDate("March 20 2024 11:30 pm", 0)
event:setFrequency (frequency, increment)
set the event's broadcast frequency

Parameters:

  • frequency number the amount of time
  • increment string "minutes" or "hours" (optional, defaults to minutes)

Returns:

    Event this event, for call chaining.

Usage:

    event:setFrequency(30)
event:setName (name)
set the event's name

Parameters:

  • name string the name for the event

Returns:

    Event this event, for call chaining.

Usage:

    event:setName("Big Ewok Parade")
event:setStartDate (date, timezone)
set the event's start date.

Parameters:

  • date string the date/time (using natural language)
  • timezone number the timezone value (optional, or use 0 for system time)

Returns:

    Event this event, for call chaining.

Usage:

    event:setStartDate("March 20 2024 11:30 pm", 0)
event:start (hard, announce)
starts an event

Parameters:

  • hard boolean true to force the effects into place at once, false for gradual ramp-up
  • announce boolean true to publicly announce the event is starting, false if not

Returns:

    Event this event, for call chaining.

Usage:

    event:start(false, false)
event:stop (hardstop)
stops an event

Parameters:

  • hardstop boolean to cut the effects off immediately

Returns:

    Event this event, for call chaining.

Usage:

    event:stop(true)

Class Broadcast

Functions on event broadcast variables
broadcast:delete ()
deletes the specific broadcast
broadcast:getDecay ()
get the specific broadcast's decay rate

Returns:

    number the event's broadcast decay rate (in minutes)
broadcast:getFrequency ()
get the specific broadcast's frequency

Returns:

    number the event's broadcast frequency (in minutes)
broadcast:getMessage ()
returns the broadcast's message text

Returns:

    string the broadcast message
broadcast:getNum ()
returns the relative number of the broadcast

Returns:

    number the broadcast num
broadcast:setDecay (decay)
set the specific broadcast's decay rate

Parameters:

  • decay number the decay rate (in minutes)

Returns:

    Event this event, for call chaining.

Usage:

    event:setDecay(30)
broadcast:setFrequency (frequency, increment)
set the specific broadcast's frequency

Parameters:

  • frequency number the amount of time
  • increment string "minutes" or "hours" (optional, defaults to minutes)

Returns:

    Event this event, for call chaining.

Usage:

    event:setFrequency(30)
broadcast:setText (message)
sets the broadcast message

Parameters:

  • message string the new text for the broadcast

Returns:

    Broadcast this broadcast, for call chaining.

Class Effect

Functions on event effect variables
effect:addPlanet (planet)
adds a planet to the effect

Parameters:

  • planet planet the planet to add to the effect

Returns:

    Effect this effect, for call chaining.

Usage:

    local hfw = Planet.getFromName("Hologram Fun World")
    effect:addPlanet(hfw)
effect:delete ()
deletes the specific effect
effect:getClan ()
returns the clan tied to the effect

Returns:

    clan clan the clan the effect is tied to
effect:getCrime ()
get the effect's crime rating modifier

Returns:

    number the event's crime rating modifier
effect:getMilitary ()
get the effect's military rating modifier

Returns:

    number the event's military rating modifier
effect:getNum ()
returns the relative number of the effect

Returns:

    number the effect num
effect:getOpinion ()
get the effect's public opinion modifier

Returns:

    number the event's public opinion modifier
effect:planets ()
returns an iterator over all planets in an effect

Returns:

    an iterator of Planet

Usage:

    for planet in effect:planets() do
      -- do something
    end
effect:removePlanet (planet)
removes a planet from the effect

Parameters:

  • planet planet the planet to remove from the effect

Returns:

    Effect this effect, for call chaining.

Usage:

    local hoth = Planet.getFromName("Hoth")
    effect:removePlanet(hoth)
effect:setClan (clan)
changes the clan tied to the effect

Parameters:

  • clan clan the clan the effect is tied to

Returns:

    Effect this effect, for call chaining.

Usage:

    local empire = Clan.getFromName("The Galactic Empire")
    effect:setClan(empire)
effect:setCrime (modifier)
set the effect's crime rating modifier

Parameters:

  • modifier number the crime rating modifier (-100.00 to 100.00)

Returns:

    Effect this effect, for call chaining.

Usage:

    effect:setCrime(85.00)
effect:setMilitary (modifier)
set the effect's military rating modifier

Parameters:

  • modifier number the military rating modifier (-100.00 to 100.00)

Returns:

    Effect this effect, for call chaining.

Usage:

    effect:setMilitary(-75.00)
effect:setOpinion (modifier)
set the effect's public opinion modifier

Parameters:

  • modifier number the public opinion modifier (-100.00 to 100.00)

Returns:

    Effect this effect, for call chaining.

Usage:

    effect:setOpinion(-75.00)
generated by LDoc 1.5.0 Last updated 2024-10-22 16:05:00