Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / float variable strange error ""
  RSS 2.0 ATOM  

float variable strange error ""
Rate this thread
 
46945
 
Permlink of this thread  
avatar
  • Total Posts: 3
  • Joined: 05 September 2010 03:41 PM

hello, i’m new in max scripting of 3ds max, i use 3ds max at school from 1 year ago.
today when i was making the suspension rig of my robot foot i got stuck.
the suspensions works well, but the rotate of some pieces don’t work
i can explain:
the foot is composed by a core, with some suspensions and 3 pieces, one front right, one front left, and one little back.
the front pieces can turn, that’s the bad…
here is my code (optional don’t read if you do not want)

maxtime=1f
slidertime
=0f
T
=0f
rotazione
=0
rotazione2
=0
tollerance
=0,15 
animate on
(
 do(
 
slidertime=T
 
--parte dietro
 $piede_R01
.pos=$piederef_R01.pos--ref extension
 
if $piede_R01.pos.z<=0 then(
 
$piede_R01.pos.z=0
 
)
 --
parte destra
 $piede_DX01
.pos=$piederef_DX01.pos--ref extension
 
if $piede_DX01.pos.z<=0 then(
 
$piede_DX01.pos.z=0
 

 do( 
flag=0
 poss
=$piede_DX01.pos.$piede_DX02.pos.
 
if poss<=tollerance then 
 if 
poss>=-tollerance then (
 
rotate $Ft_DX_01 (angleaxis 1 [1,0,0])
 
flag=1
 
))
 ) while (
flag == 1
 do( 
 
flag=
 
if $piede_DX02.pos.z<0 then (
 
rotate $Ft_DX_01 (angleaxis -1 [1,0,0])
 
flag=
 
--rotazione=rotazione+1
 
)
 ) while (
flag == 1)
 
 --
parte sinistra
 $piede_SX01
.pos.z=$piederef_SX01.pos.z--ref extension
 
if $piede_SX01.pos.z<=0 then(
 
$piede_SX01.pos.z=0
 

        do( 
flag=0
 poss
=$piede_SX01.pos.$piede_SX02.pos.
 
if poss<tollerance and poss >-tollerance then (
 
rotate $Ft_SX_01 (angleaxis 1 [1,0,0])
 
flag=1
  
)
 ) while (
flag == 1)
 
 do( 
 
flag=
 
if $piede_SX02.pos.z<0 then (
 
rotate $Ft_SX_01 (angleaxis -1 [1,0,0])
 --
rotazione2=rotazione2+1
 flag
=
 
)
 ) while (
flag == 1)
 
T=T+1
 
)while (T<=maxtime)
)

Evaluating all in the listener i’ve got

1f
0f
0f
0
0
0
-- Error occurred in anonymous codeblockfilenameC:\Users\utente\Documents\3dsMax\scenes\controller piede 2°.msposition73line6
-- Syntax errorat ),, expected <factor>
--  
In linetollerance=0,1

what is it? why

i made this too:

casualn=0,15

and evaluating here is the answer

-- Error occurred in anonymous codeblockfilenameC:\Users\utente\Documents\3dsMax\scenes\controller piede 2°.msposition73line6
-- Syntax errorat ),, expected <factor>
--  
In linetollerance=0,1

what i’m doing wrong…
i’ve checked all the brackets, i tryed float = (variable=0,15)
nothing…
tank you



cpu: Intel i7 920 heatsink: CoolerMaster V8
graphic: ATI Sapphire HD5770 VaporX edition
ram: Corsair Dominator 1600mhz DDR3 6Gb (3x2)
mb: asus P67 SE cs: CoolerMaster HAF922 + cooler master 700w modular
Win 7 64bit, Directx 11

Attachment Attachment
Attachment Attachment
Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

Try using a period (full stop) instead of a comma.

tollerance 0.15

I suspect (but can’t prove here) that Maxscript does not respect locale (region) settings.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0
avatar

ooh, tank you! i don’t know why i used that…
a stupid error… now i got other bugs in my code… i’m shure i can fix that using 2 more point helpers for reference of rotation.
tank you another time



cpu: Intel i7 920 heatsink: CoolerMaster V8
graphic: ATI Sapphire HD5770 VaporX edition
ram: Corsair Dominator 1600mhz DDR3 6Gb (3x2)
mb: asus P67 SE cs: CoolerMaster HAF922 + cooler master 700w modular
Win 7 64bit, Directx 11

Replies: 0
avatar

i done it…
it works very pretty!

if i can ask, ther’s a more light way for make a move in a single frame?
i used

slidertime=...

this way seems heavy…
for make the short animation (on youtube) of 160 frames it worked on 1 minute…
for the prevoius move (1030 frames) i don’t know… much time



cpu: Intel i7 920 heatsink: CoolerMaster V8
graphic: ATI Sapphire HD5770 VaporX edition
ram: Corsair Dominator 1600mhz DDR3 6Gb (3x2)
mb: asus P67 SE cs: CoolerMaster HAF922 + cooler master 700w modular
Win 7 64bit, Directx 11

Image Attachment Video
Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

Not easily I don’t think. What you’re doing is setting keys so each key needs the frame number, the object and the position and rotation. Perhaps putting that information into a text file, then reading it, inside a loop, may be easier to create and maintain than repeating the maxscript instructions one by one. Just a thought…



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 0