Create EditorClient Script

A client script needs to be created that will require the ASCIIEditor API and call the Build function. At the same time, it will pass in all the custom properties that are required.

Create a new script called EditorClient and place it inside the Client folder.

Add Custom Properties

The EditorClient script will need to have quite a few custom properties added so that the buttons, grid, and text are dynamically created when playing the game.

  1. From the Editor folder under My Scripts in Project Content, add the ASCIIEditor script as a custom property called ASCIIEditor.
  2. In the Hierarchy find the Map panel and add it as a custom property called Map.
  3. In the Hierarchy find the UI Scroll Panel inside the Map panel and add it as a custom property called MapScrollPanel.
  4. In the Hierarchy find the Right Controls panel and add it as custom property called Controls.
  5. In the Hierarchy find the UI Scroll Panel inside the Right Controls panel and add it as a custom property called ControlsScrollPanel.
  6. In the Hierarchy find the Increase Width button and add it as a custom property called IncreaseWidth.
  7. In the Hierarchy find the Decrease Width button and add it as a custom property called DecreaseWidth.
  8. In the Hierarchy find the Increase Height button and add it as a custom property called IncreaseHeight.
  9. In the Hierarchy find the Decrease Height button and add it as a custom property called DecreaseHeight.
  10. In the Hierarchy find the Width text and add it as a custom property called WidthText.
  11. In the Hierarchy find the Height text and add it as a custom property called HeightText.
  12. In the Hierarchy find the Export ASCII button and add it as a custom property called ExportASCII.

Edit EditorClient Script

Open up the EditorClient script and require the ASCIIEditor API script.

local ASCIIEditor = require(script:GetCustomProperty("ASCIIEditor"))
Code language: Lua (lua)

Call Build Function

The final set is to call the Build function and pass in all the options.

ASCIIEditor.Build({

	WIDTH = 10,
	HEIGHT = 10,
	MAP = script:GetCustomProperty("Map"):WaitForObject(),
	MAP_SCROLL_PANEL = script:GetCustomProperty("MapScrollPanel"):WaitForObject(),
	CONTROLS = script:GetCustomProperty("Controls"):WaitForObject(),
	CONTROLS_SCROLL_PANEL = script:GetCustomProperty("ControlsScrollPanel"):WaitForObject(),
	INCREASE_WIDTH = script:GetCustomProperty("IncreaseWidth"):WaitForObject(),
	DECREASE_WIDTH = script:GetCustomProperty("DecreaseWidth"):WaitForObject(),
	INCREASE_HEIGHT = script:GetCustomProperty("IncreaseHeight"):WaitForObject(),
	DECREASE_HEIGHT = script:GetCustomProperty("DecreaseHeight"):WaitForObject(),
	WIDTH_TEXT = script:GetCustomProperty("WidthText"):WaitForObject(),
	HEIGHT_TEXT = script:GetCustomProperty("HeightText"):WaitForObject(),
	EXPORT_ASCII = script:GetCustomProperty("ExportASCII"):WaitForObject()

})
Code language: Lua (lua)

The EditorClient Script

local ASCIIEditor = require(script:GetCustomProperty("ASCIIEditor"))

ASCIIEditor.Build({

	WIDTH = 10,
	HEIGHT = 10,
	MAP = script:GetCustomProperty("Map"):WaitForObject(),
	MAP_SCROLL_PANEL = script:GetCustomProperty("MapScrollPanel"):WaitForObject(),
	CONTROLS = script:GetCustomProperty("Controls"):WaitForObject(),
	CONTROLS_SCROLL_PANEL = script:GetCustomProperty("ControlsScrollPanel"):WaitForObject(),
	INCREASE_WIDTH = script:GetCustomProperty("IncreaseWidth"):WaitForObject(),
	DECREASE_WIDTH = script:GetCustomProperty("DecreaseWidth"):WaitForObject(),
	INCREASE_HEIGHT = script:GetCustomProperty("IncreaseHeight"):WaitForObject(),
	DECREASE_HEIGHT = script:GetCustomProperty("DecreaseHeight"):WaitForObject(),
	WIDTH_TEXT = script:GetCustomProperty("WidthText"):WaitForObject(),
	HEIGHT_TEXT = script:GetCustomProperty("HeightText"):WaitForObject(),
	EXPORT_ASCII = script:GetCustomProperty("ExportASCII"):WaitForObject()

})
Code language: Lua (lua)

Test the Editor

Test the editor to make sure all the controls work, the grid resizing and exporting of the ASCII string.

Scroll to Top