Help: MoI ignores the script changes from the separate .js file?

Next
 From:  Damir (DAMIRMBS)
5081.1 

Hi all,

I'm new to the MoI scripting facilities and I faced with the following problem. When I make any changes in the script written and saved in the separate .js file the MoI ignore them until I restart the programme. How can I link the MoI with external .js file similar to what David Morrill did in his External Scripting Interface.

Thanx.
Damir.

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5081.2 In reply to 5081.1 
Hi Damir - MoI caches script and UI files once they are read to improve performance so that they won't have to be read from disk again.

So it's that feature that you are running into here and right now there isn't any mechanism to turn it off, you will need to exit MoI and relaunch it in order for your new script to be run.

It is possible though to make a script that itself loads another file and executes it, that's probably basically what David did for his framework. To do something like that your script file would load a text file (see the ImportPointFile plug-in from here for an example using some Windows scripting mechanisms: http://kyticka.webzdarma.cz/3d/moi/#ImportPointFile) then once you have it loaded as a string you call the JavaScript exec() function on the string to execute the code inside of it from your own script.

I want to improve things in the future so that MoI would monitor some particular directories for changes to script files and reload them automatically but currently that is not done yet - just in general scripting has not been a major focus area for MoI yet and so there are a lot of things like that which are not refined yet. So basically you'll be working in an underdeveloped and unfinished area here currently.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Damir (DAMIRMBS)
5081.3 In reply to 5081.2 

Thank you Michael for the reply.
Have a good day

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Damir (DAMIRMBS)
5081.4 In reply to 5081.2 

Hi Michael

I wasn't able to find the exec() function in JavaScript.
Did you mean eval() function that allows to execute JavaScript code from the string variable?
It works fine for me.

Thanx.

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
5081.5 In reply to 5081.4 
Hi Damir, oops sorry yes I meant eval().

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All