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 playercommand
: Command the player entered
- player_command_hook (playerid, command)
-
Hook regular slash (/) commands
Parameters:
playerid
: ID of the playercommand
: 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 inisreconnect
: 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 involvedmobid
: The mob id that was killedlevel
: The level of the mobname
: The name of the mobquadx
: The quad X where the death happenedquady
: The quad Y where the dead happenedz
: 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 miningplanetid
: 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 IDpqx
: Previous X quadpqy
: Previous Y quadqx
: New X quadqy
: New Y quad
- player_tier_hook (playerid, tier)
-
Called every time a player tiers
Parameters:
playerid
: ID of the playertier
: Players new tier
- player_level_hook (playerid, level)
-
Called every time a player levels up
Parameters:
playerid
: The ID of the playerlevel
: 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 playermobid
: The mob id that killedlevel
: The level of the mobname
: The name of the mobquadx
: The quad X where the death happenedquady
: The quad Y where the dead happenedz
: 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 scriptitem_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 executetimeout
: 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 executeinterval
: 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 scriptmobid
: 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 scriptmobid
: 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 originatestoid
: 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 playertext
: Text to write to screencolour
: (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 playeritemid
: 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 playerskill
: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 toitemid
: Item id to givecount
: 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 fromitemid
: 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 ofitemid
: 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 tolevel
: Level of exp to give
Usage:
give_exp()