I have updated and completed the aware module.
It now requires the ChatModule linked here
Artificially Intelligent Chatbot LUAU Algorithm [Open Source] - Resources / Community Resources - Developer Forum | Roblox
The required module is located here
local aware = {}
local chatmodule=require(script.Parent.ChatModule)
syntheticdatasynonms={
{"very close","quite close","extremely close"},
{"close","near","not far"},
{"kind of close","pretty near","somewhat near"},
{" tiny "," mini "," minuscule "},
{" small "," little "," petite "},
{" large "," big ","huge"},
{"gigantic","colossal","massive"},
{"a few","some","a couple"},
{"many","numerous","several"},
{"lots of","tons of","a good number of"},
{"There is","Over there is"},
{"I see","I can see"},
{"Nearby is","Close by is"},
{"Additionally","Furthermore","Moreover"},
{"Also","In addition","Plus"},
{"However","But","Though"},
{"to the north","northward","northern"},
{"to the south","southward","southern"},
{"to the east","eastward","eastern"},
{"to the west","westward","western"}
}
function aware.GetCombatDescription(Char)
local MagicID=Char:FindFirstChild("MagicID")
if MagicID~=nil then
local fly=""
local Aggression=""
local AttackVector=""
local Barrier=""
local Buffs=""
local BaseHealth=""
local BaseMagicDMG=""
local BaseRangeDMG=""
local BaseMeleeDMG=""
local CanBeFrozen=""
local ChangeStyles=""
local Cooldown=""
local Cost=""
local CostMax=""
local Cure=""
local Description=""
local Dodge=""
local Element=""
local Element2=""
local Element3=""
local Hide=""
local Level=""
local MainStyle=""
local Multiply=""
local Paralyze=""
local Poison=""
local Power=""
local Prayer=""
local ProtectFromStyle=""
local Recoil=""
local Range=""
local Parasite=""
local Species=""
local Teleport=""
local Transform=""
local Weakness=""
--construct a long combined string of the above local strings.
if MagicID:GetAttribute("Aggression")==1 then
Aggression="aggressive, "
end
if MagicID:GetAttribute("Fly")==true then
fly="can Fly, "
end
if MagicID:GetAttribute("Barrier")==true then
Barrier="uses Barrier, "
end
if MagicID:GetAttribute("Buffs")==true then
Buffs="uses Buffs, "
end
if MagicID:GetAttribute("Multiply")==true then
Buffs="uses Multiply, "
end
if MagicID:GetAttribute("ChangeStyle")==true then
ChangeStyles="melee and magic user, "
BaseMagicDMG="base Magic DMG:"..tostring(MagicID:GetAttribute("BaseMagicDMG"))..", "
BaseMagicDMG="base Melee DMG:"..tostring(MagicID:GetAttribute("BaseMeleeDMG"))..", "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="Melee Range:"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
--if MagicID:GetAttribute("MainStyles")~=nil then
-- if MagicID:GetAttribute("MainStyles")==1 then
-- MainStyle="Melee focused, "
-- elseif MagicID:GetAttribute("MainStyles")==2 then
-- MainStyle="Magic focused, "
-- elseif MagicID:GetAttribute("MainStyles")==3 then
-- MainStyle="Range focused, "
-- end
--end
elseif MagicID:GetAttribute("ChangeStyle")==false then
if MagicID:GetAttribute("MainStyles")~=nil then
if MagicID:GetAttribute("MainStyles")==1 then
MainStyle="Melee only, "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="Melee Range:"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
elseif MagicID:GetAttribute("MainStyles")==2 then
MainStyle="Magic only, "
elseif MagicID:GetAttribute("MainStyles")==3 then
MainStyle="Range only, "
end
end
end
if MagicID:GetAttribute("BaseHealth")~=nil then
BaseHealth="Base Health "..tostring(MagicID:GetAttribute("BaseHealth"))..", "
end
--write code to complete above context
if MagicID:GetAttribute("CanBeFrozen")==false then
CanBeFrozen="cannot be Frozen, "
end
if MagicID:GetAttribute("Cooldown")~=nil then
Cooldown="Cooldown:"..tostring(MagicID:GetAttribute("Cooldown"))..", "
end
if MagicID:GetAttribute("Cost")~=nil then
Cost="Power Cost:"..tostring(MagicID:GetAttribute("Cost"))..", "
end
if MagicID:GetAttribute("CostMax")~=nil then
CostMax="Max Power:"..tostring(MagicID:GetAttribute("CostMax"))..", "
end
if MagicID:GetAttribute("Cure")==true then
Cure="can Heal, "
end
if MagicID:GetAttribute("Description")~=nil then
Description=MagicID:GetAttribute("Description")..""
end
if MagicID:GetAttribute("Dodge")==true then
Dodge="can Dodge, "
end
if MagicID:GetAttribute("Teleport")==true then
Teleport="can Teleport, "
end
if MagicID:GetAttribute("Transform")==true then
Transform="can Transform, "
end
if MagicID:GetAttribute("Element")~=nil and MagicID:GetAttribute("Element")~="" then
Element=" /"..MagicID:GetAttribute("Element")
if MagicID:GetAttribute("Element2")~="" and MagicID:GetAttribute("Element2")~=nil then
Element2="/"..MagicID:GetAttribute("Element2")
end
if MagicID:GetAttribute("Element3")~="" and MagicID:GetAttribute("Element2")~=nil then
Element3="/"..MagicID:GetAttribute("Element3")
end
end
if MagicID:GetAttribute("Parasite")==true then
Parasite="Parasitic, "
end
if MagicID:GetAttribute("Poison")==true then
Poison="Poisonous, "
end
if MagicID:GetAttribute("Prayer")==true then
Prayer="uses Prayers, "
elseif MagicID:GetAttribute("ProtectFromStyle")==1 then
ProtectFromStyle="strong against Melee, "
elseif MagicID:GetAttribute("ProtectFromStyle")==2 then
ProtectFromStyle="strong against Magic, "
elseif MagicID:GetAttribute("ProtectFromStyle")==3 then
ProtectFromStyle="strong against Range, "
end
--Power="Power Multiplier:" MagicID:GetAttribute("Power")
--Range=""
if MagicID:GetAttribute("Recoil")==true then
Recoil="hurts to touch, "
end
--write rest of code for above context
return Description..Element..Element2..
Element3.." Type."..Level..ChangeStyles..MainStyle..Cooldown..fly..Aggression..Barrier..Buffs..BaseHealth..
BaseMagicDMG..BaseRangeDMG..BaseMeleeDMG..AttackVector..CanBeFrozen..
Cost..CostMax..Cure..Dodge..
Hide..Multiply..Paralyze..Poison..Power..
Prayer..ProtectFromStyle
end
end
function aware.DescribeNPC(Char)
local MagicID=Char:FindFirstChild("MagicID")
if MagicID~=nil then
local fly=""
local Aggression=""
local AttackVector=""
local Barrier=""
local Buffs=""
local BaseHealth=""
local BaseMagicDMG=""
local BaseRangeDMG=""
local BaseMeleeDMG=""
local CanBeFrozen=""
local ChangeStyles=""
local Cooldown=""
local Cost=""
local CostMax=""
local Cure=""
local Description=""
local Dodge=""
local Element=""
local Element2=""
local Element3=""
local Hide=""
local Level=""
local MainStyle=""
local Multiply=""
local Paralyze=""
local Poison=""
local Power=""
local Prayer=""
local ProtectFromStyle=""
local Recoil=""
local Range=""
local Parasite=""
local Species=""
local Teleport=""
local Transform=""
local Weakness=""
local rating=0
--construct a long combined string of the above local strings.
if MagicID:GetAttribute("Aggression")==1 then
Aggression="aggressive, "
rating=rating+1
end
if MagicID:GetAttribute("Fly")==true then
fly="can Fly, "
rating=rating+1
end
if MagicID:GetAttribute("Barrier")==true then
Barrier="uses Barrier, "
rating=rating+1
end
if MagicID:GetAttribute("Buffs")==true then
Buffs="uses Buffs, "
rating=rating+1
end
if MagicID:GetAttribute("Multiply")==true then
Buffs="uses Multiply, "
rating=rating+1
end
if MagicID:GetAttribute("ChangeStyle")==true then
ChangeStyles="melee and magic user, "
rating=rating+1
BaseMagicDMG="base Magic damage is"..tostring(MagicID:GetAttribute("BaseMagicDMG"))..", "
BaseMagicDMG="base Melee damage is"..tostring(MagicID:GetAttribute("BaseMeleeDMG"))..", "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="melee range is"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
elseif MagicID:GetAttribute("ChangeStyle")==false then
if MagicID:GetAttribute("MainStyles")~=nil then
if MagicID:GetAttribute("MainStyles")==1 then
MainStyle="uses Melee only, "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="melee range:"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
elseif MagicID:GetAttribute("MainStyles")==2 then
MainStyle="uses Magic only, "
elseif MagicID:GetAttribute("MainStyles")==3 then
MainStyle="uses Range only, "
end
end
end
if MagicID:GetAttribute("BaseHealth")~=nil then
local hpr=Char.Humanoid.MaxHealth/100
rating=rating+hpr
BaseHealth="base health "..tostring(MagicID:GetAttribute("BaseHealth"))..", "
end
--write code to complete above context
if MagicID:GetAttribute("CanBeFrozen")==false then
CanBeFrozen="cannot be frozen, "
rating=rating+1
end
if MagicID:GetAttribute("Cooldown")~=nil then
Cooldown="it's cooldown is "..tostring(MagicID:GetAttribute("Cooldown"))..", "
rating=rating+(5-MagicID:GetAttribute("Cooldown"))
end
if MagicID:GetAttribute("Cost")~=nil then
Cost="it's action cost is "..tostring(MagicID:GetAttribute("Cost"))..", "
rating=rating+1
end
if MagicID:GetAttribute("CostMax")~=nil then
CostMax="It's max power is"..tostring(MagicID:GetAttribute("CostMax"))..", "
end
if MagicID:GetAttribute("Cure")==true then
Cure="can Heal, "
rating=rating+1
end
if MagicID:GetAttribute("Description")~=nil then
Description=MagicID:GetAttribute("Description")..""
end
if MagicID:GetAttribute("Dodge")==true then
Dodge="can Dodge, "
rating=rating+1
end
if MagicID:GetAttribute("Teleport")==true then
Teleport="can Teleport, "
rating=rating+1
end
if MagicID:GetAttribute("Transform")==true then
Transform="can Transform, "
rating=rating+1
end
if MagicID:GetAttribute("Element")~=nil and MagicID:GetAttribute("Element")~="" then
Element="uses "..MagicID:GetAttribute("Element")
rating=rating+1
if MagicID:GetAttribute("Element2")~="" and MagicID:GetAttribute("Element2")~=nil then
Element2=","..MagicID:GetAttribute("Element2")
rating=rating+1
end
if MagicID:GetAttribute("Element3")~="" and MagicID:GetAttribute("Element2")~=nil then
Element3="and "..MagicID:GetAttribute("Element3")
rating=rating+1
end
end
if MagicID:GetAttribute("Parasite")==true then
Parasite=", it's parasitic"
rating=rating+1
end
if MagicID:GetAttribute("Poison")==true then
Poison=", it's poisonous"
rating=rating+1
end
if MagicID:GetAttribute("Prayer")==true then
Prayer="uses Prayers"
rating=rating+1
elseif MagicID:GetAttribute("ProtectFromStyle")==1 then
rating=rating+1
ProtectFromStyle=", strong against Melee"
elseif MagicID:GetAttribute("ProtectFromStyle")==2 then
rating=rating+1
ProtectFromStyle=", strong against Magic"
elseif MagicID:GetAttribute("ProtectFromStyle")==3 then
rating=rating+1
ProtectFromStyle=", strong against Range"
end
--Power="Power Multiplier:" MagicID:GetAttribute("Power")
--Range=""
if MagicID:GetAttribute("Recoil")==true then
rating=rating+1
Recoil="hurts to touch, "
end
rating=rating+tonumber(Level)
--write rest of code for above context
return Description..Element..Element2..
Element3.." magic. It's "..Level.." "..ChangeStyles..MainStyle..Cooldown..fly..Aggression..Barrier..Buffs..BaseHealth..
BaseMagicDMG..BaseRangeDMG..BaseMeleeDMG..AttackVector..CanBeFrozen..
Cost..CostMax..Cure..Dodge..
Hide..Multiply..Paralyze..Poison..Power..
Prayer..ProtectFromStyle..".",aware.judgepower(rating,25)
else return "",nil
end
end
local function tablehandler(location)
-- Get the folder from the workspace
local tableobj={}
local mapObjectsFolder = location
-- Check if the folder exists
if mapObjectsFolder then
-- Loop through the objects in the folder
for _, obj in pairs(mapObjectsFolder:GetChildren()) do
-- Add them to the stable
table.insert(tableobj, obj)
end
-- Connect a function to the ChildAdded event of the folder
mapObjectsFolder.ChildAdded:Connect(function(child)
-- Add the new object to the stable
table.insert(tableobj, child)
end)
-- Connect a function to the ChildRemoved event of the folder
mapObjectsFolder.ChildRemoved:Connect(function(child)
-- Find the index of the removed object in the stable
local index = table.find(tableobj, child)
-- Remove it from the stable
table.remove(tableobj, index)
end)
end
-- Return the stable
return tableobj
end
-- Call the function and assign it to a variable
mapObjects = tablehandler(workspace.MapObjects)
plants = tablehandler(workspace.Plants)
enemys=tablehandler(workspace.Enemys)
rubble = tablehandler(workspace.Rubble)
trees=tablehandler(workspace.Trees)
chests=tablehandler(workspace.Chests)
grounditems = tablehandler(workspace.grounditems)
houses=tablehandler(workspace.Houses)
playerstable=tablehandler(game.Players)
dungeons=tablehandler(workspace.DungeonRender)
npcs = tablehandler(workspace.NPCS)
function getnearest(list,root,dist,getone)
local list=list
local pos=root.Position
local torso = nil
local dist = 30
local temp = nil
local human = nil
local temp2 = nil
local amnt=0
local scope=nil
local list=list
if list~=nil then
for x = 1, #list do
temp2 = list[x]
if temp2==root.Parent then
temp=nil
elseif temp2:IsA("BasePart") then
temp = temp2
elseif temp2:IsA("Model") then
if temp2.PrimaryPart~=nil then
temp=temp2.PrimaryPart
else
temp=temp2:FindFirstChildOfClass("BasePart")
end
elseif temp2:IsA("Player") then
temp=temp2.Character:FindFirstChild("HumanoidRootPart")
elseif temp2:IsA("Folder") then
local m=temp2:FindFirstChildOfClass("Model")
if m then
temp=m:FindFirstChildOfClass("BasePart")
end
end
if (temp ~= nil) then
if (temp.Position - pos).magnitude < dist then
amnt=amnt+1
torso = temp2
dist = (temp.Position - pos).magnitude
scope = temp.Size
if getone==true then
return torso,scope
end
end
end
end
end
return torso,amnt,scope
end
function aware.judgedistance(position, position2, maxDist)
local distVector = (position - position2).Magnitude
local judgedDist = {0.2, 0.4, 0.6, 0.8, 1, 1.5, 2}
local judgeStrings = {{"very close"}, {"close"}, {"kind of close"},{"not far"}, {"kinda far"}, {"far"}, {"very far"}}
local index = 1
local distanceJudge = ""
repeat
if distVector <= maxDist * judgedDist[index] then
distanceJudge = judgeStrings[index]
break
end
index = index + 1
until index > #judgedDist
-- Get direction
local dirVector = (position2 - position).Unit -- Unit vector pointing to position2
local angle = math.atan2(dirVector.Z, dirVector.X) -- Angle in radians
local dirName = ""
if angle > math.rad(157.5) or angle < math.rad(-157.5) then
dirName = "south"
elseif angle > math.rad(112.5) then
dirName = "southwest"
elseif angle > math.rad(67.5) then
dirName = "west"
elseif angle > math.rad(22.5) then
dirName = "northwest"
elseif angle > math.rad(-22.5) then
dirName = "north"
elseif angle > math.rad(-67.5) then
dirName = "northeast"
elseif angle > math.rad(-112.5) then
dirName = "east"
else
dirName = "southeast"
end
return distanceJudge,dirName
end
function aware.judgeamnt(amnt,judgestrings)
local judgedistribution={1,2,3,4,5,6,8}
local judgestrings={{"a single"},{"a couple"},{"a few"},{"a quartet"},{"several"},{"a bunch"},{"a lot"}}
local index=1
repeat
local distvector=amnt
if distvector<=judgedistribution[index] then
return judgestrings[index][1]
end
until index>=#judgedistribution
end
function aware.judgething(size, bigSize,judgeSizes,judgeStrings)
local index = 1
local sizeJudge = ""
for i, judge in ipairs(judgeSizes) do
if size <= bigSize * judge then
local sizeJudge2 = judgeStrings[i]
sizeJudge=sizeJudge2[math.random(1,#sizeJudge)]
break
end
end
return sizeJudge
end
function aware.judgesize(size, bigSize)
local judgeSizes = {0.1, 0.25, 0.5, 0.75, 1, 1.5, 2}
local judgeStrings = {{"tiny"}, {"small"}, {"medium-small"}, {"medium"}, {"medium-large"}, {"large"}, {"huge"}}
local sizeJudge= aware.judgething(size, bigSize,judgeSizes,judgeStrings)
return sizeJudge
end
function aware.judgepower(power, bigpower)
local judgeSizes = {0.1, 0.25, 0.5, 0.75, 1, 1.5, 2}
local judgeStrings = {{"very weak"}, {"weak"}, {"kind of weak"}, {"average"}, {"kind of strong"}, {"strong"}, {"powerful"}}
local sizeJudge= aware.judgething(power, bigpower,judgeSizes,judgeStrings)
return sizeJudge
end
function aware.judgeobject(instance)
if instance:FindFirstChild("Humanoid")~=nil then
return instance.Humanoid.DisplayName
elseif instance:IsA("folder")~=nil then
return instance.Name
elseif instance:IsA("BasePart") then
local s=instance:FindFirstChild("Species")
if s~=nil then
return s.Value
end
elseif instance:IsA("Model") then
return instance.Name
end
end
function aware.getsurroundingobjects(root)
local closestPlant, numPlants,plantsize = getnearest(plants, root, 40)
local closestTree, numTrees = getnearest(trees, root, 80)
local closestStructure, numStructures,structuresize = getnearest(mapObjects, root, 160)
local closestEnemy, numEnemies = getnearest(enemys, root, 60)
local closestNPC, numNPCs = getnearest(npcs, root, 60)
local closestPlayer, numPlayers = getnearest(playerstable, root, 80)
local closestRubble, numRubble = getnearest(rubble, root, 20)
local closestChest, numChests = getnearest(chests, root, 30)
local closestGroundItem, numGroundItems = getnearest(grounditems, root, 40)
local closestHouse, numHouses,housesize = getnearest(houses, root, 100)
local closestDungeon, numDungeons,dungsize = getnearest(dungeons, root, 200)
local pos=root.Position
local function describeTrees()
if numTrees > 0 then
local treeText = aware.judgeamnt(numTrees).." of trees surround the area"
return treeText
end
end
local function describePlants()
if numPlants > 0 then
local plantText = aware.judgeamnt(numPlants).." of plants are scattered around"
return plantText
end
end
local function describeRubble()
if numRubble > 0 then
local rubbleText = aware.judgeamnt(numRubble).." of pieces of rubble lay on the ground"
return rubbleText
end
end
local function describeEnemies()
if numEnemies > 0 then
local enemyText = aware.judgeamnt(numEnemies).." of enemies are lurking nearby"
return enemyText
end
end
local function describeNPCs()
if numNPCs > 0 then
local npcText = aware.judgeamnt(numNPCs).." of strangers are in the area"
return npcText
end
end
local function describePlayers()
if numPlayers > 0 then
local playerText = aware.judgeamnt(numPlayers).." of players are nearby"
return playerText
end
end
local function describeChests()
if numChests > 0 then
local chestText = aware.judgeamnt(numChests).." of chests are scattered around"
return chestText
end
end
local function describeGroundItems()
if numGroundItems > 0 then
local groundItemText = aware.judgeamnt(numGroundItems).." of items lay on the ground"
return groundItemText
end
end
local function describeHouses()
if numHouses > 0 then
local houseText = aware.judgeamnt(numHouses).." of houses stand nearby"
return houseText
end
end
local function describeDungeons()
if numDungeons > 0 then
local dungeonText = aware.judgeamnt(numDungeons).." of areas around here."
return dungeonText
end
end
local function describestructures()
if numStructures > 0 then
local structureText = aware.judgeamnt(numDungeons).." of interesting places to check out around here."
return structureText
end
end
local function describeSurroundings(pos)
local info = aware.getsurroundingobjects(pos)
local descStrings = {}
local opener={"Their are ","I see ","Surrounding us are "}
table.insert(descStrings, ""..describeTrees())
table.insert(descStrings, ""..describePlants())
table.insert(descStrings, ""..describeRubble())
table.insert(descStrings, ""..describeEnemies())
table.insert(descStrings, ""..describeNPCs())
table.insert(descStrings, ""..describePlayers())
table.insert(descStrings, ""..describeChests())
table.insert(descStrings, ""..describeGroundItems())
table.insert(descStrings, ""..describeHouses())
table.insert(descStrings, ""..describeDungeons())
-- Remove any nil values
local finalStrings = {}
local paragraphstring=""
for i,str in ipairs(descStrings) do
if str ~= "" then
--table.insert(finalStrings, opener[math.random(1,#opener)]..str..".")
paragraphstring=paragraphstring..str..", "
end
end
if paragraphstring~="" then
paragraphstring=opener[math.random(1,#opener)]..paragraphstring.."."
table.insert(finalStrings,paragraphstring)
end
-- Join the strings together
return finalStrings
end
local function describeSurroundings2(pos)
local info = aware.getsurroundingobjects(pos)
local function describeRubble2(context)
local rubbleText = ""
if closestRubble then
local dist, dir = aware.judgedistance(pos, closestRubble.Position, 20)
local size = aware.judgesize(closestRubble.Size)
rubbleText = "piece of " ..size.. " rubble is " ..dist.. " to the " ..dir
end
if numRubble > 1 then
if context==nil then
return rubbleText,aware.judgeamnt(numRubble).. " of pieces of rubble lay on the ground"
else
rubbleText = rubbleText .. context.. aware.judgeamnt(numRubble).. " of pieces of rubble lay on the ground"
end
end
return rubbleText
end
local function describeChests2(context)
local chestText = ""
if closestChest then
local dist, dir = aware.judgedistance(pos, closestChest.PrimaryPart.Position, 30)
--local size = aware.judgesize(closestChest.Size)
chestText = "chest is " ..dist.. " to the " ..dir
end
if numChests > 1 then
if context==nil then
return chestText,aware.judgeamnt(numChests).." of chests are scattered around"
else
chestText = chestText .. context .. aware.judgeamnt(numChests).." of chests are scattered around"
end
end
return chestText
end
local function describeGroundItems2(context)
local groundItemText = ""
if closestGroundItem then
local dist, dir = aware.judgedistance(pos, closestGroundItem.Item:FindFirstChildOfClass("BasePart").Position, 40)
local size = aware.judgesize(closestGroundItem.Size)
groundItemText = aware.judgeobject(closestGroundItem)" is " ..dist.. " to the " ..dir
end
if numGroundItems > 1 then
if context==nil then
return groundItemText,aware.judgeamnt(numGroundItems).." of items lay on the ground"
else
groundItemText = groundItemText .. context .. aware.judgeamnt(numGroundItems).." of items lay on the ground"
end
end
return groundItemText
end
local function describeHouses2(context)
local houseText = ""
if closestHouse then
local dist, dir = aware.judgedistance(pos, closestHouse.Position, 100)
local size = aware.judgesize(closestHouse.Size)
houseText = "" ..size.. " house is " ..dist.. " to the " ..dir
end
if numHouses > 1 then
if context==nil then
return houseText,aware.judgeamnt(numHouses).." of other houses stand nearby"
else
houseText = houseText .. context .. aware.judgeamnt(numHouses).." of other houses stand nearby"
end
end
return houseText
end
local function describestructures2(context)
if numStructures > 0 then
local structureText = aware.judgeamnt(numDungeons).." of interesting places to check out around here"
return structureText
end
local dungeonText=""
if closestDungeon then
local dist, dir = aware.judgedistance(pos, closestStructure.PrimaryPart.Position, 200)
local size = aware.judgesize(closestStructure.PrimaryPart.Size)
dungeonText = aware.judgeobject(closestStructure).." is "..dist.. " to the " ..dir
end
if numStructures > 1 then
if context==nil then
return dungeonText,aware.judgeamnt(numStructures)" of interesting places to check out around here"
else
dungeonText = dungeonText .. context..aware.judgeamnt(numStructures)" of interesting places to check out around here"
end
end
end
local function describeDungeons2(context)
local dungeonText = ""
if closestDungeon then
local dist, dir = aware.judgedistance(pos, closestDungeon:FindFirstChildOfClass("BasePart").Position, 200)
local size = aware.judgesize(closestDungeon.Size)
dungeonText = aware.judgeobject(closestDungeon).." is "..dist.. " to the " ..dir
end
if numDungeons > 1 then
if context==nil then
return dungeonText,aware.judgeamnt(numDungeons)" of areas around here"
else
dungeonText = dungeonText .. context..aware.judgeamnt(numDungeons)" of areas around here"
end
end
return dungeonText
end
local function describeTrees2(context)
local treeText = ""
if closestTree then
local dist, dir = aware.judgedistance(pos, closestTree.PrimaryPart.Position, 160)
treeText = aware.judgeobject(closestTree).." is " ..dist.. " to the " ..dir
end
if numTrees > 1 then
if context==nil then
return treeText, aware.judgeamnt(numTrees).." of other trees surround the area"
else
treeText = treeText ..context.. aware.judgeamnt(numTrees).." of other trees surround the area"
end
end
return treeText
end
local function describePlants2(context)
local plantText = ""
if closestPlant then
local dist, dir = aware.judgedistance(pos, closestPlant.Position, 40)
local size = aware.judgesize(closestPlant.Size)
plantText =size.. " "..aware.judgeobject(closestPlant).." is " ..dist.. " to the " ..dir
end
if numPlants > 1 then
if context==nil then
return plantText, aware.judgeamnt(numPlants).." of other plants are scattered around"
else
plantText = plantText ..context.. aware.judgeamnt(numPlants).." of other plants are scattered around"
end
end
return plantText
end
local function describeEnemies2(context)
local enemyText = ""
if closestEnemy then
local dist, dir = aware.judgedistance(pos, closestEnemy.HumanoidRootPart.Position, 60)
enemyText = aware.judgeobject(closestEnemy).. " is " ..dist.. " to the " ..dir
end
if numEnemies > 1 then
if context==nil then
return enemyText,aware.judgeamnt(numEnemies).." enemies are lurking nearby"
else
enemyText = enemyText ..context.. aware.judgeamnt(numEnemies).." enemies are lurking nearby"
end
end
return enemyText
end
local function describePlayers2(context)
local enemyText = ""
if closestPlayer then
local dist, dir = aware.judgedistance(pos, closestPlayer.Character.HumanoidRootPart.Position, 80)
enemyText = aware.judgeobject(closestEnemy).. " is " ..dist.. " to the " ..dir
end
if numPlayers > 1 then
if context==nil then
return enemyText,aware.judgeamnt(numPlayers).." of players are nearby"
else
enemyText = enemyText ..context.. aware.judgeamnt(numPlayers).." of players are nearby"
end
end
return enemyText
end
local function describeNPCs2(context)
local npcText = ""
if closestNPC then
local dist, dir = aware.judgedistance(pos, closestNPC.HumanoidRootPart.Position, 80)
npcText = aware.judgeobject(closestNPC).." is " ..dist.. " to the " ..dir
end
if numNPCs > 1 then
if context==nil then
return npcText,aware.judgeamnt(numNPCs).." of strangers are in the area"
else
npcText = npcText ..context.. aware.judgeamnt(numNPCs).." strangers are in the area"
end
end
return npcText
end
local descStrings = {}
local opener={"Their are ","I see ","Surrounding us are "}
table.insert(descStrings, ""..describeTrees2(", and their are "))
table.insert(descStrings, ""..describePlants2(", and their are "))
table.insert(descStrings, ""..describeRubble2(", and their are "))
table.insert(descStrings, ""..describeEnemies2(", and their are "))
table.insert(descStrings, ""..describeNPCs2(", and their are "))
table.insert(descStrings, ""..describePlayers2(", and their are "))
table.insert(descStrings, ""..describeChests2(", and their are "))
table.insert(descStrings, ""..describeGroundItems2(", and their are "))
table.insert(descStrings, ""..describeHouses2(", and their are "))
table.insert(descStrings, ""..describeDungeons2(", and their are "))
local descStrings2 = {}
local opener2={"Their is ","","I can see "}
local tre,tree2=describeTrees2()
local plan,plan2=describePlants2()
local rub,rub2=describeRubble2()
local enem,enem2=describeEnemies2()
local npc1,npc2=describeNPCs2()
local plr1,plr2=describePlayers2()
local chest,ches2=describeChests2()
local g1,g2=describeGroundItems2()
local hous,house=describeHouses2()
local dung,dungeon=describeDungeons2()
local struc,struc2=describestructures2()
local function DetermineGoal()
local interest=""
if closestPlayer then
interest=interest.." I can see that "..plr1..""
end
if enem then
if interest~="" then
interest=interest..", w"
else
interest="W"
end
interest=interest.."atch out, their is "..enem..""
end
if npc1 then
if closestPlayer and interest~="" then
interest=interest..", and"
end
interest=interest.." "..npc1..""
end
if dung then
--if not npc1 and interest~="" then
-- interest=interest..", we "
--else
-- interest=interest.." We "
--end
if interest~="" then
interest=interest.."."
end
interest=interest.." We are in a place called "..aware.judgeobject(closestDungeon)..""
end
if struc then
if interest~="" then
interest=interest.."."
end
interest=interest.." Their is a "..struc
end
if chest then
if interest~="" then
interest=interest.."."
end
interest=interest.." I notice a "..chest..""
end
if g1 then
if interest~="" then
interest=interest..","
end
interest=interest..g1
end
if hous then
if struc and interest~="" then
interest=interest.."."
end
interest=interest.." I can see a "..hous..""
end
if tree2 then
if interest~="" then
interest=chatmodule.randomizeString(interest..". Additionally, t")
else
interest=interest.."T"
end
interest=interest.."heir are "..tree2
end
if plan2 then
if interest~="" then
interest=interest..","
else
interest=interest.." Their are "
end
interest=interest..""..plan2..""
end
if interest~="" then
interest=interest.."."
end
return interest
end
--example enemyText = aware.judgeobject(closestEnemy.Parent).. " is " ..dist.. " to the " ..dir
--return enemyText,aware.judgeamnt(numPlayers).." of players are nearby"
-- enemyText = enemyText ..context.. aware.judgeamnt(numPlayers).." of players are nearby"
-- Remove any nil values
local finalStrings = {}
local paragraphstring=""
for i,str in ipairs(descStrings) do
if str ~= "" then
table.insert(finalStrings, opener[math.random(1,#opener)]..str..".")
paragraphstring=paragraphstring..str..", "
end
end
table.insert(finalStrings,DetermineGoal())
if paragraphstring~="" then
paragraphstring=paragraphstring.."."
table.insert(finalStrings,paragraphstring)
end
-- Join the strings together
return finalStrings
end
local d1=describeSurroundings(pos)
local d2=describeSurroundings2(pos)
local syntheticdata= function()
for i,str in ipairs(d1) do
if str ~= "" then
table.insert(d2, str)
--paragraphstring=paragraphstring..str..", "
end
end
for i,str in ipairs(d2) do
if str ~= "" then
d2[i]=chatmodule.randomizeStringLight(str,syntheticdatasynonms)
--paragraphstring=paragraphstring..str..", "
end
end
return d2
end
return syntheticdata()
--,
--{
-- closestPlant = closestPlant,
-- numPlants = numPlants,
-- plantsize = plantsize,
-- closestTree = closestTree,
-- numTrees = numTrees,
-- closestStructure = closestStructure,
-- numStructures = numStructures,
-- structuresize = structuresize,
-- closestEnemy = closestEnemy,
-- numEnemies = numEnemies,
-- closestNPC = closestNPC,
-- numNPCs = numNPCs,
-- closestPlayer = closestPlayer,
-- numPlayers = numPlayers,
-- closestRubble = closestRubble,
-- numRubble = numRubble,
-- closestChest = closestChest,
-- numChests = numChests,
-- closestGroundItem = closestGroundItem,
-- numGroundItems = numGroundItems,
-- closestHouse = closestHouse,
-- numHouses = numHouses,
-- housesize,
-- closestDungeon = closestDungeon,
-- numDungeons = numDungeons,
-- dungsize = dungsize
--}
end
return aware