Difference between revisions of "CheckCond (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m |
|||
Line 16: | Line 16: | ||
-- add some actions here... | -- add some actions here... | ||
end | end | ||
− | </syntaxhighlight | + | </syntaxhighlight> |
2b. Usage Example #2: check if globally accessed condition returns <span class="red">false</span>. | 2b. Usage Example #2: check if globally accessed condition returns <span class="red">false</span>. | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
if not checkCond("condition_name") then | if not checkCond("condition_name") then | ||
-- add some actions here... | -- add some actions here... |
Revision as of 15:00, 23 August 2022
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 direct link condition 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. |