Alice Community  

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

Reply
 
Thread Tools Display Modes
Return a Value
Old
shodai
Member
 
Status: Offline
Posts: 27
Join Date: Nov 2010
Default Return a Value - 03-11-2012, 01:18 PM

I am trying to do something that should be super simple but I am obviously just missing something. All I want to do is have an object the the user what there height is. Then change position of the arms and then say what the new height is. For whatever reason I just cannot figure out how to get alice to do this. I am using version 2.2.
   
Reply With Quote
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default 03-11-2012, 03:59 PM

Perhaps you don't quite understand functions and methods?
Functions already return a value. When you use them it gets certain pre-determined values (parameters), does certain calculations defined by the creator and returns the value. Sometimes a function isn't intended to actually return anything and simply does things with the input values.

I believe the problem you're having is related to the concept of using the returned value.
You're supposed to set a variable to the returned value. In a Java class you might simply print the function to the console and the console would show the variable. You can do this in Alice too.

In the event that this is not the case, it would be because the arm's changed orientation does not affect the overall height of the character. You may want to detect width for more obvious change.
   
Reply With Quote
Old
shodai
Member
 
Status: Offline
Posts: 27
Join Date: Nov 2010
Default 03-11-2012, 08:21 PM

Perhaps I should be more specific. An example of what I am looking to do is to have one of the characters (using the method Character Say) say "My hight is ...) and then have the number come in with the program indicating the measurement. I have attached a picture of what I am looking to do.
Attached Images
File Type: jpg coach1.jpg (33.0 KB, 36 views)
   
Reply With Quote
Reply


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.