Alice Community  

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

Reply
 
Thread Tools Display Modes
Create a random value?
Old
CoherentCharlie
Guest
 
Status:
Posts: n/a
Question Create a random value? - 01-14-2011, 10:53 PM

Hello, Alicians! CoherentCharlie here who is now taking a break from working on a model. This is a minigame. It's a puzzle. First, the doors swap around, but if I make them swap around in the same order, this game won't be no fun! That's why I'm trying to make a random value! The pics are what I've already tried. From there, I have no idea what to do. So please explain to me how to create a random value!
Attached Images
File Type: jpg VIP.jpg (18.0 KB, 42 views)
File Type: jpg VIP2.jpg (17.8 KB, 42 views)
   
Reply With Quote
Old
haven812
Guest
 
Status:
Posts: n/a
Default 01-15-2011, 11:47 AM

I can't really see your code too well, but I think I know what you are getting at and here is what I thought of:

Make a list of 3 dummy objects and name it locations, and place those objects where each of the doors are located. Now give all the doors an object variable titled location. Add a method level object variable named location. Your code should then look like the following


Code:
location set value to random index from world.locations
door.location set value to location
remove location from world.locations
location set value to random index from world.locations
door2.location set value to location
remove location from world.locations
location set value to random index from world.locations
door3.location set value to location
remove location from world.locations
do together
door set point of view to door.location
door2 set point of view to door2.location
door3 set point of view to door3.location
End do together
I hope this helps!
   
Reply With Quote
Old
David B
Senior Member
 
David B's Avatar
 
Status: Offline
Posts: 1,143
Join Date: Dec 2010
Location: The Twilight Zone!
Default 01-15-2011, 12:35 PM

I am not sure, but I believe you can program Alice to think of a random number.
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 578
Join Date: Nov 2008
Location: In the interwebs
Default 01-15-2011, 03:56 PM

charlie, not to be mean or anything, but your large rounded text doesn't make you seem very coherent. Please just use the standard font in your posts unless you have something big to say.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
CoherentCharlie
Guest
 
Status:
Posts: n/a
Default 01-20-2011, 10:02 AM

Thanks! Now is the list of objects supposed to be a variable, paremeter, or a method variable?

Last edited by CoherentCharlie; 01-20-2011 at 10:08 AM.
   
Reply With Quote
Old
CoherentCharlie
Guest
 
Status:
Posts: n/a
Default 02-09-2011, 03:20 PM

Sorry. Bumped.
   
Reply With Quote
Reply

Tags
alice, coherentcharlie, variable, vip

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