View Full Version : Global variable help

05-09-2013, 08:57 AM
I'm making a helicopter simulator, and need to change a variable with keys, and then move the helicopter that amount in the main method. I need a global variable to do this, but how?

05-09-2013, 09:39 AM
...in Alice 3.1

05-09-2013, 12:45 PM
I found how to make global variables, and how to move an object based on that variable, but I can't find a way to modify the variable during runtime.

Best I can do is make a temporary variable which serves as a modifier for the global variable.

Will that do?

05-10-2013, 09:08 AM
...It would be nice to know how to make it, first ahaha

Edit: I need to know everything there is to know about global variables, the program is due in a few days and I can't do anything as of right now.

05-10-2013, 11:39 AM
To make a global variable:

-click the scene tab at the top of the screen

-click the button that says "add scene property..." under the word "unmanaged"

-select "decimal number" from the first dropdown menu, name your variable, then select anything from the second dropdown menu

This is your global variable. Any method can reference it. To do so, make a method, such as "helicopter move". On creation of the method, two popup menus will appear. First will be direction of motion, and second will be distance to move. At the bottom of the second menu, your global variable will be listed as an option.

05-13-2013, 09:04 AM
It's relatively useless if you can't modify it... What's the point of it?

Edit: I FOUND IT! To modify it, go to the "properties" tab on the left side, next to Procedures and Functions tab. Drag in the variable from that tab (The one which says "this(var name) = ???"), and you can modify it. This just made my day.

Edit 2: Not sure what version I'm running on, I'll update this post when I find out tomorrow, I guess they removed it in one of the newer versions of Alice.

05-13-2013, 04:13 PM
I looked there first. Didn't show up for me.

I wonder why.

05-15-2013, 09:12 AM
I'm running on v3.1.58