CheckCond (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Name Type By
checkCond("c", path) Definition AFRLme

This small function allows you to quickly return the boolean value of a condition.


Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2a. Usage Example #1: check if globally accessed condition returns true.

if checkCond("condition_name") then
 -- add some actions here...
end

2b. Usage Example #2: check if globally accessed condition returns false.

if not checkCond("condition_name") then
 -- add some actions here...
end

2c. Usage Example #3: check if condition linked to current scene returns true.

if checkCond("condition_name", game.CurrentScene) then
 -- add some actions here...
end

2d. Usage Example #4: check if globally accessed condition returns true via if lua result action part.

return checkCond("condition_name")


Main Script

function checkCond(c, path)
 if path == nil then c = Conditions[c] else c = path.Conditions[c] end -- check global access or direct link
 return c -- return the boolean value belonging to the condition
end


Syntax Breakdown

Name Type Description
c "string" This should be a "string" value containing the name of the condition you want to check the boolean value of.
path path This should contain the direct path to the condition, for example: game.CurrentScene or Scenes["example"] or Characters["Tom"], etc.