rspinney wrote:
>Hi Bob,
>
>The script is loaded using a jmolbutton (there are two different
>scripts/animations I want to be able to run which will have different
>messages to send to the textbox). The animation is then controlled by a
>series of additional jmolbuttons allowing the user to play, play reverse,
>ahead or back one frame, etc. (basically a set of animation controls similar
>to media player or quicktime).
>
>
>
sounds good.
>I am already using animFrameCallback to control a slider which can send a
>script to the applet. I think it would get fairly complicated to try to also
>use it to control the messages, especially since I want to have different
>messages depending on the animation being played. It would be nice (i.e.
>easiest) if I can control the messages using the statements I described
>below. Is this possible?
>
>
>
So you have the animFrameCallback coming to a JavaScript function, and
that function then invokes jmolScript() or jmolScriptWait() with the
commands listed below? It just seems a bit convoluted, since in that
case your animFrameCallback function already has the model number as one
of its parameters. Wouldn't it be easier just to do it "the old way"
with the JavaScript selecting a message based on what frame is being
displayed?
What I'm not understanding is what exactly invokes the Jmol script
commands below. Are they part of a jmolScript() command executed from
your JavaScript animFrameCallback function?
So, for example, if I add an animFrameCallback as:
jmolScript('set animframecallback "testanim" ')
and then have:
function testanim(app,frame,p3) {
jmolScript("if(_modelNumber = 5);message is5;else;message not5;endif")
}
I do get the messages expected. So I think that is working properly.
Bob
>Thanks, Rick
>
>
>
>
>
>>Rick, this Jmol script is being run when? When there is a frame change?
>>How are you setting it up to run these statements?
>>
>>In the latest version of Jmol you can designate a Jmol script to be run >>
>>from an animation frame callback:
>>
>> set animFrameCallback "script:if(_modelNumber = 1);.........."
>>
>>thus avoiding all JavaScript entirely, but I don't think that's what you >
>>are doing, right?
>>
>>Bob
>>
>>
>>rspinney wrote:
>>
>>
>>
>>>I am trying to use the if statement to run scripts during an animation
>>>(using version 11.1.36) using the following script (where the messages
>>>are directed to a textbox using the jmolsetcallback function, I want to
>>>change the message based on the model number):
>>>
>>>if (_modelNumber = 1); message (This is an E1 reaction); endif; if
>>>(_modelNumber = 10); script SCRIPTS/sub1.txt; endif;
>>>
>>>The first if statement executes correctly, but the second one never
>>>executes, although it will run correctly using the console. To test
>>>this I
>>>added:
>>>
>>>set echo top right; color echo red; echo "This is model
>>>%{_modelNumber}";
>>>
>>>which works, displaying the correct model number as the animation
>>>
>>>
>proceeds.
>
>
>>>But for the if statement it is like the _modelnumber is never updated
>>>when the animation is running. Is this a bug? Is there a better way to do
>>>
>>>
>this?
>
>
>>>Help!
>>>
>>>Thanks, Rick
>>>
>>>
>--------------------------------------
>Dr. Richard Spinney
>The Ohio State University
>Department of Chemistry
>160 B Celeste Laboratory
>120 West 18th Ave
>Columbus, Ohio 43210
>
>email: [EMAIL PROTECTED]
>
>Phone: (614) 247 - 6847
>Fax: 614 - 292 - 1685
>
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>_______________________________________________
>Jmol-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users