Designing A Dialog Tree page uses ** instead of "" and missing end

In the wiki page, Designing a Dialog Tree, they insert the ‘Graph’ module using this code:

local GraphModule = game:GetService(**InsertService**):LoadAsset(303855726):GetChildren()[1]
local Graph = require(GraphModule)
local DialogTree = Graph.new(Graph.GraphType.OneWay)

Whenever using GetService, it uses ** InsertService ** instead of “InsertService”

Correct Code:

local GraphModule = game:GetService("InsertService"):LoadAsset(303855726):GetChildren()[1]
local Graph = require(GraphModule)
local DialogTree = Graph.new(Graph.GraphType.OneWay)

Please read the first reply below, which includes another mistake in the same wiki page.

3 Likes

In Designing a Dialog Tree, there is a function called createDialogNode. However, there needs to be one more end keyword.

Old Code
local GraphModule = game:GetService('InsertService'):LoadAsset(303855726):GetChildren()[1]
local Graph = require(GraphModule)
local DialogTree = Graph.new(Graph.GraphType.OneWay)
 
local function createDialogNode(choice, response, priority, onSelected)
	local newNode = {}
	
	if not choice then
		choice = ""
	end
	newNode.Choice = choice
	
	if not response then
		response = ""
	end	
	newNode.Response = response
	
	if not priority then
		priority = math.huge
	end
	newNode.Priority = priority
	
	if not onSelected then
		onSelected = function() end
	end
	newNode.OnSelected = onSelected
	
	DialogTree:AddVertex(newNode)	
		
	return newNode
Fixed Code
local GraphModule = game:GetService('InsertService'):LoadAsset(303855726):GetChildren()[1]
local Graph = require(GraphModule)
local DialogTree = Graph.new(Graph.GraphType.OneWay)
 
local function createDialogNode(choice, response, priority, onSelected)
	local newNode = {}
	
	if not choice then
		choice = ""
	end
	newNode.Choice = choice
	
	if not response then
		response = ""
	end	
	newNode.Response = response
	
	if not priority then
		priority = math.huge
	end
	newNode.Priority = priority
	
	if not onSelected then
		onSelected = function() end
	end
	newNode.OnSelected = onSelected
	
	DialogTree:AddVertex(newNode)	
		
	return newNode
end
2 Likes