Scripting problem 
Author Message
 Scripting problem

Hi,

I've a problem with using exposedFields in my PROTO's and the Script node. I
know that you can not use exposedField in your script.
Field doesn't work, so I'll have to fix it with eventIn or eventOut. But I
don't know which route I have to declare then:

so: ROUTE ???? TO Script.position_changed. The difficulty is: I use my
PROTO's as externproto's in other worlds.

e.g.

PROTO VBox
[
    exposedField position 0 0 0
]
{
    DEF Tr   Transform
    {
        translation IS position
        Shape
        {
            geometry Box {}
        }
    }

    DEF script1 Script
    {
        field SFVec3f pos IS position #or EventIn SFVec3f pos IS position
        url "javascript:  ........"
    }

Quote:
}

NOTE: This script isn't the real script.

Sorry that i posted this message before, but I have only two weeks to finish
this !!!

Thanks

Gerry



Sat, 02 Nov 2002 03:00:00 GMT  
 Scripting problem
important lesson number one:
you can't map an exposedField of a PROTO to a Script nodes field
the fields in a Script node are fields NOT exposedFields, so you will have
to create your own eventIn and Out to set and get the values, soemthing like
PROTO VBox
[
    eventOut SFVec3f position_changed
    eventIn SFVec3f set_position
    field SFVec3f position 0 0 0
]
{
    DEF Tr   Transform
    {
        translation IS position
        Shape
        {
            geometry Box {}
        }
    }

    DEF script1 Script
    {
        eventOut SFVec3f set_location
        eventIn SFVec3f set_position IS set_position
        eventOut SFVec3f position_changed IS position_changed
        field SFVec3f pos IS position
        url "javascript:
          function set_position(sfvec3f,tm){
            pos = sfvec3f
            position_changed = pos
           set_location = pos
          }
        "
    }

Quote:
}

ROUTE set_location TO tr.set_translation

note that the new eventIn and Out have been defined, and linked to the
script, and then the script has a 3rd event, which is ROUTEd to the
transform to change its translation.
db



Sat, 02 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Scripting problems

2. ksh-awk script problem

3. OS/2 REXX CMD SCRIPT PROBLEM

4. NT Backup script problem?

5. Xinetd script problem

6. Blaxxun scripting problem

7. Script problem ...

8. java scripting problem - again

9. Script problem?

10. Help needed on Protos, Routes, Scripts Problem

11. Java script problem

12. VRML 2.0 script problem

 

 
Powered by phpBB® Forum Software