SetVal (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 20:48, 14 August 2014 by AFRLme (talk) (Created page with "{| class="wikitable" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | setVal("v", n) || Definition...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Name Type By
setVal("v", n) Definition AFRLme

This small function allows you to quickly set the string or integer value of a value; automatically determines if n is a string or integer.

Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2a. To use this function you should create an execute a script action containing...

setVal("value_name", 7) -- set integer value of "value_name" to 7

2b. Alternatively to set string value of a value...

setVal("value_name", "hello world") -- set string value of "value name" to "hello world"

Main Script

function setCondition(v, n)
 if n:type = "number" then
  getObject("Values[" .. v .. "]"):setValue(VValueInt, n) else getObject("Values[" .. v .. "]"):setValue(VValueString, n)
 end
end

Syntax Breakdown

Name Type Description
v "string" This should be a "string" value containing the name of the value you want to affect.
n "string" or integer (number) This should contain a "string" or integer value.