Alice Community  

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

Reply
 
Thread Tools Display Modes
How do I use "Ask User Yes or No"?
Old
CJA
Guest
 
Status:
Posts: n/a
Question How do I use "Ask User Yes or No"? - 12-21-2009, 06:14 PM

The title says it all
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 12-21-2009, 06:19 PM

Make a boolean variable, and then in the method set the value of that boolean variable to true. Then go to world in the objects list and press the Functions tab, and if you scroll down in there you should see "Ask user for yes or no". Drag that function into the script where it sets the variable for the boolean, in place of the true that I told you to put before.

Now whenever your method is run, it will ask the user yes or no and set it to the corresponding value (true is yes, false if no) to the boolean which you can then use in if/else statement, etc. For example If booleanVar == true, run other method, else do nothing


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301

Last edited by Dameria; 12-21-2009 at 06:42 PM.
   
Reply With Quote
Old
CJA
Guest
 
Status:
Posts: n/a
Default 12-21-2009, 06:37 PM

wow this is the second problem you've helped me with today Thanks
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 12-21-2009, 06:41 PM

Your welcome, maybe if you have another question you can just directly message me instead of making a thread. Or even better, you can message the user x2495iiii as he knows more about some things in Alice than I do.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
CJA
Guest
 
Status:
Posts: n/a
Default 12-22-2009, 02:24 PM

Ok, thanks.
But, I just realized that the Yes or No doesn't really do anything. How can I get something to happen when yes (or no) is clicked?
P.S. I didn't want to message you since this thread was already up
   
Reply With Quote
Old
zarfang8
Guest
 
Status:
Posts: n/a
Default 12-22-2009, 02:54 PM

Inside the If/Else tab you create, when you put things inside if, that will be what will happen when you click yes, and if you put things inside else, that will be what happens when you click no.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 12-22-2009, 03:49 PM

Here is an example of what you can do:
Attached Files
File Type: a2w YesNoExample.a2w (167.4 KB, 69 views)


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Reply

Thread Tools
Display Modes

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 ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.