Alice Community Random Number and Objects

 Random Number and Objects
 zezi Guest   Status: Posts: n/a Random Number and Objects - 11-03-2009, 09:40 PM I have a project where I have to move an asteroid along a randomly chosen track. I've been tinkering with it and I can get the random number portion to work, but I can't get the object to move along the paths I've assigned the numbers to using If/Else statements...The asteroid just sits there doing nothing. Any help/hints on making it work would be appreciated.
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 11-03-2009, 09:47 PM Exactly what method did you use? If you can't describe it, go ahead and post your world so I can see it myself. (')>
 zezi Guest   Status: Posts: n/a 11-03-2009, 09:53 PM Not sure if this is what you mean, but I have it set as thus (after major tinkering): RandomNumber set value to random number max=4 min=1 intergerOnly=true 3D Text set text to RandomNumber as a string If RandomNumber==1 sphereHighPoly move to pterodactyl 8 I'm just trying to even make it move at this point. If I can get the sphere to move as it should, then I can set up everything on my own. EDIT: I have tried inputing the numbers I need in double digit format (0.0) as I've read in other threads, but Alice seems to ignore it. Last edited by zezi; 11-03-2009 at 10:17 PM. Reason: Additional info
x2495iiii
Super Moderator

Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
11-03-2009, 10:56 PM

Quote:
 RandomNumber set value to random number max=4 min=1 intergerOnly=true 3D Text set text to RandomNumber as a string If RandomNumber==1 sphereHighPoly move to pterodactyl 8
With that setup, you should get a good assortment of 1's, 2's, and 3's (no 4's, since there is a slight glitch which sometimes locks out the maximum number when intergerTrue is set to true. Set the maximum to 5 if you want a 1 in 4 chance of 1 being chosen). However, the way you have it set up, the number is only chosen once, so you have a 1/3 chance of the shpere moving ONCE, and a 2/3 chance of it sitting there like a lemon. Put that code in a loop or a while statement and it should work.

(')>

 zezi Guest   Status: Posts: n/a 11-03-2009, 11:10 PM Thanks. I wound up solving my issue a slightly different way. I decided to allow non integers and use relational operators, to make sure everything was neatly inside my boundaries

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops     Alice Player and VR General Discussion     Questions and Comments     The Lounge