Module hs

HS Lua Documentation for Quests

Functions

wizz_command_hook (playerid, command) Hook wiz commands ($)
player_command_hook (playerid, command) Hook regular slash (/) commands
player_disconnect_hook (playerid) Called every time a player disconnects, optional
player_login_hook (playerid, isreconnect) Called every time a player logs in, optional
player_kill_mob_hook (playerid, mobid, level, name, quadx, quady, z) Called every time a mob is killed by a player, optional
player_clicked_hook (playerid) Called every time a player is clicked on, optional
player_mine_hook (playerid, planetid) Called every time a player mines a planet
player_change_quad_hook (playerid, pqx, pqy, qx, qy) Called every time a player moves between quads, optional
player_tier_hook (playerid, tier) Called every time a player tiers
player_level_hook (playerid, level) Called every time a player levels up
player_killed_hook (playerid, mobid, level, name, quadx, quady, z) Called every time a player is killed by a mob
init (plugin_id) Init function.
item (plugin_id, item_id) This function will turn a local quest ID into one the host understands.
set_timeout (pluginid, function_name, timeout) Set a function to run after a set amount of time
set_interval (pluginid, function_name, interval) Set a function to run repeatedly
add_talk_to_mob (pluginid, mobid, triggerword, message) Add static talk from a mob based on a triggerword.
add_talk_to_mob_callback (pluginid, mobid, triggerword, message, 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 (fromid, toid, chat) Create one-off chat from a mob
write_text_to_screen (playerid, text, colour) Write text to the screen of the current player
get_player_coords (playerid) Get the current player coordinates in the world
get_player_item_count (playerid, itemid) Get the count of a particular item from player cargo
get_player_map_coords (playerid) Get the current player quad x/y/z
get_random_item (type) Get random ore
get_player_name (playerid) Get the current player name.
get_player_level (playerid) Get the current players level
get_player_class (playerid) Get the current players class
get_player_skill (playerid, skill) Get the value of a skill from a player
find_mob_by_name (name) Get the mob ID from a name
find_mob_by_id (mobid) Get the mob name from an ID.
give_item (playerid, itemid, count) Give an item to the player
remove_item (playerid, itemid) Remove an item from the player if exists
get_item_count (playerid, itemid) Get a count of a particular item in ship cargo
give_exp (playerid, level) Give the player amount of XP based on quest level (see #DEF_QUEST)

Tables

coordinates Coordinate Table


Functions

wizz_command_hook (playerid, command)
Hook wiz commands ($)

Parameters:

  • playerid: ID of the player
  • command: Command the player entered
player_command_hook (playerid, command)
Hook regular slash (/) commands

Parameters:

  • playerid: ID of the player
  • command: Command the player entered
player_disconnect_hook (playerid)
Called every time a player disconnects, optional

Parameters:

  • playerid: ID of the player disconnected
player_login_hook (playerid, isreconnect)
Called every time a player logs in, optional

Parameters:

  • playerid: Playerid that logged in
  • isreconnect: Whether it was a reconnect or new login
player_kill_mob_hook (playerid, mobid, level, name, quadx, quady, z)
Called every time a mob is killed by a player, optional

Parameters:

  • playerid: Player id involved
  • mobid: The mob id that was killed
  • level: The level of the mob
  • name: The name of the mob
  • quadx: The quad X where the death happened
  • quady: The quad Y where the dead happened
  • z: Underspace or not
player_clicked_hook (playerid)
Called every time a player is clicked on, optional

Parameters:

  • playerid: Player id clicked on
player_mine_hook (playerid, planetid)
Called every time a player mines a planet

Parameters:

  • playerid: Player id performing the mining
  • planetid: ID of the planet mined
player_change_quad_hook (playerid, pqx, pqy, qx, qy)
Called every time a player moves between quads, optional

Parameters:

  • playerid: Player ID
  • pqx: Previous X quad
  • pqy: Previous Y quad
  • qx: New X quad
  • qy: New Y quad
player_tier_hook (playerid, tier)
Called every time a player tiers

Parameters:

  • playerid: ID of the player
  • tier: Players new tier
player_level_hook (playerid, level)
Called every time a player levels up

Parameters:

  • playerid: The ID of the player
  • level: The players new level
player_killed_hook (playerid, mobid, level, name, quadx, quady, z)
Called every time a player is killed by a mob

Parameters:

  • playerid: The ID of the player
  • mobid: The mob id that killed
  • level: The level of the mob
  • name: The name of the mob
  • quadx: The quad X where the death happened
  • quady: The quad Y where the dead happened
  • z: Underspace or not
init (plugin_id)
Init function. This is automatically run just once by the server. It can be used to set up variables and talk for mobs

Parameters:

  • plugin_id: The id of this script, normally a good idea to cache to a local var
item (plugin_id, item_id)
This function will turn a local quest ID into one the host understands. See gerenium example.

Parameters:

  • plugin_id: The id of this script
  • item_id: The id of the item

Usage:

    get_item(item(plugin_id, 1))

Returns:

    id The modified item ID
set_timeout (pluginid, function_name, timeout)
Set a function to run after a set amount of time

Parameters:

  • pluginid: The id of this script (cached earlier at init normally)
  • function_name: The name of the function to execute
  • timeout: The time delay in seconds
set_interval (pluginid, function_name, interval)
Set a function to run repeatedly

Parameters:

  • pluginid: The id of this script (cached earlier at init normally)
  • function_name: The name of the function to execute
  • interval: The interval between calls in in seconds
add_talk_to_mob (pluginid, mobid, triggerword, message)
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:

  • pluginid: The id of this script
  • 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.

Usage:

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

Parameters:

  • pluginid: The id of this script
  • 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.
  • callback: (string)Function name of function to call

Usage:

    local function logTest()
    	log("Test callback")
    end
create_news_message (message)
Create a global news message

Parameters:

  • message: Message to announce.
create_chat (fromid, toid, chat)
Create one-off chat from a mob

Parameters:

  • fromid: ID the chat originates
  • toid: ID for the target of the chat (usually player)
  • chat: Message to write (< 255 characters)
write_text_to_screen (playerid, text, colour)
Write text to the screen of the current player

Parameters:

  • playerid: ID of the player
  • text: Text to write to screen
  • colour: (Optional) Integer of colour to write

Usage:

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

Parameters:

  • playerid: ID of the player

Usage:

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

Returns:

    coordinates Player coordinates as a table.

see also:

get_player_item_count (playerid, itemid)
Get the count of a particular item from player cargo

Parameters:

  • playerid: ID of the player
  • itemid: ID of the item to check for

Returns:

    count Integer
get_player_map_coords (playerid)
Get the current player quad x/y/z

Parameters:

  • playerid: ID of the player

Usage:

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

Returns:

    coordinates Player quads as a table.

see also:

get_random_item (type)
Get random ore

Parameters:

  • type: Type of the item to get @
get_player_name (playerid)
Get the current player name.

Parameters:

  • playerid: ID of the player

Usage:

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

Returns:

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

Parameters:

  • playerid: ID of the player

Usage:

    local level = get_player_level()

Returns:

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

Parameters:

  • playerid: ID of the player

Usage:

    local class = get_player_class()

Returns:

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

Parameters:

  • playerid: ID of the player
  • 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_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_by_id (mobid)
Get the mob name from an ID. May not need this.

Parameters:

  • mobid: Mob ID

Usage:

    local mob = find_mob_name_by_id(4000)

Returns:

    string Mob Name
give_item (playerid, itemid, count)
Give an item to the player

Parameters:

  • playerid: Player to give to
  • itemid: Item id to give
  • count: Number of items to give

Usage:

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

Parameters:

  • playerid: Player id to remove from
  • itemid: Item to remove
get_item_count (playerid, itemid)
Get a count of a particular item in ship cargo

Parameters:

  • playerid: Player to get the count of
  • itemid: The item id to count

Returns:

    int Number of items
give_exp (playerid, level)
Give the player amount of XP based on quest level (see #DEF_QUEST)

Parameters:

  • playerid: Player id to give exp to
  • level: Level of exp to give

Usage:

    give_exp()

Tables

coordinates
Coordinate Table

Fields:

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