X3D Model Documentation: ScriptSyntaxExampleTest.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  4       <head>
  5            <meta name='titlecontent='ScriptSyntaxExampleTest.x3d'/>
  6            <meta name='creatorcontent='Don Brutzman'/>
  7            <meta name='createdcontent='8 January 2000'/>
  8            <meta name='modifiedcontent='20 October 2019'/>
  9            <meta name='descriptioncontent='Script node syntax example, testing sample values of various types with simple escaping of apostrophe and quotation mark characters, with results shown on Browser console output.'/>
 10            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Basic/development/ScriptSyntaxExampleTest.x3d'/>
 11            <meta name='generatorcontent='X3D-Edit, https://www.web3d.org/x3d/content/README.X3D-Edit.txt'/>
 12            <meta name='licensecontent='../license.html'/>
 13       </head>
<!--

<!-- Event Graph ROUTE Table shows event connections. -->

<!-- to top Index for DEF node: myScript
-->
<![CDATA[
      
ecmascript:

// Preferred style for inlined script code is contained CDATA
// in order to simplify use of characters < > " " ' ' etc. in source code

// When inlined script code appears in url instead, XML special characters
// must be carefully 'escaped' or an incorrect translation will result.

// url appears before contained code when translating to VRML encoding,
// so that external (possibly updated) code scripts can take precedence

function someSFBool (value, timestamp)
{
	Browser.println ('someSFBool input event=' + value);
	someMFInt32 = 0; // set outputOnly event, for example
}
function initialize (value)
{
	Browser.println ('    someMFFloats=' + someMFFloats);
	Browser.println ('someStringField=' + someStringField);
	Browser.println ('    stringTest1=' + stringTest1);
	Browser.println ('    stringTest2=' + stringTest2);
}

    
]]>
 14       <Scene>
 15            <WorldInfo title='ScriptSyntaxExampleTest.x3d'/>
 16            <Script DEF='myScript'   url=' "NoSuchScript1.js" "https://www.web3d.org/x3d/content/examples/Basic/development/NoSuchScript2.class.ignore" '>
 17                 <field name='someSFBooltype='SFBoolaccessType='inputOnly'/>
 18                 <field name='someMFInt32type='MFInt32accessType='outputOnly'/>
 19                 <field name='someMFFloatstype='MFFloatvalue='0.0 1.0 2.0accessType='initializeOnly'/>
 20                 <field name='someStringFieldtype='SFStringvalue='helloaccessType='initializeOnly'/>
 21                 <field name='stringTest1type='MFStringvalue='"'" "apostrophe"accessType='initializeOnly'/>
 22                 <field name='stringTest2type='MFStringvalue='"Quote &quot; character" "More Text"accessType='initializeOnly'/>
 23                 <field name='someInitializedRotationtype='SFRotationvalue='0 1 0 0accessType='initializeOnly'/>
 24                 <field name='someInitializedTimetype='SFTimevalue='0accessType='initializeOnly'/>
 26            </Script>
 27            <Anchor description='Select text to view source documentation'   url=' "ScriptSyntaxExampleTest.html" "https://www.web3d.org/x3d/content/examples/Basic/development/ScriptSyntaxExampleTest.html" '>
 28                 <Shape>
 29                      <Text string='"Script node syntax example," "select this text to view source"'>
 30                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
 31                      </Text>
 32                      <Appearance>
 33                           <Material diffuseColor='0.7 0.4 0.1'/>
 34                      </Appearance>
 35                 </Shape>
 36                 <!-- selectable Text to show Anchor description -->
 37                 <Shape>
 38                      <Box size='11 2 .001'/>
 39                      <Appearance>
 40                           <Material transparency='1'/>
 41                      </Appearance>
 42                 </Shape>
 43            </Anchor>
 44       </Scene>
 45  </X3D>
<!--

<!-- Event Graph ROUTE Table shows event connections. -->

<!-- to top Index for DEF node: myScript
-->
X3D Tooltips element index: Anchor, Appearance, Box, field, FontStyle, head, Material, meta, Scene, Script, Shape, Text, WorldInfo, X3D, accessType and type, XML data types, field types

Event Graph ROUTE Table with 0 ROUTE connections total, showing X3D event-model relationships for this scene.

Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.


Anchor
description='Select text to view source documentation' 
User-interaction hint for this node. 

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/Basic/development/ScriptSyntaxExampleTestIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/development/ScriptSyntaxExampleTest.x3d -->

<!-- Color legend: X3D terminology <X3dNode DEF='idName' field='value'/> matches XML terminology <XmlElement DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
-->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->