WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Viz 3B - Scope of Interactive Window and Script (https://forum.worldviz.com/showthread.php?t=722)

nickyee 09-05-2006 08:38 PM

Viz 3B - Scope of Interactive Window and Script
 
In the past, the scope of the interactive window at the bottom and the script itself (once run) seemed to be the same. So if I had "x = 3" in the script, I could access it in the interactive window by typing in "x". This no longer seems to be the case in 3B (or maybe it was changed earlier ... ?) and the two seem to be in different scopes altogether. Is there a way to get them to be in the same scope (or is there a way for me to get to the scope of the script in the interactive window)?

farshizzo 09-06-2006 09:30 AM

Hi,

The interactive window and the script have always been in separate
interpreters (or scopes). However, there is a significant difference
between 2.x and 3.0. In 2.x, when you ran a script, it would first be
executed in the same interpreter as the interactive window. This first
execution would initialize all your global variables. Then the script
would be launched in a separate process with its own interpreter. This
first pass would pollute the interactive interpreter with all the
global variables of the script.

Vizard 3.0 bypasses this first execution and immediately launches the
script in a separate process. You can still type commands in the
interactive window, but only while your script is running. The
interactive window is actually more powerful in 3.0, because you can
modify global and runtime variables in your running script, which you
previously couldn't do in 2.x

Are you trying to access the variable "x" after the script has
finished? If so, this won't work in 3.0. Even though it did work in
2.x, the functionality wasn't very useful, because the value would not
reflect any changes that were made at runtime.

Hope this helps. Also, in the future please post Vizard 3.0 related
questions in the 3.0 forum.


All times are GMT -7. The time now is 07:09 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC