From 0cb0f53c0ef97253e4b11a491b655dfbaccbc37f Mon Sep 17 00:00:00 2001 From: Emagi Date: Tue, 20 May 2025 08:50:00 -0400 Subject: [PATCH] lua functions doc --- docs/lua_functions/GetCanGate.md | 29 +++++++++++++++++++++++------ docs/lua_functions/IsNight.md | 22 ++++++++++++++-------- docs/lua_functions/RemoveCoin.md | 19 ++++++++----------- 3 files changed, 45 insertions(+), 25 deletions(-) diff --git a/docs/lua_functions/GetCanGate.md b/docs/lua_functions/GetCanGate.md index 30ad51f..f39a1c1 100644 --- a/docs/lua_functions/GetCanGate.md +++ b/docs/lua_functions/GetCanGate.md @@ -1,17 +1,34 @@ -### Function: GetCanGate(param1, param2) +### Function: GetCanGate(Spawn) **Description:** -Placeholder description. +Checks if the Spawn is allowed to use Gate spells in this zone or area. **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. +- `Spawn`: Spawn - The spawn to check if Gate is allowed. **Returns:** None. **Example:** ```lua --- Example usage -GetCanGate(..., ...) +-- Example usage Spells/Commoner/CalltoHome.lua (spell to send player to their Bind with Gate) +function precast(Caster, Target) + if GetBoundZoneID(Caster) == 0 then + return false + end + + if(GetCanGate(Caster) == 1) + then + return true + else + SendMessage(Caster, "You cannot use Call to Home from this location.", "red") + return false + end + + return true +end + +function cast(Caster, Target) + Gate(Caster) +end ``` diff --git a/docs/lua_functions/IsNight.md b/docs/lua_functions/IsNight.md index 9917c35..3451683 100644 --- a/docs/lua_functions/IsNight.md +++ b/docs/lua_functions/IsNight.md @@ -1,17 +1,23 @@ -### Function: IsNight(param1, param2) +### Function: IsNight(Zone) -**Description:** -Placeholder description. +***Description:*** +Checks if it is currently nighttime in the specified zone. This usually refers to the game’s day/night cycle. **Parameters:** -- `param1`: ZoneServer - The zone object. -- `param2`: unknown - Unknown type. +- `Zone`: Zone - The zone to check if the time is night. -**Returns:** None. +**Returns:** Return's true if the current time is dusk/night. Otherwise return's false. **Example:** ```lua --- Example usage -IsNight(..., ...) +-- Example usage: On hail tell the user if it is night or day + +function hail(NPC,Spawn) + if IsNight(GetZone(NPC)) then + Say(NPC, "It is night!") + else + Say(NPC, "It is day!") + end +end ``` diff --git a/docs/lua_functions/RemoveCoin.md b/docs/lua_functions/RemoveCoin.md index 8d14ee4..ea68a98 100644 --- a/docs/lua_functions/RemoveCoin.md +++ b/docs/lua_functions/RemoveCoin.md @@ -1,20 +1,17 @@ -### Function: RemoveCoin(param1, param2, param3, param4, param5) +### Function: RemoveCoin(Spawn, Amount) **Description:** -Placeholder description. +Deducts the specified amount of coin (in copper) from the spawn’s money. If the spawn does not have enough, this could reduce them to zero or potentially go negative (though typically it will not allow negative). **Parameters:** -- `param1`: Spawn - The spawn or entity involved. -- `param2`: unknown - Unknown type. -- `param3`: unknown - Unknown type. -- `param4`: unknown - Unknown type. -- `param5`: int32 - Integer value. +- `Spawn`: Spawn - The player from whom to take coin. +- `Amount`: UInt32 - The amount in copper to remove. -**Returns:** None. +**Returns:** Return's true if the Player has enough coin to remove, otherwise return's false. **Example:** ```lua --- Example usage -RemoveCoin(..., ..., ..., ..., ...) -``` +-- Example usage (charge a fee of 2 silver, 50 copper i.e., 250 copper total) +RemoveCoin(Player, 250) +``` \ No newline at end of file