I’m working on a scripted plugin that I want to split the UI from however I’ve had no success in this. Using fileIn seems to error out in a scripted plugin giving me the following error:
-- Syntax error: at name, expected Plugin clause:
-- In line: fileIn "
I’ve had success doing this with this outside of a scripted plugin with no problems. Any ideas how I can split my UI and logic easily?
Can you post more of the code, at least that whole filein statement as it appears in the script?
We’ve found the easiest approach is to put our functional/library scripts in the stdscripts folder:
<max dir>\stdplugs\stdscripts\
Any .ms files in that folder (or in subdirs under it) are executed early in the startup process, even before scripts\startup. Then you don’t need filein statements and can just call the structs/functions and know they’re defined at the global level.
Don’t use fileIn use include. FileIn is like running a script, include takes the actual code body and compiles with the plugin. I can imagine a scripted plugin can’t use fileIn on compile time.
Sorry for lack of code, didn’t occour to me to post it :rolleyes: So here is basically what I’m trying to do:
--myPlugin.ms
plugin material myPlugin
name:"My Plugin"
classID:#(0x3e7dceea, 0x7ad829f2)
extends:DirectX_9_Shader replaceUI: true version: 1
(
-- include "myRollout.ms" is a similar error
fileIn "myRollout.ms";
)
I’ve already tried using include, that was my first attempt. The problem with an include is the same with filein, it’s not accepted as a rollout clause isn’t found.
Edit: Forgot to mention, moving everything from myRollout.ms into the plugin works fine.
[QUOTE=Roxol;12798]I’d never do this, but you can sorta achieve what you’re trying to do by wrapping an ‘include’ with your rollout statement. [/QUOTE]
Thats ok, because its invalid Max Script when used with a plugin. :p:
Testing it returns the following error on the included file:
Type error: Call needs function or class, got: undefined
The button needs to be within a function/class of some kind.