Module hs

HS Lua Documentation for Quests

Functions

init (startmob) Init function.
item () This function will turn a local quest ID into one the host understands.
update () Is run every gameloop of the server for players who have the quest activated.
add_talk_to_mob (mobid, triggerword, message, requires_quest) Add static talk from a mob based on a triggerword.
add_talk_to_mob_callback (mobid, triggerword, message, requires_quest, callback) Add talk from a mob based on a triggerword and allow a callback
create_news_message (message) Create a global news message
create_chat_from_mob (mobid, chat) Create one-off chat from a mob
write_text_to_screen (text, colour) Write text to the screen of the current player
get_player_coords () Get the current player coordinates in the world
get_player_map_xy () Get the current player quad x/y/z
get_player_name () Get the current player name.
get_player_level () Get the current players level
get_player_class () Get the current players class
get_player_skill (skill) Get the value of a skill from a player
find_mob_id_by_name (name) Get the mob ID from a name
find_mob_name_by_id (id) Get the mob name from an ID.
find_item_name_by_id (id) Get the item name from an ID
find_item_id_by_name (name) Get the item ID from a name
give_item (id) Give an item to the player
remove_item (id) Remove an item from the player if exists
get_item_count (id) Get a count of a particular item in ship cargo
check_item (id) Check if the player has an item in ship cargo
unset_param (key) Unset a param from the player (delete from memory)
save_param (key, value) Save a param to the player, persistent across reboots.
load_param (key) Load a param value that was previously saved (persistent across reboots)
set_start () Activate this quest on a player.
set_finish () Deactivate a quest from a player, generaly used as callback for chat.
set_abort () Abort a quest from a player.
log (text) Log to logfile and stdout.
give_xp () Give the player amount of XP based on quest level (see #DEF_QUEST)

Tables

coordinates Coordinate Table
map_coordinates Map coordinate/quad table


Functions

init (startmob)
Init function. This is automatically run just once by the server. It can be used to set up variables and talk for mobs. REQUIRED.

Parameters:

  • startmob: The mob id of a player
item ()
This function will turn a local quest ID into one the host understands. See gerenium example.

Usage:

    get_item(item(1))
update ()
Is run every gameloop of the server for players who have the quest activated.
add_talk_to_mob (mobid, triggerword, message, requires_quest)
Add static talk from a mob based on a triggerword. If multiple lines with the same keyword are defined, they are displayed in the order declared in the script (top to bottom). See Gerenium Quest.

Parameters:

  • mobid: The mob id to affect.
  • triggerword: Triggerwords can be [CLICK], [DEATH] or a keyword. [CLICK] gets fired when a player clicks the mob, [DEATH] when the mob dies. Keyword gets triggered when a player has the mob selected and enters the keyword.
  • message: The response to the message. To put the player or mob name into the message use %P and %N respectively, they are replaced at runtime.
  • requires_quest: Whether the response requires the player to have the quest active

Usage:

    add_talk_to_mob(startmob, "[CLICK]", "Welcome to the Academy, %P. I am %N.", 0)
add_talk_to_mob_callback (mobid, triggerword, message, requires_quest, callback)
Add talk from a mob based on a triggerword and allow a callback

Parameters:

  • mobid: The mob id to affect.
  • triggerword: Triggerwords can be [CLICK], [DEATH] or a keyword. [CLICK] gets fired when a player clicks the mob, [DEATH] when the mob dies. Keyword gets triggered when a player has the mob selected and enters the keyword.
  • message: The response to the message. To put the player or mob name into the message use %P and %N respectively, they are replaced at runtime.
  • requires_quest: Whether the response requires the player to have the quest active
  • callback: (string)Function name of function to call

Usage:

    local function logTest()
    	log("Test callback")
    end
    
    add_talk_to_mob_callback(startmob, "testcallback", "Firing the test callback", 0, "logTest")
create_news_message (message)
Create a global news message

Parameters:

  • message: Message to announce. Supports %P

Usage:

    create_news_message("%P has finished the Gerenium Quest!")
create_chat_from_mob (mobid, chat)
Create one-off chat from a mob

Parameters:

  • mobid: Mob ID from which to chat
  • chat: Message to write

Usage:

    create_chat_from_mob(10001, "Thankyou!")
write_text_to_screen (text, colour)
Write text to the screen of the current player

Parameters:

  • text: Text to write to sreen
  • colour: (Optional) Integer of colour to write

Usage:

    write_text_to_screen("This is blue text",1)
get_player_coords ()
Get the current player coordinates in the world

Usage:

    local xy = get_player_coords()
    log("Player x is" .. xy["x"])

Returns:

    coordinates Player coordinates as a table.

see also:

get_player_map_xy ()
Get the current player quad x/y/z

Usage:

    local qxy = get_player_map_xy()
    log("Player quadx is" .. qxy["x"])

Returns:

    coordinates Player quads as a table.

see also:

get_player_name ()
Get the current player name.

Usage:

    local name = get_player_name()
    log("Current player is " .. name)

Returns:

    string Name of player
get_player_level ()
Get the current players level

Usage:

    local level = get_player_level()

Returns:

    int Level of the player
get_player_class ()
Get the current players class

Usage:

    local class = get_player_class()

Returns:

    string Class of player
get_player_skill (skill)
Get the value of a skill from a player

Parameters:

  • skill:

    Skill to get, Case-insensitive Valid skills include:

    "OFFENSE"
    "DEFENSE"
    "REPAIR"
    "NAVIGATION"
    "MEDICINE"
    "SCIENCE"
    "MINING"
    "PLANET"
    "HIDE"
    "WEAPONS"
    "TECH"
    "TRADING"
    "DODGE"
    "TACTICS"
    "BEAM"
    "BOLT"
    "DISRUPTOR"
    "MISSILE"
    "FIGHTER"
    "SYSTEMS"
    "RECHARGE"
    "MEDITATE"
    "EMPATHY" --(telepathy)
    "TELEKINESIS"
    "PYROKINESIS"
    "PRECISION"
    

Usage:

    local skill = get_player_skill("mining")

Returns:

    float Value between 0 to 999, where the value divided by 10 is representative of the ingame value.
find_mob_id_by_name (name)
Get the mob ID from a name

Parameters:

  • name: Mob name

Usage:

    local id = find_mob_id_by_name("Scythe Explorer")
    log("Mob id is " .. id)

Returns:

    string Mob Name
find_mob_name_by_id (id)
Get the mob name from an ID. May not need this.

Parameters:

  • id: Mob ID

Usage:

    id = find_mob_name_by_id(4000)

Returns:

    string Mob Name
find_item_name_by_id (id)
Get the item name from an ID

Parameters:

  • id: Item ID

Usage:

    local name = find_item_name_by_id(120)

Returns:

    string Item Name
find_item_id_by_name (name)
Get the item ID from a name

Parameters:

  • name: Item Name

Usage:

    local id = find_item_id_by_name("lt laser")

Returns:

    int Item ID
give_item (id)
Give an item to the player

Parameters:

  • id: Item ID

Usage:

    local id = find_item_id_by_name("lt laser")
    give_item(id)
remove_item (id)
Remove an item from the player if exists

Parameters:

  • id: Item ID

Usage:

    local id = find_item_id_by_name("lt laser")
    remove_item(id)
get_item_count (id)
Get a count of a particular item in ship cargo

Parameters:

  • id: Item ID

Usage:

    local id = find_item_id_by_name("lt laser")
    local count = get_item_count(id)

Returns:

    int Number of items
check_item (id)
Check if the player has an item in ship cargo

Parameters:

  • id: Item ID to check for

Usage:

    local id = find_item_id_by_name("lt laser")
    check_item(id)

Returns:

    boolean
unset_param (key)
Unset a param from the player (delete from memory)

Parameters:

  • key: Identifier of the value

Usage:

    unset_param("Key1")

Returns:

    1 if found and successful, else 0

see also:

save_param (key, value)
Save a param to the player, persistent across reboots. If parameter already exists, overwrites.

Parameters:

  • key: Identifier of the value
  • value: Value to save

Usage:

    save_param("Key1","Value1")

see also:

load_param (key)
Load a param value that was previously saved (persistent across reboots)

Parameters:

  • key: Identifier of the value to get

Usage:

    load_param("Key1")

see also:

set_start ()
Activate this quest on a player. generally used as callback for chat.

Usage:

    add_talk_to_mob_callback(startmob,"start","Thanks for starting the quest!",0, "startQuest")
    function startQuest()
    	log("%P is starting the Gerenium quest.")
    end
set_finish ()
Deactivate a quest from a player, generaly used as callback for chat.

see also:

set_abort ()
Abort a quest from a player. Removes from player. Performs similar to set finish.

see also:

log (text)
Log to logfile and stdout.

Parameters:

  • text: Text to write

Usage:

    log("This is a log")
give_xp ()
Give the player amount of XP based on quest level (see #DEF_QUEST)

Usage:

    give_xp()

Tables

coordinates
Coordinate Table

Fields:

  • x: -- X coord
  • y: -- Y coord
  • z: -- Z coord (Is the player in space or zone?)
map_coordinates
Map coordinate/quad table

Fields:

  • x: -- Quad X coord
  • y: -- Quad Y coord
  • z: -- Z coord (Is the player in the space or zone?)
generated by LDoc 1.2