(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
====Tools==== | ====Tools==== | ||
+ | |||
+ | |||
+ | =====Tools.Telegram(name As String, message As String, item As String, amount As Integer, sendOnlineMessage As String, Optional stringvar As String = "", Optional numvar As Double = -1, Optional LookOver As String = "") As Boolean===== | ||
+ | *Description=''Send a telegram. Can also send an item.'' | ||
+ | ;'''Values''' | ||
+ | :* name=''Player to send the telegram too.'' | ||
+ | :* message=''The message to send in the telegram.'' | ||
+ | :* item=''The item to send, blank if no item is needed.'' | ||
+ | :* amount=''The amount of the item to send. 0 if not needed.'' | ||
+ | :* sendOnlineMessage=''The message to send the online player if they are online during the telegram send.'' | ||
+ | :* stringvar=''Stringvar to add on the item if needed.'' | ||
+ | :* numvar=''Numbervar to add on the item if needed.'' | ||
+ | :* LookOver=''Lookover message to add on the item if needed.'' | ||
+ | *Returns=''True if the telegram is successful.'' | ||
+ | *Example=''Tools.Telegram()'' | ||
+ | |||
+ | |||
+ | =====Tools.BSVIPMode() As Boolean===== | ||
+ | *Description=''Gets the VIP mode of the server.'' | ||
+ | *Returns=''The VIP mode.'' | ||
+ | *Example=''Tools.BSVIPMode()'' | ||
+ | |||
+ | |||
+ | =====Tools.SwearCheck(textValue as String) As Boolean===== | ||
+ | *Description=''Check the value of the text to see if it matches any swear words.'' | ||
+ | ;'''Values''' | ||
+ | :* textValue=''The string to check'' | ||
+ | *Returns=''If the string contains swear words.'' | ||
+ | *Example=''Tools.SwearCheck("Hello folks!")'' | ||
+ | |||
+ | |||
+ | =====Tools.PoolOfGold(mode As Integer, Optional amount As Long = 0) As Long===== | ||
+ | *Description=''Gets the pool of gold amount of the server.'' | ||
+ | ;'''Values''' | ||
+ | :* mode=''1 to change the pool of gold to the amount specified. 0 will return only the value of pool of gold.'' | ||
+ | :* amount=''The amount to change the pool of gold to.'' | ||
+ | *Returns=''The pool of gold amount.'' | ||
+ | *Example=''Tools.PoolOfGold(1, 10000)'' | ||
Line 6: | Line 44: | ||
*Returns=''The number of the day.'' | *Returns=''The number of the day.'' | ||
*Example=''Tools.NumberOfTheDay()'' | *Example=''Tools.NumberOfTheDay()'' | ||
+ | |||
+ | |||
+ | =====Tools.Function(type As Integer, cID As Integer, defaultKey As String, ParamArray args As Object()) As Object===== | ||
+ | *Description=''Calls a function from another script. You can send tables but tables cannot be returned, only general values..'' | ||
+ | ;'''Values''' | ||
+ | :* type=''0=NPC, 1=ROOM, 2=PLAYER, 3=GLOBALNPC, 4=GLOBAL'' | ||
+ | *Returns=''Any object.'' | ||
+ | *Example=''Tools.Function(0, 20, "runfunction", "apple")'' | ||
Line 57: | Line 103: | ||
− | =====Tools.GetMaxZones( | + | =====Tools.GetMaxZones() As Integer===== |
− | *Description=''Returns the max zones owned | + | *Description=''Returns the max zones owned.'' |
;'''Values''' | ;'''Values''' | ||
− | + | *Returns=''Returns the zones owned.'' | |
− | *Returns=''Returns the | + | *Example=''Tools.GetMaxZones()'' |
− | *Example=''Tools.GetMaxZones( | + | |
Line 113: | Line 158: | ||
*Description=''Get a variable from another lua state (script). This can be used find a local variable to another script instance.'' | *Description=''Get a variable from another lua state (script). This can be used find a local variable to another script instance.'' | ||
;'''Values''' | ;'''Values''' | ||
− | :* type=''0 for npc file, 1 for room file, | + | :* type=''0 for npc file, 1 for room file, 2 for player file, 3 for global npc, 4 for global.'' |
:* id=''ID of the NPC, room, or player.'' | :* id=''ID of the NPC, room, or player.'' | ||
:* name =''Name of the variable.'' | :* name =''Name of the variable.'' | ||
Line 123: | Line 168: | ||
*Description=''Set a variable to another lua state (script). This can be used to pass a local variable to another script instance. These are temporary unless you do something with them.'' | *Description=''Set a variable to another lua state (script). This can be used to pass a local variable to another script instance. These are temporary unless you do something with them.'' | ||
;'''Values''' | ;'''Values''' | ||
− | :* type=''0 for npc file, 1 for room file, | + | :* type=''0 for npc file, 1 for room file, 2 for player file, 3 for global npc, 4 for global.'' |
:* id=''ID of the NPC, room, or player.'' | :* id=''ID of the NPC, room, or player.'' | ||
:* name =''Name of the variable.'' | :* name =''Name of the variable.'' | ||
Line 129: | Line 174: | ||
*Returns=''The value, blank for invalid and defaultValue if not found.'' | *Returns=''The value, blank for invalid and defaultValue if not found.'' | ||
*Example=''Tools.SetStateVar(3, 22, "AlreadySpun", "1")'' | *Example=''Tools.SetStateVar(3, 22, "AlreadySpun", "1")'' | ||
+ | |||
+ | |||
+ | =====Tools.SetVariableInFile(type As Integer, name as String, section as String, var as String)===== | ||
+ | *Description=''Permanently change a variable inside of a file if it exists. ONLY FOR BUILD SERVER, DOES NOT WORK ON LIVE.'' | ||
+ | ;'''Values''' | ||
+ | :* type=''0 for npc file, 1 for room file, 3 for player file.'' | ||
+ | :* name =''Name of the variable.'' | ||
+ | :* section=''Section where the variable is.'' | ||
+ | :* var=''The value of the variable.'' | ||
+ | *Example=''Tools.SetVariableInFile(1, "Special", "NPCBlock", "True")'' | ||
+ | |||
+ | |||
+ | =====Tools.SyncAllData() As Boolean===== | ||
+ | *Description=''Update everyones queued data to be current. Shouldn't be used in most cases.'' | ||
+ | *Example=''Tools.SyncAllData()'' |
Latest revision as of 19:46, 25 February 2021
Contents
- 1 Tools
- 1.1 Tools.Telegram(name As String, message As String, item As String, amount As Integer, sendOnlineMessage As String, Optional stringvar As String = "", Optional numvar As Double = -1, Optional LookOver As String = "") As Boolean
- 1.2 Tools.BSVIPMode() As Boolean
- 1.3 Tools.SwearCheck(textValue as String) As Boolean
- 1.4 Tools.PoolOfGold(mode As Integer, Optional amount As Long = 0) As Long
- 1.5 Tools.NumberOfTheDay() As Long
- 1.6 Tools.Function(type As Integer, cID As Integer, defaultKey As String, ParamArray args As Object()) As Object
- 1.7 Tools.UpdateEventMOTD(value As String)
- 1.8 Tools.GetEventMOTD() As String
- 1.9 Tools.FirstToUpper(value As String) As String
- 1.10 Tools.SetPMIndex(name As String)
- 1.11 Tools.Debug(message As String)
- 1.12 Tools.UnixTimestamp() As Double
- 1.13 Tools.ESTUnixTimestamp() As Double
- 1.14 Tools.GetMaxZones() As Integer
- 1.15 Tools.Log(logNumber As Integer, logWrite As String, Optional logHeader As String = "")
- 1.16 Tools.GetStringFromFile(type As Integer, name As String, section As String, key As String, defaultValue As String) As String
- 1.17 Tools.GetNumberFromFile(type As Integer, name As String, section As String, key As String, defaultValue As Double) As String
- 1.18 Tools.GetBoolFromFile(type As Integer, name As String, section As String, key As String, defaultValue As Boolean) As String
- 1.19 Tools.GetStateVar(type As Integer, pid As Integer, name As String) As Object
- 1.20 Tools.SetStateVar(type As Integer, id As Integer, name As String, var As Object)
- 1.21 Tools.SetVariableInFile(type As Integer, name as String, section as String, var as String)
- 1.22 Tools.SyncAllData() As Boolean
Tools
Tools.Telegram(name As String, message As String, item As String, amount As Integer, sendOnlineMessage As String, Optional stringvar As String = "", Optional numvar As Double = -1, Optional LookOver As String = "") As Boolean
- Description=Send a telegram. Can also send an item.
- Values
- name=Player to send the telegram too.
- message=The message to send in the telegram.
- item=The item to send, blank if no item is needed.
- amount=The amount of the item to send. 0 if not needed.
- sendOnlineMessage=The message to send the online player if they are online during the telegram send.
- stringvar=Stringvar to add on the item if needed.
- numvar=Numbervar to add on the item if needed.
- LookOver=Lookover message to add on the item if needed.
- Returns=True if the telegram is successful.
- Example=Tools.Telegram()
Tools.BSVIPMode() As Boolean
- Description=Gets the VIP mode of the server.
- Returns=The VIP mode.
- Example=Tools.BSVIPMode()
Tools.SwearCheck(textValue as String) As Boolean
- Description=Check the value of the text to see if it matches any swear words.
- Values
- textValue=The string to check
- Returns=If the string contains swear words.
- Example=Tools.SwearCheck("Hello folks!")
Tools.PoolOfGold(mode As Integer, Optional amount As Long = 0) As Long
- Description=Gets the pool of gold amount of the server.
- Values
- mode=1 to change the pool of gold to the amount specified. 0 will return only the value of pool of gold.
- amount=The amount to change the pool of gold to.
- Returns=The pool of gold amount.
- Example=Tools.PoolOfGold(1, 10000)
Tools.NumberOfTheDay() As Long
- Description=Gets the number of the day. Changes at reset.
- Returns=The number of the day.
- Example=Tools.NumberOfTheDay()
Tools.Function(type As Integer, cID As Integer, defaultKey As String, ParamArray args As Object()) As Object
- Description=Calls a function from another script. You can send tables but tables cannot be returned, only general values..
- Values
- type=0=NPC, 1=ROOM, 2=PLAYER, 3=GLOBALNPC, 4=GLOBAL
- Returns=Any object.
- Example=Tools.Function(0, 20, "runfunction", "apple")
Tools.UpdateEventMOTD(value As String)
- Description=Update the event MOTD. Does not remove on reset.
- Values
- value=The MOTD to add.
- Example=Tools.UpdateEventMOTD("So many events happening around 8pm!")
Tools.GetEventMOTD() As String
- Description=Get the event MOTD.
- Returns=The event MOTD.
- Example=Tools.GetEventMOTD()
Tools.FirstToUpper(value As String) As String
- Description=Uppercase the first character in a string.
- Values
- value=The string to convert.
- Returns=The string with the first character uppercased.
- Example=Tools.FirstToUpper("banana!")
Tools.SetPMIndex(name As String)
- Description=Debugging function only. Will set the name of whom to output the errors too. Must be defined in each script.
- Values
- name=The player name.
- Example=Tools.SetPMIndex("NiteHawk")
Tools.Debug(message As String)
- Description=Output a custom error to the player or the log file. This can output to the player defined above.
- Values
- message=The message to output.
- Example=Tools.Debug("This is an error message to output!")
Tools.UnixTimestamp() As Double
- Description=Returns the unix timestamp (based on total seconds). This is based on GMT and should be used to prevent issues with daylight savings unless a server time is specifically needed. This should be used when handling time differences and time checks for scripts.
- Values
- Returns=Current GMT unix timestamp.
- Example=Tools.UnixTimestamp()
Tools.ESTUnixTimestamp() As Double
- Description=Returns the unix timestamp (based on total seconds). This is based on the current server time. This should be used when handling time differences and time checks for scripts.
- Values
- Returns=Current server unix timestamp.
- Example=Tools.ESTUnixTimestamp()
Tools.GetMaxZones() As Integer
- Description=Returns the max zones owned.
- Values
- Returns=Returns the zones owned.
- Example=Tools.GetMaxZones()
Tools.Log(logNumber As Integer, logWrite As String, Optional logHeader As String = "")
- Description=Write data to a log. This will send data to be written to a specific log.
- Values
- logNumber=The log ID to write too. 1 for the staff log, 2 for the PP log, and 3 for the error log. 4 for custom logs that are viewable by anyone.
- logWrite=The string to write to the log.
- logHeader=The header of the line. Must be used when staff log or custom log is defined.
- Example=Tools.Log(1, "Killed an NPC!", "NiteHawk")
Tools.GetStringFromFile(type As Integer, name As String, section As String, key As String, defaultValue As String) As String
- Description=Returns a string value in a file.
- Values
- type=0 for npc file, 1 for room file, 2 for item file.
- name =Name of the file without extension to find.
- section=Section in the file.
- key=Key in the file.
- defaultValue=Default key to return if not existing.
- Returns=The value, blank for invalid and defaultValue if not found.
- Example=Tools.GetStringFromFile(0, "Goblin", "Vars", "Race")
Tools.GetNumberFromFile(type As Integer, name As String, section As String, key As String, defaultValue As Double) As String
- Description=Returns a number value in a file.
- Values
- type=0 for npc file, 1 for room file, 2 for item file.
- name =Name of the file without extension to find.
- section=Section in the file.
- key=Key in the file.
- defaultValue=Default key to return if not existing.
- Returns=The value, 0 for invalid and defaultValue if not found.
- Example=Tools.GetNumberFromFile(0, "Goblin", "Values", "MoneyMinimum")
Tools.GetBoolFromFile(type As Integer, name As String, section As String, key As String, defaultValue As Boolean) As String
- Description=Returns a boolean value in a file.
- Values
- type=0 for npc file, 1 for room file, 2 for item file.
- name =Name of the file without extension to find.
- section=Section in the file.
- key=Key in the file.
- defaultValue=Default key to return if not existing.
- Returns=The value, false for invalid and defaultValue if not found.
- Example=Tools.GetBoolFromFile(0, "Goblin", "Special", "Despawn")
Tools.GetStateVar(type As Integer, pid As Integer, name As String) As Object
- Description=Get a variable from another lua state (script). This can be used find a local variable to another script instance.
- Values
- type=0 for npc file, 1 for room file, 2 for player file, 3 for global npc, 4 for global.
- id=ID of the NPC, room, or player.
- name =Name of the variable.
- Returns=The value of the variable found, otherwise blank.
- Example=Tools.GetStateVar(3, 22, "AlreadySpun")
Tools.SetStateVar(type As Integer, id As Integer, name As String, var As Object)
- Description=Set a variable to another lua state (script). This can be used to pass a local variable to another script instance. These are temporary unless you do something with them.
- Values
- type=0 for npc file, 1 for room file, 2 for player file, 3 for global npc, 4 for global.
- id=ID of the NPC, room, or player.
- name =Name of the variable.
- var=The value of the variable.
- Returns=The value, blank for invalid and defaultValue if not found.
- Example=Tools.SetStateVar(3, 22, "AlreadySpun", "1")
Tools.SetVariableInFile(type As Integer, name as String, section as String, var as String)
- Description=Permanently change a variable inside of a file if it exists. ONLY FOR BUILD SERVER, DOES NOT WORK ON LIVE.
- Values
- type=0 for npc file, 1 for room file, 3 for player file.
- name =Name of the variable.
- section=Section where the variable is.
- var=The value of the variable.
- Example=Tools.SetVariableInFile(1, "Special", "NPCBlock", "True")
Tools.SyncAllData() As Boolean
- Description=Update everyones queued data to be current. Shouldn't be used in most cases.
- Example=Tools.SyncAllData()