<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Yes, the script it broken. The problem is highlighted in red. It should be \n’</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> Browser.print ('diffuseColor=(' + red +',' + green + ',' + blue + ') newColor=' + newColor.toString() + '<span style='color:red'>\'</span>);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">Mail</a> for Windows 10</p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='border:none;padding:0in'><b>From: </b><a href="mailto:yottzumm@gmail.com">John Carlson</a><br><b>Sent: </b>Thursday, July 14, 2016 8:57 PM<br><b>To: </b><a href="mailto:brutzman@nps.edu">Don Brutzman</a>; <a href="mailto:roy.walmsley@ntlworld.com">Roy Walmsley</a><br><b>Cc: </b><a href="mailto:x3d-public@web3d.org">X3D Graphics public mailing list</a><br><b>Subject: </b>RE: Proto expander. Scripts in protobodies without a DEF</p></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal>I don’t know if the script is broken or something else. The expanded version doesn’t work in any browser I tried. The proto version works in at least octaga. The original Proto version does not work in X3D JSON Loader (Cobweb). The original Proto version does work in normal Cobweb.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>X3D JSON -> XML version without Proto Expander is here (broken in Cobweb):</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><?xml version="1.0" encoding="UTF-8"?></p><p class=MsoNormal><!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd"></p><p class=MsoNormal><X3D profile="Immersive" version="3.3" ><head><meta name="title" content="MaterialModulator.x3d"></meta></p><p class=MsoNormal><meta name="description" content="Mimic a Material node and modulate fields as an animation effect"></meta></p><p class=MsoNormal><meta name="hint" content="try changing the modulation script so that it goes from [0 ... 1] and then [1 ... 0] alternating, rather than abruptly shifting from 1 immediately back to 0."></meta></p><p class=MsoNormal><meta name="creator" content="Don Brutzman"></meta></p><p class=MsoNormal><meta name="created" content="10 March 2008"></meta></p><p class=MsoNormal><meta name="modified" content="28 November 2014"></meta></p><p class=MsoNormal><meta name="subject" content="X3D prototype requiring Script inputOutput fields"></meta></p><p class=MsoNormal><meta name="Image" content="MaterialModulator.png"></meta></p><p class=MsoNormal><meta name="identifier" content="http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14-Prototypes/MaterialModulator.x3d"></meta></p><p class=MsoNormal><meta name="generator" content="X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"></meta></p><p class=MsoNormal><meta name="license" content="../license.html"></meta></p><p class=MsoNormal></head></p><p class=MsoNormal><Scene><ProtoDeclare name="MaterialModulator" appinfo="mimic a Material node and modulate fields as an animation effect"><ProtoInterface><field name="enabled" accessType="inputOutput" type="SFBool" value="true"></field></p><p class=MsoNormal><field name="diffuseColor" accessType="inputOutput" type="SFColor" value="0.8 0.8 0.8"></field></p><p class=MsoNormal><field name="emissiveColor" accessType="inputOutput" type="SFColor" value="0 0 0"></field></p><p class=MsoNormal><field name="specularColor" accessType="inputOutput" type="SFColor" value="0 0 0"></field></p><p class=MsoNormal><field name="transparency" accessType="inputOutput" type="SFFloat" value="0"></field></p><p class=MsoNormal><field name="shininess" accessType="inputOutput" type="SFFloat" value="0.2"></field></p><p class=MsoNormal><field name="ambientIntensity" accessType="inputOutput" type="SFFloat" value="0.2"></field></p><p class=MsoNormal></ProtoInterface></p><p class=MsoNormal><ProtoBody><Material DEF="MaterialNode"><IS><connect nodeField="diffuseColor" protoField="diffuseColor"></connect></p><p class=MsoNormal><connect nodeField="emissiveColor" protoField="emissiveColor"></connect></p><p class=MsoNormal><connect nodeField="specularColor" protoField="specularColor"></connect></p><p class=MsoNormal><connect nodeField="transparency" protoField="transparency"></connect></p><p class=MsoNormal><connect nodeField="shininess" protoField="shininess"></connect></p><p class=MsoNormal><connect nodeField="ambientIntensity" protoField="ambientIntensity"></connect></p><p class=MsoNormal></IS></p><p class=MsoNormal></Material></p><p class=MsoNormal><!--Only first node (the node type) is renderable, others are along for the ride--><Script DEF="MaterialModulatorScript"><field name="enabled" accessType="inputOutput" type="SFBool"></field></p><p class=MsoNormal><field name="diffuseColor" accessType="inputOutput" type="SFColor"></field></p><p class=MsoNormal><field name="newColor" accessType="outputOnly" type="SFColor"></field></p><p class=MsoNormal><field name="clockTrigger" accessType="inputOnly" type="SFTime"></field></p><p class=MsoNormal><IS><connect nodeField="enabled" protoField="enabled"></connect></p><p class=MsoNormal><connect nodeField="diffuseColor" protoField="diffuseColor"></connect></p><p class=MsoNormal></IS></p><p class=MsoNormal><![CDATA[ecmascript:</p><p class=MsoNormal>function initialize ()</p><p class=MsoNormal>{</p><p class=MsoNormal> newColor = diffuseColor; // start with correct color</p><p class=MsoNormal>}</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>function clockTrigger (timeValue)</p><p class=MsoNormal>{</p><p class=MsoNormal> if (!enabled) return;</p><p class=MsoNormal> red = newColor.r;</p><p class=MsoNormal> green = newColor.g;</p><p class=MsoNormal> blue = newColor.b;</p><p class=MsoNormal> </p><p class=MsoNormal> // note different modulation rates for each color component, % is modulus operator</p><p class=MsoNormal> newColor = new SFColor ((red + 0.02) % 1, (green + 0.03) % 1, (blue + 0.04) % 1);</p><p class=MsoNormal> if (enabled)</p><p class=MsoNormal> {</p><p class=MsoNormal> Browser.print ('diffuseColor=(' + red +',' + green + ',' + blue + ') newColor=' + newColor.toString() + '\');</p><p class=MsoNormal> }</p><p class=MsoNormal>}</p><p class=MsoNormal>]]></Script></p><p class=MsoNormal><!--Clock tickles Script to wake up and compute a new value--><ROUTE fromField="newColor" fromNode="MaterialModulatorScript" toField="diffuseColor" toNode="MaterialNode"></ROUTE></p><p class=MsoNormal><TimeSensor DEF="ModulationClock" cycleInterval="0.1" loop="true"><IS><connect nodeField="enabled" protoField="enabled"></connect></p><p class=MsoNormal></IS></p><p class=MsoNormal></TimeSensor></p><p class=MsoNormal><ROUTE fromField="cycleTime" fromNode="ModulationClock" toField="clockTrigger" toNode="MaterialModulatorScript"></ROUTE></p><p class=MsoNormal></ProtoBody></p><p class=MsoNormal></ProtoDeclare></p><p class=MsoNormal><!--Rendered geometry for the ProtoInstance now follows prototype declaration--><Transform translation="0 1 0"><Shape><Sphere containerField="geometry"></Sphere></p><p class=MsoNormal><Appearance containerField="appearance"><ProtoInstance containerField="material" name="MaterialModulator" DEF="MaterialModulatorInstance"><fieldValue containerField="material" name="enabled" value="true"></fieldValue></p><p class=MsoNormal><fieldValue containerField="material" name="diffuseColor" value="0.5 0.1 0.1"></fieldValue></p><p class=MsoNormal></ProtoInstance></p><p class=MsoNormal></Appearance></p><p class=MsoNormal></Shape></p><p class=MsoNormal></Transform></p><p class=MsoNormal><!--Selectable Text design pattern has transparent Box and TouchSensor description as a tooltip--><Transform translation="0 -2 0"><Shape><Text containerField="geometry" string=""enable/disable" "MaterialModulator""><FontStyle containerField="fontStyle" family=""SANS"" justify=""MIDDLE" "MIDDLE"" style="BOLD"></FontStyle></p><p class=MsoNormal></Text></p><p class=MsoNormal><Appearance containerField="appearance"><Material containerField="material" diffuseColor="0.9 0.9 0.9"></Material></p><p class=MsoNormal></Appearance></p><p class=MsoNormal></Shape></p><p class=MsoNormal><Shape><Box containerField="geometry" size="8 2 0.001"></Box></p><p class=MsoNormal><Appearance containerField="appearance"><Material containerField="material" transparency="1"></Material></p><p class=MsoNormal></Appearance></p><p class=MsoNormal></Shape></p><p class=MsoNormal><!--Toggle text to enable/disable MaterialModulator--><TouchSensor DEF="TouchTextInterface" description="Select to enable/disable MaterialModulator"></TouchSensor></p><p class=MsoNormal><BooleanToggle DEF="EventToggler"></BooleanToggle></p><p class=MsoNormal><ROUTE fromField="isActive" fromNode="TouchTextInterface" toField="set_boolean" toNode="EventToggler"></ROUTE></p><p class=MsoNormal><ROUTE fromField="toggle" fromNode="EventToggler" toField="enabled" toNode="MaterialModulatorInstance"></ROUTE></p><p class=MsoNormal></Transform></p><p class=MsoNormal></Scene></p><p class=MsoNormal></X3D></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>