Syntax Error

Hello I Keep getting a syntax error and i cant find the reason why? I know its probaly something really simple so though it might be good to get a diffrent set of eyes on it.. Thanks

h = eulerangles 180 0 0

button animateobject "Animate Object"
on animateobject pressed do
(
for i=1 to 60 by 10 do
(
at time i with animate on
(
rotate $ h
)
)

)
local usersimage

button btn_browse "Select Texture" align:#left
button btn_aplyMat "Apply Material" align:#left

on btn_browse pressed do
(
usersimage = getOpenFileName caption: "Select Your Image" filename:maxFilepath types: "Images (*.bmp;)|*.bmp"
)
on btn_aplyMat pressed do
if selection.count == 0 then messageBox "Select some objects!" else
(
selection[1].material = standardMaterial diffuseMap: (Bitmaptexture fileName:usersimage) showInViewport:true
)

button exportobjects "Export Selected Objects"
on exportobjects pressed do
if selection.count == 0 then messageBox "Select objects!" else
(
local exportpath = @"C:"
exportFile exportpath using:ObjExp selectedonly:on
)

button closeinterface "Exit"
on closeinterface pressed do
(
destroydialog test_button
)
)
createDialog test_button 500 600

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

Folow this style when you start to write your tools for avoid common errors. Your style I not understand.

try(destroydialog ::test_button)catch()
rollout test_button "TEST"
(
        -- Locals
	local h = eulerangles 180 0 0
	local usersimage
	local exportpath = @"C:\"
        -- Rollout controls
	button animateobject "Animate Object" width:130 height:20 align:#left
	button btn_browse "Select Texture"  width:130 height:20 align:#left
	button btn_aplyMat "Apply Material"  width:130 height:20 align:#left
	button exportobjects "Export Selected Objects" width:130 height:20 align:#left
	button closeinterface "Exit" width:130 height:20 align:#left
        -- Events
	on animateobject pressed do
	(
		for i=1 to 60 by 10 do
		(
			with animate on at time i (if selection.count != 0 do for o in selection do rotate o h)
		)
	)
	on btn_browse pressed do
	(
		usersimage = getOpenFileName caption: "Select Your Image" filename:maxFilepath types: "Images (*.bmp;)|*.bmp"
	)
	on btn_aplyMat pressed do
	(
		if selection.count == 0 then messageBox "Select some objects!" else
		(
			for o in selection do o.material = standardMaterial diffuseMap:(Bitmaptexture fileName:usersimage) showInViewport:true
		)
	)
	on exportobjects pressed do
	(
		if selection.count == 0 then messageBox "Select objects!" else
		(
			exportFile exportpath using:ObjExp selectedonly:on
		)
	)
	on closeinterface pressed do (destroydialog test_button)
)
createDialog test_button 160 100

barigazy

Shade926's picture

Ive just edited all my code

Ive just edited all my code so it follows your format and it works perfectly now..

Thanks Alot

Shade926's picture

My code is obviously a

My code is obviously a mess!

When i put your code in i still get a syntax error occuring on:

on btn_browse pressed do

It comes up with:
-- Syntax error: at on, expected while
-- In line: on b

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.