Alice Community  

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

Reply
 
Thread Tools Display Modes
Old
tacpdaddy
Junior Member
 
Status: Offline
Posts: 4
Join Date: Mar 2015
Default 03-22-2015, 07:38 PM

Thanks. I'll try working a variable option and have it call the text when it reaches 7. I'll just submit it as is if I can't resolve the issue in an hour or so. I've spent way too much time trying to figure it out :/
   
Reply With Quote
Old
RavenOfCode
Senior Member
 
RavenOfCode's Avatar
 
Status: Offline
Posts: 408
Join Date: Oct 2013
Location: Northern Virginia
Default 03-23-2015, 06:13 AM

Quote:
Originally Posted by Funnybone View Post
I was trying to point out to him that swearing isn't allowed here. Just helping. Jeez, next time you can do it.
I didnt see anything in his post, so i thought you were referencing the Air Force...
My mistake...


Stuff + Other Stuff + Different Other Stuff = Things :)

My best Alice game:

Clash of the Cubes (an arena fighting game):
http://www.alice.org/community/showthread.php?t=10738&highlight=game
   
Reply With Quote
Possible Answer
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 500
Join Date: Sep 2007
Location: Austin, Texas
Default Possible Answer - 03-23-2015, 11:42 AM

1) Assume that you know the length of the list of objects to be picked up.
2) Create a numeric variable set to 0
3) Increment the variable every time you pick up an object.

And then you...

Kudos to you from a Wounded Warrior
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 212
Join Date: Dec 2012
Location: Frosno, Ca
Default 03-23-2015, 02:45 PM

Quote:
Originally Posted by tacpdaddy View Post
Hello,

I decided to get back into programming through online courses since I'm nearing retirement from the military.

I'm a little stumped on how to finish my homework assignment. I'm no expert with ALICE, but I feel like I have a decent handle on things.

I've created the environment per the instructions, and multiple methods. My sailboat is supposed to pick up all of the object when it's within 3m (which it does), but I'm having issues with the ending..

I've spent about three hours troubleshooting and I can't figure it out... What am I doing wrong in order to have the 3D text show correctly AND only when all 7 objects have been collected?

-thanks in advance!
The first problem with your approach is that the pickedUpBuoys list is a list of numbers not objects. The second is the "contains" function looks to see if any item in pickedUpBuoys matches the whole list allBuoys.
There are a couple of ways around this. One is to take each buoy off the allBuoys list and put it on the pickedUpBuoys list and continue doing this until the allBuoys list is empty.
An easier way might be to get the length of the allBuoys list at the beginning of the movie and use a for loop to count from that value down to 0 at which point all the buoys are picked up.

By the way the second If statement in world.pickUpBuoy copies the whole list of buoys into the pickedUpBuoys list. This means that when the first buoy is found the pickedUpBuoy list goes from empty to containing all the buoys.

One last thing, if you Right Click on the pickedUpBuoys list and select "watch this variable" you can see what is happening when you run the movie.

Hope this helps,
Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
Old
tacpdaddy
Junior Member
 
Status: Offline
Posts: 4
Join Date: Mar 2015
Default 03-24-2015, 07:14 PM

You guys are awesome, thanks!

MrMoke,

That helped a lot. I was not thinking in that direction (literally). I kept trying to add to 7. My final version was a lot better than what I posted, but it was still just a work-around.

--

Mark,

I went back to modify my methods after this post (even though I submitted my "jerry-rigged" work-around), and it helped a lot, thank you!

I see my error of not making my list objects.. Can't believe I missed that.

My biggest issue was (and still is) how to move an object from one list to another once it has been picked up. I feel that if I was able to accomplish this, I would have resolved my previous omissions.

I played around with a few ideas, and I did 'watch' the variable. The problem I had was that once one object was picked up, it just kept getting picked up as a number, not an object. I'm still learning, but thank you again for providing insight. I don't yet have the ability to think outside the box, but I plan on kicking the walls down

I spent so much time attempting to resolve the issue that I submitted my pathetic assignment 'as is' so I could spend some of the weekend with my family.
   
Reply With Quote
Moving between lists
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 212
Join Date: Dec 2012
Location: Frosno, Ca
Default Moving between lists - 03-25-2015, 03:31 AM

create an object variable
Set its value to the item you want to move.
Delete the item from the list.
Add the variable you saved to the other list.

It's still better to use the length of the list in most cases.

Always remember: The darn thing does exactly what I tell it to.

Mark


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