Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Global variable help
Old
AGuyWhoSkis
Guest
 
Status:
Posts: n/a
Question 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?
   
Reply With Quote
Old
AGuyWhoSkis
Guest
 
Status:
Posts: n/a
Default 05-09-2013, 09:39 AM

...in Alice 3.1
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 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?


(')>
   
Reply With Quote
Old
AGuyWhoSkis
Guest
 
Status:
Posts: n/a
Default 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.

Last edited by AGuyWhoSkis; 05-10-2013 at 09:32 AM.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 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.


(')>
   
Reply With Quote
Old
AGuyWhoSkis
Guest
 
Status:
Posts: n/a
Default 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.

Last edited by AGuyWhoSkis; 05-13-2013 at 08:17 PM.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 05-13-2013, 04:13 PM

I looked there first. Didn't show up for me.

I wonder why.


(')>
   
Reply With Quote
Old
AGuyWhoSkis
Guest
 
Status:
Posts: n/a
Default 05-15-2013, 09:12 AM

I'm running on v3.1.58
   
Reply With Quote
Reply

Tags
global, variables


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.