[Closed] Data input to max script
This may be a stupid question but here goes…
I’ve been using 3ds Max since the early, early days of DOS. However, I have rarely tapped into the scripting capabilities. I’ve been a little scared too to be honest. I’m not a programmer and I’m not strong in math and I thought you had to have a firm grasp on both to use maxscript. I now know this is just plain false. So, armed with that knowledge, here’s my question…
Is there any way to input data into Maxscript to have it affect objects in the scene? For instance. If I want to set up a scene that says Monday on Monday and Tuesday on Tuesday, etc. Have a script run so that Maxscript knows what time it is or what day of the week it is based on the clock on your computer. Same thing with temperatures or any other external data coming into maxscript. Is this possible? If so, can someone point me to some good tutorials?
Thanks in advance for any help you guys can give me here…
yes you can input data in to max script, I use data from a text file all the time in my scripts.
filestream is the command you want to look into.
edit sorry I did not read all your post . Im sure you can get the time but cant remember what the script would be sorry, but it can be done
-Filestream can load data if you have a text file being modified somewhere.
-I posted a MySQL interface tutorial a year or so ago here.
-There is an ongoing Python discussion which has some info on external data interfaces using python.
- There is also a Maxscript command that will get the current system time (which can include date I believe for your Monday, Tuesday,… etc example.
Most excellent. I figured there was a way to do this but can’t find any documentation on it. Even if I found it, it’s not likely that I’d even know if I found it or not.
Do you guys have any recommendations on the best way to go about learning this type of scripting, I mean, really in depth?
I would go to scriptspot and have a look at some of the scripts there , open them up and see how they work , and most of all the online help that comes with 3d max . open up the script window and hit F1 this will bring up the MaxScript help files.
good luck
Here is how to get the day of the week :
global monthName = #( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" )
global dayName = #( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" )
global monthKey = #( 2, 5, 5, 1, 3, 6, 1, 4, 7, 2, 5, 7 ) -- Holds first day index for each month of 1990 year
fn dayOfWeek month date year =
(
print month as string
print date as string
print year as string
day = ( year - 1900 ) + ( year - 1900 ) / 4 + monthKey[month] + date - 1
if(( year > 1900 ) and ( mod year 4 == 0 ) and ( month < 2 ) ) then day = -1
day = (mod day 7) as integer
)
-- Parse localTime string
parsedTime = filterString localTime " "
date = parsedTime[1]
parsedDate = filterString date "/"
-- Change date and month index according to your region
dateNumber = parsedDate[1] as integer
monthNumber = parsedDate[2] as integer
yearNumber = parsedDate[3] as integer
-- Get day of week
day = dayOfWeek monthNumber dateNumber yearNumber
print (dayName[day] as string)
Please visit this page for the explanation : http://www.cs.unc.edu/~livingst/DateToDay/
Wow, thanks! I’m going to try this first thing today! Thanks, thanks, thanks!!!