Hey guys, i like this forum it helped me already alot but i got a few things where i got stuck.
I want to write a script (MAXscript, from 3dsmax 9) to import a model from a game.
I can see the face/vertex sections when i open the model in a HEX-Editor but i dont know how should i continue in the script.
Are there any tutorials to write such a script? I have used the search and i found a tutorial to write a script to reverse a model but it didnt help me much.
I take every help i get, Tutorials/Videos/ or anything else
Thank you
Important information: this site is currently scheduled to go offline indefinitely by end of the year.
[Need Advice] Looking for help (Scripts)
-
- M-M-M-Monster veteran
- Posts: 2382
- Joined: Sat Apr 09, 2011 1:22 am
- Has thanked: 170 times
- Been thanked: 307 times
Re: [Need Advice] Looking for help (Scripts)
Where exactly are you stuck? You don't know the syntax? You don't know how to read the data? Not sure how to store them? Not sure how to pass the data to MAX?
-
- beginner
- Posts: 20
- Joined: Tue Jul 19, 2011 11:25 pm
- Location: Germany
- Has thanked: 1 time
- Contact:
Re: [Need Advice] Looking for help (Scripts)
finale00 wrote:Where exactly are you stuck? You don't know the syntax? You don't know how to read the data? Not sure how to store them? Not sure how to pass the data to MAX?
the syntax is quite okay, the MAXscript manual helps me, but the loop maybe for-loop? makes me stuck there, and im not sure to store or how to get the data (model) displayed in 3dsmax
i was looking for tutorials also outside of youtube but i havent found anything, i had a 6 part big tutorial to write a script but the user deleted the videos
-
- VIP member
- Posts: 1330
- Joined: Wed Nov 05, 2008 12:16 pm
- Has thanked: 2710 times
- Been thanked: 884 times
Re: [Need Advice] Looking for help (Scripts)
mariokart64n made some 3dsMax scripting videos but he made them private for some reason.
viewtopic.php?f=16&t=5644
viewtopic.php?f=16&t=5644
-
- ultra-veteran
- Posts: 603
- Joined: Fri Nov 06, 2009 12:13 am
- Has thanked: 74 times
- Been thanked: 137 times
Re: [Need Advice] Looking for help (Scripts)
there are many examples in the manual on for loops.
to create the mesh object from the vertex/face index data you need to store them in an array before you can create the 3ds 'mesh' object:
note face indices need to start from 1 (not 0)
you can create a mesh like so:
to create the mesh object from the vertex/face index data you need to store them in an array before you can create the 3ds 'mesh' object:
Code: Select all
arr_v = #()
for i = 1 to vertCount do
(
append arr_v [readfloat(f), readfloat(f), readfloat(f)]
)
you can create a mesh like so:
Code: Select all
mesh vertices:arr_v faces:arr_f
Useful tool links:
-
- beginner
- Posts: 20
- Joined: Tue Jul 19, 2011 11:25 pm
- Location: Germany
- Has thanked: 1 time
- Contact:
Re: [Need Advice] Looking for help (Scripts)
the bad thing is, i cant see them, even if i login with my youtube account.AceWell wrote:mariokart64n made some 3dsMax scripting videos but he made them private for some reason.
viewtopic.php?f=16&t=5644
-
- beginner
- Posts: 20
- Joined: Tue Jul 19, 2011 11:25 pm
- Location: Germany
- Has thanked: 1 time
- Contact:
Re: [Need Advice] Looking for help (Scripts)
WRS wrote:there are many examples in the manual on for loops.
to create the mesh object from the vertex/face index data you need to store them in an array before you can create the 3ds 'mesh' object:
note face indices need to start from 1 (not 0)Code: Select all
arr_v = #() for i = 1 to vertCount do ( append arr_v [readfloat(f), readfloat(f), readfloat(f)] )
you can create a mesh like so:
Code: Select all
mesh vertices:arr_v faces:arr_f
okay this start looking good, but for example the section for face indices or vertices start at offset 0x26CA, how do i tell the script to skip the other things and start from there?
-
- ultra-veteran
- Posts: 603
- Joined: Fri Nov 06, 2009 12:13 am
- Has thanked: 74 times
- Been thanked: 137 times
Re: [Need Advice] Looking for help (Scripts)
you might be familiar with fseek from other languages - the 3ds syntax is:Valerian wrote:WRS wrote:there are many examples in the manual on for loops.
to create the mesh object from the vertex/face index data you need to store them in an array before you can create the 3ds 'mesh' object:
note face indices need to start from 1 (not 0)Code: Select all
arr_v = #() for i = 1 to vertCount do ( append arr_v [readfloat(f), readfloat(f), readfloat(f)] )
you can create a mesh like so:
Code: Select all
mesh vertices:arr_v faces:arr_f
okay this start looking good, but for example the section for face indices or vertices start at offset 0x26CA, how do i tell the script to skip the other things and start from there?
Code: Select all
fseek f 0x26CA #seek_set
Useful tool links:
-
- beginner
- Posts: 20
- Joined: Tue Jul 19, 2011 11:25 pm
- Location: Germany
- Has thanked: 1 time
- Contact:
Re: [Need Advice] Looking for help (Scripts)
thank you so much! Now i can try moreWRS wrote:you might be familiar with fseek from other languages - the 3ds syntax is:Valerian wrote:WRS wrote:there are many examples in the manual on for loops.
to create the mesh object from the vertex/face index data you need to store them in an array before you can create the 3ds 'mesh' object:
note face indices need to start from 1 (not 0)Code: Select all
arr_v = #() for i = 1 to vertCount do ( append arr_v [readfloat(f), readfloat(f), readfloat(f)] )
you can create a mesh like so:
Code: Select all
mesh vertices:arr_v faces:arr_f
okay this start looking good, but for example the section for face indices or vertices start at offset 0x26CA, how do i tell the script to skip the other things and start from there?
(to skip data, use #seek_cur)Code: Select all
fseek f 0x26CA #seek_set
when i need more help i will post it here but first i want to try it
-
- beginner
- Posts: 20
- Joined: Tue Jul 19, 2011 11:25 pm
- Location: Germany
- Has thanked: 1 time
- Contact:
Re: [Need Advice] Looking for help (Scripts)
so guys, my script looks like this:
when i want to execute it i get the error:
-- Error occurred in i loop; filename: C:\Users\Admin\Desktop\test.ms; position: 329
-- Frame:
-- i: 1
-- Error occurred during fileIn in <File:C:\Users\Admin\Desktop\test.ms>
>> MAXScript FileIn Exception: -- Unable to convert: undefined to type: Float <<
what am i doing wrong?
also whats this:
for i = 1 to "vertCount" do
what is the vertCount or any explanation?
Code: Select all
fseek f 0x26CA #seek_cur
vx = float
vy = float
vz = float
i = float
arr_v = #()
for i = 1 to 177 do
(
vx = readfloat f
vy = readfloat f
vz = readfloat f
append (arr_v) [readfloat(f), readfloat(f), readfloat(f)]
print arr_v
)
mesh vertices:arr_v faces:arr_f
-- Error occurred in i loop; filename: C:\Users\Admin\Desktop\test.ms; position: 329
-- Frame:
-- i: 1
-- Error occurred during fileIn in <File:C:\Users\Admin\Desktop\test.ms>
>> MAXScript FileIn Exception: -- Unable to convert: undefined to type: Float <<
what am i doing wrong?
also whats this:
for i = 1 to "vertCount" do
what is the vertCount or any explanation?
-
- mega-veteran
- Posts: 267
- Joined: Thu Nov 04, 2010 11:25 pm
- Location: Somewhere, out there... But, not quite here...
- Has thanked: 133 times
- Been thanked: 165 times
- Contact:
Re: [Need Advice] Looking for help (Scripts)
Your variables should be defined as followsValerian wrote:so guys, my script looks like this:
when i want to execute it i get the error:Code: Select all
fseek f 0x26CA #seek_cur vx = float vy = float vz = float i = float arr_v = #() for i = 1 to 177 do ( vx = readfloat f vy = readfloat f vz = readfloat f append (arr_v) [readfloat(f), readfloat(f), readfloat(f)] print arr_v ) mesh vertices:arr_v faces:arr_f
-- Error occurred in i loop; filename: C:\Users\Admin\Desktop\test.ms; position: 329
-- Frame:
-- i: 1
-- Error occurred during fileIn in <File:C:\Users\Admin\Desktop\test.ms>
>> MAXScript FileIn Exception: -- Unable to convert: undefined to type: Float <<
what am i doing wrong?
also whats this:
for i = 1 to "vertCount" do
what is the vertCount or any explanation?
Code: Select all
vx = 0
vy = 0
vz = 0
i = 0
The reading of the vertices I would do in this fashion
Code: Select all
for i = 1 to 177 do
(
vx = readFloat f
vy = readFloat f
vz = readFloat f
arr_v[i] = (point3 vx vy vz)
)
MDA
Like TBotR on Facebook
ARchive_neXt v4.03.27.0 Now Available!
"I intend to leave a memory of myself in the minds of others."
Leonardo da Vinci,
disciple of experience