Web3D/VRML
[] readme course preface 1 2 3 4 5 6 7 reference examples resources

talk show tell print

x-script.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

script example

script


  
  DEF SCRIPT Script {
     eventIn SFTime touchTime
     field SFInt32 touchCount 0
     field SFInt32 eventCount 0
     field MFString tempString ""
     eventOut MFString outputString
     url "javascript:
        function initialize() {
           outputString = new MFString('','');
           tempString = new MFString('','');
           print('Script initialised');
           outputString[0] = 'Ready...';
        }
        function touchTime(value, time) {
           print('touchTime eventIn received');
           touchCount++;
           tempString[0] = 'touchCount: ' + touchCount.toString();
        }
        function eventsProcessed() {
           print('eventsProcessed called');
           eventCount++;
           tempString[1] = 'eventCount: ' + eventCount.toString();
           outputString = tempString;
        }
     "
  }
  
  

sensor


  
  Transform {
     translation -7 5 0
     children [
        DEF SENSOR TouchSensor {
        }
        Shape {
           appearance Appearance {
              material Material {
                 emissiveColor 1 0 0
              }
           }
           geometry Sphere {
              radius 0.1
           }
        }
     ]
  }
  
  

text


  Shape {
     geometry DEF TEXT Text {
        fontStyle FontStyle {
           justify "MIDDLE"
           family "TYPEWRITER"
        }
     }
  }
  
  

event routing


  ROUTE SENSOR.touchTime TO SCRIPT.touchTime
  ROUTE SCRIPT.outputString TO TEXT.string
  


[] readme course preface 1 2 3 4 5 6 7 reference examples resources
eliens@cs.vu.nl

draft version 0.3 (17/9/2001)