Internal Docs - growtopiadev/growtopia-internal GitHub Wiki
Internal Documentation
Game table
You can access basic functions with Game table.
| Function | Description |
|---|---|
| SendPacket | Sends a text packet to the server |
| SendPacketRaw | Sends a TankUpdatePacket to the server |
| ProcessTankUpdatePacket | Emulates a TankUpdatePacket from the server |
| EmulateVarList | Emulates VariantList from the server |
| GetLocal | Returns NetAvatar if exists, otherwise nil |
| GetWorld | Returns World if exists, otherwise nil |
| GetItem | returns ItemInfo if exists, otherwise nil |
| SetFPSLimit | Sets game's max FPS limit to X |
Engine
| Function | Description |
|---|---|
| Execute | Executes certain script |
| RandomInt | Creates a callback for certain function |
| RandomStr | Removes certain function |
| ShowConsole | Shows console window |
| HideConsole | Hides console window |
Callbacks
| Function | Description |
|---|---|
| Create | Creates a callback for certain function |
| Remove | Removes certain function |
Timer
| Function | Description |
|---|---|
| Create | Creates a timer with certain call interval |
| Remove | Removes certain timer |
SendPacket
Game.SendPacket(type, text)
Sends a text packet to the server.
Example usage:
Game.SendPacket(2, "action|input\ntext|Hello World!")
SendPacketRaw
Game.SendPacketRaw(packet)
Sends a TankUpdatePacket to the server. Takes packet as parameter.
Example usage:
local packet = TankUpdatePacket()
Game.SendPacketRaw(packet)
ProcessTankUpdatePacket
Game.ProcessTankUpdatePacket(packet)
Emulates a TankUpdatePacket from the server
Example usage:
local packet = TankUpdatePacket()
Game.ProcessTankUpdatePacket(packet)
EmulateVarList
Emulates a VariantList from the server
Example usage:
local varList = {}
varList[1] = { type = 2, value = "OnDialogRequest" }
varList[2] = { type = 2, value = "set_default_color|`o\nadd_label_with_icon|big| `wPlayer Portal`` |left|1366|\nadd_spacer|small|\nadd_button|socialportal|`wSocial Portal``|noflags|0|0|\nadd_button|missions|`wMarvelous Missions``|noflags|0|0|\nadd_button|gazette|`wGazette``|noflags|0|0|\nadd_button|communityhub|`wCommunity Hub``|noflags|0|0|\nadd_quick_exit|\nend_dialog|playerportal|OK||\n" }
Game.EmulateVarList(varList, -1, 0)
GetLocal
Returns NetAvatar if exists, else nil
Example usage:
local player = Game.GetLocal()
if player then
player.name = "`6@Hamumu" -- Changes your player name to Hamumu
end
GetWorld
Returns World if exists, else nil
Example usage:
local world = Game.GetLocal()
if world then
print(world.name) -- Prints world name
end
GetItem
Returns ItemInfo if exists, else nil
Example usage:
local item = Game.GetItem(242) -- 242 is World Lock
if item then
print(item.name) -- Prints item name
end
SetFPSLimit
Set max FPS for game, also depends on your screens refresh rate.
Example usage:
Game.SetFPSLimit(144)
TankUpdatePacket
| Type | Name | Description |
|---|---|---|
| int | type | Packet's type |
| int | ? | ? |
| int | count1 | ? |
| int | count2 | ? |
| int | netid | NetID of packet |
| int | packetFlags | |
| number | structFlags | |
| int | intData | |
| number | vec1X | Same as x |
| number | vec1Y | Same as y |
| number | vec2X | |
| number | vec2Y | |
| number | particleTime | |
| int | tileY | |
| int | tileX |
VariantList
Example varlist
local varList = {}
varList[1] = { type = 2, value = "OnConsoleMessage" }
varList[2] = { type = 2, value = "Hello World!" }
Game.EmulateVarList(varList, -1, 0)
InventoryItem
| Type | Name | Description |
|---|---|---|
| int | id | Item ID |
| int | count | Amount of item |
| int | flags | Item flags |
NetAvatar
| Type | Name | Description |
|---|---|---|
| number | x | Player's X position |
| number | y | Player's Y position |
| number | sizeX | Player's size X |
| number | sizeY | Player's size Y |
| string | name | Player's name |
| int | netID | NetID of player |
| bool | facingLeft | Tells if player is facing left or no |
| int | skinColor | Player's skin color |
| int | userID | UserID of player |
| int | country | |
| int | isMod | Allows to toggle mod zoom |
| int | isSuperMod | Togglse mod zoom and long place (Bannable) |
Methods:
| Method | Description |
|---|---|
| GetInventoryItem(id) | returns inventory item if exists, otherwise nil |
| GetInventory() | returns InventoryItem table |
Tile
| Type | Name | Description |
|---|---|---|
| int | foreground | |
| int | background | |
| int | flags |
WorldObject
| Type | Name | Description |
|---|---|---|
| int | itemID | |
| number | x | |
| number | y | |
| int | count | |
| int | index |
World
| Type | Name | Description |
|---|---|---|
| string | name | Returns world name |
| int | sizeX | Returns X size of world |
| int | sizeY | Returns Y size of world |
| Function | Description |
|---|---|
| GetTile | returns Tile if exists, otherwise nil |
| GetPlayer | returns NetAvatar if exists, otherwise nil |
| GetPlayers | returns NetAvatar table |
| GetDrop | returns WorldObject if exists, otherwise nil |
| GetDrops | returns WorldObject table |
ItemInfo
| Type | Name | Description |
|---|---|---|
| int | id | item id |
| int | type | item type |
| string | name | item name |
| string | texture | texture name of item |
| int | textureX | |
| int | textureY | |
| int | hitsToDestroy | |
| int | rarity |
Vector2
| Type | Name |
|---|---|
| int | x |
| int | y |
Constructor:
Vector2(x, y)
Vector3
| Type | Name |
|---|---|
| int | x |
| int | y |
| int | z |
Constructor:
Vector3(x, y, z)
Execute
Executes lua code
Example usage:
Engine.Execute("print('Hello World')") -- Prints "Hello World"
RandomInt
Returns random int in range
Example usage:
local number = Engine.RandomInt(0, 100)
print(number) -- Prints random integer between 0 and 100
RandomStr
Returns random string
Example usage:
local str = Engine.RandomStr(10)
print(str) --Prints random string
ShowConsole
Creates console window
Example usage:
Engine.ShowConsole()
HideConsole
Hides console window
Example usage:
Engine.HideConsole()