?
Solved

VRML Variables

Posted on 1998-04-29
7
Medium Priority
?
708 Views
Last Modified: 2013-12-25
I'm having real problems when trying to assign variables in VRML.

Heres what im trying to do - I want to inline an object relating to the number of times object a is clicked AND object b is clicked.

For example - if i click on object a 3 times, and object b 4 times then the object inlined will be object 7 (3+4).

At present i can inline the object relating to one of the objects, using a simple switch node (which , depending on the number of clicks, inlines that specific object)

But am finding it very difficult to then add a second variable into the puzzle????

Hope all this makes sense.... Any ideas as to the code please help..
0
Comment
Question by:garyennis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:julio011597
ID: 1854400
The general answer is: have a global variable in your script node, and increment it each time object "a" or object "b" are clicked.

In order to give you some code, would you show your code so far? (Script node and ROUTEs is enough)

-julio
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1854401
Huh, forgot... hello again! :)
0
 
LVL 1

Author Comment

by:garyennis
ID: 1854402
DEF SIGN Switch {
                      whichChoice 0
                      choice [
                        Inline {
                            url      "sign0.wrl"
                        },
                        Inline {
                            url      "sign1.wrl"
                        },
                        Inline {
                            url      "sign2.wrl"  
                        },
                        Inline {
                            url      "sign3.wrl"  
                        },
                        Inline {
                            url      "sign4.wrl"  
                        },
                        Inline {
                            url      "sign5.wrl"  
                        },
                        Inline {
                            url      "sign6.wrl"  
                        },
                        Inline {
                            url      "sign7.wrl"  
                        },
                        Inline {
                            url      "sign8.wrl"  
                        },
                        Inline {
                            url      "sign9.wrl"  
                        },
                        Inline {
                            url      "sign10.wrl"  
                        },
                        Inline {
                            url      "sign11.wrl"  
                        },
                      ]
                  }


                ]
            }
          ]
      }
    ]
}

                    
##################### SCRIPTS

DEF SIGNScript Script {
    eventIn SFTime clicked
    eventOut SFInt32 nextActive

    field SFInt32 whichActive 0

    url "vrmlscript:
function clicked(t) {
    whichActive = whichActive + 1;
    if (whichActive > 11) {
        whichActive = 11;
    }
    nextActive = whichActive;
}
"
}


ROUTE CITYCOLLIDE.collideTime TO Source.set_startTime
ROUTE CITYCOLLIDE.collideTime TO SIGNScript.clicked
ROUTE SIGNScript.nextActive TO SIGN.set_whichChoice




This is about it so far......  what this does is detect the collision of the avatar into the walls of my 'maze' and add one to the choice of inline.  This works fine, but what i really want to do is also have a map icon, (bit of geometry) that when clicked, increases the inline by, lets say 3.

So, to confirm.... the user walks round my maze, collides with the wall 4 times (4 x 1) and clicks on the map 1 time (1 x 3), so the object i ultimately want to inline is object 7.

Hope this makes it somewhat clearer as to what im trying to achieve...

Thanks for the time!
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 5

Accepted Solution

by:
julio011597 earned 330 total points
ID: 1854403
Hello back,

sorry for this long silence, i've been a bit busy.

Your scheme so far is fine and can be easily extended.

You should associate a TouchSensor to your map object - let's DEF it "TOUCHSensor". Then you Script and ROUTEs could look like:

--//--
DEF SIGNScript Script {
  eventIn SFTime clicked
  eventIn SFTime touchTime
  eventOut SFInt32 nextActive

  field SFInt32 whichActive 0

  url "vrmlscript:
    function clicked(t) {
      whichActive = whichActive + 1;
      if (whichActive > 11) {
        whichActive = 11;
      }
      nextActive = whichActive;
    }
    function touchTime(t) {
      whichActive = whichActive + 3;
      if(whichActive > 11) {
        whichActive = 11;
      }
      nextActive = whichActive
    }
  "
}

ROUTE CITYCOLLIDE.collideTime TO SIGNScript.clicked
ROUTE TOUCHSensor.touchTime TO SIGNScript.touchTime
ROUTE SIGNScript.nextActive TO SIGN.set_whichChoice
--//--

HTH, julio
0
 
LVL 1

Author Comment

by:garyennis
ID: 1854404
Julio..... bit weird....

On the SGI (Running cosmoplayer) i get an error when i click on the map or collide with the wall...
>
VrmlScript Parse Error: Script node:syntax error: line"}"



Any ideas????

I've put the whole thing on the Internet for you to look at :

http://iris.abacus.strath.ac.uk/gary/Public/maze/maze_new.wrl
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1854405
Your page works as expected for me, on Cosmo Player 2.0, NN4.04, WinNT4.0...??

BTW, why are you using vrmlscript? javascript is almost a standard now.

-julio
0
 
LVL 1

Author Comment

by:garyennis
ID: 1854406
Thanks Julio...... probably just a problem with the SGI.

I think I've tried javascript before (instead of vrmlscript) but because we mainly use unix on the SGI here... Im sure it gave us some problems....

Thanks again!!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question