Difference between revisions of "CheckCond (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "{| class="wikitable" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | checkCond("cond") || Definit...")
 
Line 3: Line 3:
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By
 
|-
 
|-
| checkCond("cond") || Definition || AFRLme
+
| checkCond("c") || Definition || AFRLme
 
|}
 
|}
  
Line 25: Line 25:
 
== Main Script ==
 
== Main Script ==
 
<syntaxhighlight>
 
<syntaxhighlight>
function checkCond(cond)
+
function checkCond(c)
  return getObject("Conditions[" .. cond .. "]"):getBool(VConditionValue)
+
  return getObject("Conditions[" .. c .. "]"):getBool(VConditionValue)
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 35: Line 35:
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description
 
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description
 
|-
 
|-
| cond || "string" || This should be a "string" value containing the name of the condition you want to check the boolean value of.
+
| c || "string" || This should be a "string" value containing the name of the condition you want to check the boolean value of.
 
|}
 
|}

Revision as of 21:20, 14 August 2014

Name Type By
checkCond("c") Definition AFRLme

This small function allows you to quickly return the boolean value of a condition; should only be used with if queries.

Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2a. To check if condition returns true, do something like this...

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

2b. To check if condition returns false, do something like this...

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

Main Script

function checkCond(c)
 return getObject("Conditions[" .. c .. "]"):getBool(VConditionValue)
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.