Solved

VRML Variables

Posted on 1998-04-29
7
701 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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
LVL 5

Accepted Solution

by:
julio011597 earned 110 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

726 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