Skip to content

dore0062/grid_tts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

grid_tts

TTS grid is used to make simple scripting zone grids for tabletop simulator, so you can more easily create advanced games that use grids.

Usage:

Atom:

Save to your atom's code folder as grid_tts.ttslua (NOT .lua) then put #include grid_tts at the top of your code.

Creating a new grid:

Initialize your grid with Myvalue = Grid:new()

You can now use Myvalue to preform grid functionality. The first command you should preform is

Myvalue:spawn(grid_width, grid_height, y_offset, x_offset, z_offset, cell_width, cell_height, cell_padding, spawn_location)

This will spawn scripting zones and place the scripting zone objects into the table. Your grid is now ready for use! To save the grid, just save the variable like you normally would in TTS.

Commands

Grid:circle(mode, x0, y0, radius)

Iterates through a circular area

Variable Usage Type
mode fill or line string
x0 Center x value number
y0 Center y value number
radius Radius of circle number

Grid:rectangle(mode, startX, startY, width, height)

-- Iterates through a rectangular area

Variable Usage Type
mode fill or line string
startX Lower left x value number
startY Lower left y value number
width Width of rectangle number
height Height of rectangle number

Grid:line(mode, startX, startY, endX, endY)

-- Iterates through a line

Variable Usage Type
mode rigid or smooth string
startX Starting x number
startY Starting y number
endX Ending x number
endY Ending y number

Other commands:

  • Grid:iterate() : Iterate through the entire grid.
  • Grid:clean() : Cleans any empty rows.
  • Grid:get(x, y) : Get the scripting zone of a cell

Example usage:

Use interchangably with any iteration, it all works the same.

  special_grid = Grid:new()
  special_grid:spawn(6, 3, 2.3, 0.1, 0.7, 2.6, 1.5, 0.5, spawn)
  for x, y, v in special_grid:circle("fill", 2, 2, 1) do print("Circle: ", x, ",", y, " ", v) end

Custom grids:

If you want to have custom scripting zones sizes, then you can include set them into the grid (the grid is initialized as a table)

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages