I’m trying to make a script that sets up a few simple things for me. I could do it as Maxstart or use a few of several free scripts out there, but i’d rather do it myself and learn a bit. All i’m trying to do is set some values and create some things on script run. My current questions are:
- Howcome i’m getting (below)?
-- Error occurred in anonymous codeblock; filename: C:\Documents and Settings\George\Local Settings\Application Data\Autodesk\3dsMax\2010 - 64bit\enu\UI\usermacros\Scene Presets-ScenePresetDayExterior.mcr; position: 3445; line: 117
-- Syntax error: at if, expected <rollout clause>
-- In line: if c
Here’s the icons if anyone wants em. Pop them in 3dsmax/ui/icons and you can use them anywhere.

http://www.dukecg.net/Preset\_Icons.zip
macroScript ScenePresetDayExterior
category:"Scene Presets"
(
rollout scenePresetRollout "ScenePreset" width:160 height:128
(
checkbox chk_RenderSettings "Checkbox" pos:[8,8] width:16 height:16 checked:true
checkbox chk_SunSettings "Checkbox" pos:[8,32] width:16 height:16 checked:true
checkbox chk_CameraSettings "Checkbox" pos:[8,56] width:16 height:16 checked:true
checkbox chk_SkySettings "Checkbox" pos:[8,80] width:16 height:16 checked:true
label lbl_RenderSettings "Render Settings" pos:[32,8] width:120 height:16
label lbl_SunSettings "Sun Settings" pos:[32,32] width:120 height:16
label lbl_CameraSettings "Camera Settings" pos:[32,56] width:120 height:16
label lbl_SkySettings "Sky Settings" pos:[32,80] width:120 height:16
button btn_Load "Load" pos:[8,104] width:144 height:16
on btn_Load pressed do
fn RenderSettings =
(
vr = renderers.current
vr.output_on = true
vr.options_hiddenLights = false
vr.options_defaultLights = 2
vr.options_limitDepth = true
vr.options_maxDepth = 6
vr.options_ray_bias = 0.005
vr.imageSampler_type = 0
vr.filter_on = false
vr.fixedRate_subdivs = 2
vr.twoLevel_baseSubdivs = 1
vr.twoLevel_fineSubdivs = 16
vr.twoLevel_threshold = 0.01
vr.twoLevel_useDMCSamplerThresh = false
vr.colorMapping_type = 6
vr.colorMapping_gamma = 2.2
vr.colorMapping_affectBackground = true
vr.colorMapping_subpixel = true
vr.gi_on = true
vr.gi_refractCaustics = false
vr.gi_reflectCaustics = false
vr.gi_primary_type = 0
vr.gi_secondary_type = 2
vr.gi_irradmap_minRate = -5
vr.gi_irradmap_maxRate = -2
vr.gi_irradmap_colorThreshold = 1.0
vr.gi_irradmap_normalThreshold = 0.3
vr.gi_irradmap_distThreshold = 0.2
vr.gi_irradmap_showCalcPhase = true
vr.gi_irradmap_showDirectLight = true
vr.dmcgi_subdivs = 8
vr.dmcgi_depth = 3
vr.dmc_earlyTermination_amount = 0.95
vr.dmc_earlyTermination_threshold = 0.008
vr.system_region_x = 32
vr.system_region_y = 32
vr.system_lowThreadPriority = true
)
fn SunSettings =
(
fn GetSun =
(
vrSuns = for item in lights where ( (classof item == VRaySun) ) collect item
if vrSuns.count == 0 then vrSun = VRaySun()
else vrSun = vrSuns[1]
)
vrSun = GetSun()
vrSun.enabled = true
vrSun.invisible = true
vrSun.turbidity = 2.0
vrSun.shadow_subdivs = 6
vrSun.shadow_bias = 0.0
if vrSun.pos == [0,0,0] then vrSun.pos = [-100, -100, 100]
vrSun.target = targetObject pos:[0,0,0]
)
fn CamSettings =
(
fn GetCam =
(
vrCams = for item in cameras where ( (classof item == VRayPhysicalCamera) ) collect item
if vrCams.count == 0 then vrCam = VRayPhysicalCamera()
else vrCam = vrCams[1]
)
vrCam = GetCam()
vrCam.targeted = false
vrCam.f_number = 5.6
vrCam.vignetting = false
vrCam.shutter_speed = 320
vrCam.ISO = 65
vrCam.whiteBalance = [230, 246, 255]
if vrCam.pos == [0,0,0] then vrCam.pos = [0, -10, 1.7]
)
fn SkySettings =
(
if environmentMap == undefined then environmentMap = VRaySky()
)
if chk_RenderSettings.checked then RenderSettings()
if chk_SunSettings.checked then SunSettings()
if chk_CameraSettings.checked then CamSettings()
if chk_SkySettings.checked then SkySettings()
)
)