PDA

View Full Version : If expression make incomprehensible error


pol102
11-06-2010, 07:25 PM
I wrote a script Which is part of "scenery editor" ... This is my first major script, based on information from http://www.cguu.com/3dsmax/3dSMAX9/maxscript but I came to the point where I do not know what I did wrong.

This is my script:

rollout CreateShits "Tworzenie lasu na plane'ie"
(
global old_pos, new_spline, second_knot_set, get_mouse_pos, q --zdefiniowane globalnie

spinner ePar1 "Wysokość: " type:#float range:[0,30,10] align:#left
spinner ePar2 "Dł. Segmentu: " type:#float range:[10,100,0] align:#left
radioButtons rbTypeofthis "Forma" labels:#(#Las, #Plaskie_pole, #Nierowne_pole) align:#center columns:3




button bShits "Twórz!"

on bShits pressed do

(



fn get_mouse_pos pen_pos old_pen_pos =

(
-- nowa wstawka linijkę niżej -- sprawdź co daje radio button

if rbTypeofthis.state == 1 then
(
q=1
)

if rbTypeofthis.state == 2 then
(
q=2
)
if rbTypeofthis.state == 3 then
(
q=3
)
-- koniec wstawki

if old_pos == undefined then old_pos = old_pen_pos

if distance pen_pos old_pos > ePar2.value then

(

if second_knot_set then

addKnot new_spline 1 #corner #curve pen_pos

else

(

setKnotPoint new_spline 1 2 pen_pos

second_knot_set = true

)

old_pos = pen_pos

updateShape new_spline

) -- end if

) -- end fn

fn draw_new_line old_pen_pos =

(

pickPoint mouseMoveCallback:#(get_mouse_pos,old_pen_pos)

)


(

new_spline = splineShape ()

old_pen_pos = pickPoint ()

if old_pen_pos == #RightClick then

(

delete new_spline

)

else

(

select new_spline

new_spline.pos = old_pen_pos

addNewSpline new_spline

addKnot new_spline 1 #corner #curve old_pen_pos

addKnot new_spline 1 #corner #curve old_pen_pos

second_knot_set = false

draw_new_line old_pen_pos

--wstawka stąd w dół -- sprawdź stan podany z radio buttona
-- jeśli radiobutton daje las to samo extrude
if q!=1 then

(

close new_spline 1

updateshape new_spline

)
--koniec wstawki zamykającej linię jeśli radiobutton != od 1

select new_spline --zaznaczam obiekt
)
)


--jeśli las to
--if q==1 than addModifier new_spline (extrude Amount:ePar1.value)

--if q==2 than opcja1
--if q==3 than opcja2
-- opcja 3


--zadefiniowanie standardowych modyfikatorów żeby nie pisać głupot
--local opcja1 = addModifier new_spline (extrude Amount:ePar1.value)
--local hlofh = ePar1.value/2
--local opcja2 = addModifier new_spline (surface Threshold:5 Steps:2)
--local opcja3 = addModifier new_spline (Noisemodifier Seed:1 Scale:200 Strength:[0,0,-hlofh] Fractal:true)
-- koniec definiowania głupot ;)
--addModifier new_spline (extrude Amount:ePar1.value) --nadaje mu extrude ale to działa po chuju, więc trzeba uzależnić kolejnym if'em
--convertToMesh new_spline
--addModifier new_spline (uvwmap maptype:5) -- za tym nakładanie tekstury :D
--
--
----Napisać to tak, żeby nadawało modyfikator
--
--hlofh = ePar1.value/2
--if q==3 do addModifier new_spline (Noisemodifier Seed:1 Scale:200 Strength:[0,0,-hlofh] Fractal:true)

)
)



I left comments that there was no doubt that, I ask for something that is not mine.

When I "uncomment":
--if q==1 than addModifier new_spline (extrude Amount:ePar1.value)


Always I see:
>> MAXScript FileIn Exception: -- Syntax error: at ), expected "then" or "do"
-- In line: ) <<

B4 the question... I am n00b but it is first big problem that I can't solve because I do not know what I did wrong.
The Question is: Where I made mistake and what mistake I did,

P.S. Sorry for my bad english... i haven't use it for so long...

lo
11-07-2010, 08:08 PM
you wrote 'than' instead of 'then'. :cool:

CGTalk Moderation
11-07-2010, 08:08 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.