Notifications
Clear all

[Closed] Scripted Plug-in question

hi,
I’m currently working on a simpleMod plug-in and when I’m trying
to use any event handlers other then the required map event and the create event
I get no respond? Is it possible to add some event handlers like:

[b][b]on[/b][/b] <spinner> [b][b]changed[/b][/b]  <arg>[b][b] do[/b][/b] <expr>

or does the simple modifier blocks them?
thanks, Matan.

2 Replies

Make sure your event handler is inside the scope of the rollout. If you mistakenly put it outside the rollout, it won’t complain but also won’t work.

This is particularly easy to do if you used the “SaddleDeform” example from the MXS help file as a starting point. The only event handler explicitly listed is at the modifier level. If you added yours next to that one it wouldn’t work.

Incorrect (out of scope, handler won’t work):

 
plugin simpleMod saddle
name:"SaddleDeform"
classID:#(685325,452281)
version:1
( 
parameters main rollout:params (
		amount type:#integer ui:amtSpin default:20
)
 
rollout params "Saddle Parameters" (
		spinner amtSpin "Amount: " type:#integer range:[0,1000,20]
		spinner testSpin "Test:" type:#integer
)
 
on map i p do (
		p.z += amount * sin((p.x * 22.5/extent.x) * (p.y * 22.5/extent.y))
		p
)
 
on testSpin changed arg do (
		format "spin value: %
" arg
)
)

Correct:

 
plugin simpleMod saddle
name:"SaddleDeform"
classID:#(685325,452281)
version:1
( 
parameters main rollout:params (
		amount type:#integer ui:amtSpin default:20
)
 
rollout params "Saddle Parameters" (
		spinner amtSpin "Amount: " type:#integer range:[0,1000,20]
		spinner testSpin "Test:" type:#integer
 
		on testSpin changed arg do (
			format "spin value: %
" arg
		)
)
 
on map i p do (
		p.z += amount * sin((p.x * 22.5/extent.x) * (p.y * 22.5/extent.y))
		p
)
)

Thanks allot Adam,
I haven’t tested it yet, but it sounds like a sure thing

Matan.