theMonkeysUncle
05-19-2010, 11:57 PM
Hi everyone
I'm just starting to learn MAXScript, and I know the basics, but I would like to figure out how to change a Daylight system that I have manually created using a script.
Based on this documentation (http://www.kxcad.net/autodesk/Autodesk_MAXScript_Reference_9/Daylight_System.htm), I've put together the following code:
$Daylight01.controller
Controller:Sunlight_Daylight_Slave_Controller
<Daylight_Slave_Controller>.solar_time Float
fn TimeFromSolarTime solar_time =
(
hrs = int(solar_time/3600.0) -- full hours in the solar_time value
min = int((solar_time - hrs*3600.0)/60.0) -- full minutes in the difference between the full time and the full hours
sec = int(solar_time - hrs*3600.0 - min*60.0 + 0.5) -- full seconds in the rest of the value
#(hrs,min,sec) -- return the result as a 3 elements array
)
I'm not exactly sure where to insert the actual desired time value (I've tried a few places). In any case, when I select the code and press Enter to run it, I get the following error:
Controller:Sunlight_Daylight_Slave_Controller
-- Error occurred in anonymous codeblock; filename: C:\Users\Jeremy\Documents\Modeling and Design\3dsMAX\scripts\lightcalc.ms; position: 37
-- Syntax error: at keyword parameter, expected <factor>
-- In line: Controller:S
There is precious little documentation on this, so I would appreciate the help!
I'm just starting to learn MAXScript, and I know the basics, but I would like to figure out how to change a Daylight system that I have manually created using a script.
Based on this documentation (http://www.kxcad.net/autodesk/Autodesk_MAXScript_Reference_9/Daylight_System.htm), I've put together the following code:
$Daylight01.controller
Controller:Sunlight_Daylight_Slave_Controller
<Daylight_Slave_Controller>.solar_time Float
fn TimeFromSolarTime solar_time =
(
hrs = int(solar_time/3600.0) -- full hours in the solar_time value
min = int((solar_time - hrs*3600.0)/60.0) -- full minutes in the difference between the full time and the full hours
sec = int(solar_time - hrs*3600.0 - min*60.0 + 0.5) -- full seconds in the rest of the value
#(hrs,min,sec) -- return the result as a 3 elements array
)
I'm not exactly sure where to insert the actual desired time value (I've tried a few places). In any case, when I select the code and press Enter to run it, I get the following error:
Controller:Sunlight_Daylight_Slave_Controller
-- Error occurred in anonymous codeblock; filename: C:\Users\Jeremy\Documents\Modeling and Design\3dsMAX\scripts\lightcalc.ms; position: 37
-- Syntax error: at keyword parameter, expected <factor>
-- In line: Controller:S
There is precious little documentation on this, so I would appreciate the help!
