Javascript Diagnostic Output?

Next
 From:  libelle
7161.1 
I have a fair amount of Javascript development experience, but am running into a problem with a MoI script. If I could just look at some debugging information, I'm sure it's something trivial or stupid I'm doing, but I haven't found a way to get any diagnostic information from MoI's Javascript interpreter.

I saw references to a moi.log(string) function, but I haven't had any luck tracking down the output.

I only found one promising directory: MoI v3.app/Resources/Logs that had a single file: LastRunX11. This log contains only the frightening line "WARNING!!: You are running Wineskin on an unsupported OS and there may be major problems!").

I'm on Mac OS 10.9.5, MoI 3.

Any recommendations?

Thanks!
___Samuel___
  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:  libelle
7161.2 In reply to 7161.1 
Ah, never mind.

I found
code:
moi.ui.alert(string);


That was good enough to figure out my problem :)
  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
7161.3 In reply to 7161.1 
Hi Samuel, you can use either moi.ui.alert( 'msg' ) to pop up an alert dialog, or yes moi.log( 'msg' ); will put it in the diagnostic log which is not saved to disk though but can be shown in a pop up MoI window by putting in the following script on a shortcut key:

script: /* show log window */ moi.ui.createDialog( 'ShowLog.htm' );

moi.ui.alert() can be good for individual messages, the log is good if you want to output a whole bunch of stuff and look at it all at once later rather than as individual pop up messages.

Hope this helps!

- 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:  libelle
7161.4 In reply to 7161.3 
Hi Michael,

The "alert" popups eventually showed me that I'd had an error in my regular expression, so I'd solved my initial problem. But using the log will be much better as I continue to do other work!

I read somewhere in these forums where you mentioned that there might one day be an ini file setting to bypass caching of Javascript files. I know that the scripting API is (and probably should be) a relatively low priority, but I would vote for that feature if it were not too difficult to implement.

Thank you,
___Samuel___
  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
7161.5 In reply to 7161.4 
Hi Samuel, I'm glad you've got the initial problem solved!

re: file caching - that did get implemented in Moi v3, go to Options > General and push the "Edit .ini file" button, and inside there set DisableFileCaching=y . That will make MoI freshly reload the file every time a command is run rather than caching them in memory like it will do by default. More info here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=6727.2

- 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:  libelle
7161.6 In reply to 7161.5 
You seem to anticipate every feature I think I want :)

Thanks!
___Samuel___
  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:  Max Smirnov (SMIRNOV)
7161.7 
I use moi.log and modified ShowLog.htm with autoupdate and autoscroll.
And a text labels placed in the scene.


P.S. Michael, is there any possibility to clear the log?

EDITED: 19 Feb 2015 by SMIRNOV

Attachments:

  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
7161.8 In reply to 7161.7 
Hi Max, sorry no there's not currently any way to clear the log.

I can add something for that for v4, and also probably can add something to make the log get dynamically shown a system debug output viewer.

- 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