Difference between revisions of "SetSceneBrightness (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m |
m |
||
Line 41: | Line 41: | ||
! 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 | ||
|- | |- | ||
− | | scn || "string" or nil || This should be a "string" value containing the name of the scene you want to affect; | + | | scn || "string" or nil || This should be a "string" value containing the name of the scene you want to affect; or nil to link to the current scene. |
|- | |- | ||
| val || integer || This should be a number value which will determine the brightness value of the specifed/current scene. | | val || integer || This should be a number value which will determine the brightness value of the specifed/current scene. |
Latest revision as of 19:50, 23 August 2022
Name | Type | By |
---|---|---|
setSceneBrightness("scn", val, duration) | Definition | AFRLme |
This small function quickly allows you to immediately set the brightness value of the current scene or a specific scene; or over x duration, if desired.
Instructions
1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2a. Usage Example #1: immediately update the brightness belonging to a specific scene to 80 percent.
setSceneBrightness("scene_name", 80)
2b. Usage Example #2: immediately update the brightness belonging to the current scene to 80 percent.
setSceneBrightness(nil, 80)
2c. Usage Example #3: update the brightness belonging to the current scene to 80 percent over 1000ms.
setSceneBrightness(nil, 80, 1000)
Main Script
function setSceneBrightness(scn, val, duration)
if scn == nil then scn = game.CurrentScene or scn = Scenes[scn] end -- check current scene or specific scene
duration = duration or 0 -- fallback in case duration equals nil
-- + --
scn:to(duration, {Brightness = val}) -- update specified scene brightness
end
Syntax Breakdown
Name | Type | Description |
---|---|---|
scn | "string" or nil | This should be a "string" value containing the name of the scene you want to affect; or nil to link to the current scene. |
val | integer | This should be a number value which will determine the brightness value of the specifed/current scene. |
duration | integer | This should contain a number value in milliseconds of how long you want the current scene brightness to take to get from the current value to the target value. |