Notifications
Clear all

[Closed] [hepl] verry simple script needed ASAP

 t.A

Hi everyone,

Long story short, I need a script, which would read data from file, which has three rows and n columns of coordinates data and would create a sphere in those coordinates. Problem is my professor told this to me just now, that everything (presentation of my project, data collection etc.) must be done in two days so could you guys help me out?! Pleeeeeeaseeeee…I am desperate

7 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Dude, have you at least tried to start on the script yourself? It is your presentation after all, and two days are a LOOOONG time – as you said in the topic, the script is rather simple :o)

Here some ideas:

*Use OPENFILE to open the text file.
*Declare an empty array
*Use READVALUE inside a WHILE NOT EOF theFile DO () loop to read ALL values from the file.
*CLOSE the file
*Divide the elements COUNT in the array by 3 to figure out how many values there were in a row, let’s call this number R.
Loop FOR i = 1 TO R DO () , take the value with index i, the one with index i+R and the one with index [b]i+2R[/b] and put these three values into the .X, .Y and .Z components of a Point3 value.
*Use that Point3 value as the position of a new Sphere.

For an expert, writing the code shouldn’t take longer than 5 minutes. For a beginner, 2 days are still plenty of time to figure out the syntax of the above program…

If you have questions, please feel free to ask.
But I think it is a bad idea to wait for someone to do your homework…

Have a look at the Max-Script-Reference, ->how to -practical examples -> how to read Geometry Data From Text File

 t.A

what i dont know is the max syntax=/ this is the basic algorithm I need to put in max script
{
R = fread(filename)
n = length of file/3
for i=1;i++;n {

create_sphere (r(i);r(n+i);r(2n+i), radius 1, color )
create_light (r(i);r(n+i);r(2n+i),)
camera1->focus = sphere(i)
camera->position = (r(i) - 10 - i;r(n+i)- 10 - i; r(2n+i) + 20)
;and here I have to put some lag between sphere creation

}
}

Sorry if you get the impression that I what someone to do my homework for me, but its that I have to do very much (later I can send a link to result to show that its not just a hoax=) anyway thank you for helping me out=)

 t.A

i left a mistake there should be for camera position: camera->position = (r(i) – 10 + i;r(n+i)- 10 + i; r(2n+i) + 20)

oh and I forgot to mention that lag is linked to timeline, cause I need to make an animation out off all this…

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Sorry, did not mean to insult you.

So is this a BINARY file, or an ASCII file?

Plus, do you want a SINGLE sphere animated over time, or multiple spheres?

 t.A

no offence taken=)
its binary file, I have GPS coordinates over time, and Im investigating EGNOS geostationary satellite availability, so i need a small sphere in every place receiver outputted the position. I have a complete max model of a town (dam its slows down my machine very much) and i need to put there over 20000 points… also one more thing I forgot, lights are created only if availability conditions are met, that means I need a IF sentence with a respect to a second array, which stores o if the light should not be created and 1 if yes

 t.A

so does no one can help me out with this stuff??