Alice Community  

Go Back   Alice Community > Alice 2 > Bugs and Troubleshooting

Reply
 
Thread Tools Display Modes
Custom Object Variables Inaccessable
Old
deus402
Guest
 
Status:
Posts: n/a
Default Custom Object Variables Inaccessable - 12-08-2009, 02:03 AM

It's a little hard to verbalize what i am trying to do without getting lengthy, but here it goes.

I have added a new variable for all of my objects, called nextPositionVector, which is an empty list of type position variables. The idea was that i could have a method to determine the next position that objects need to be at, and then a separate method to move the said object there.

i can add new positions to the list if I do it directly. i.e.,

Code:
insert myVector at beginning of chair.NextPositionVector
but i can't do:

Code:
currentObject set value to chair
insert myVector at at beginning of currentObject.NextPositionVector
because there is no "view" of the methods and variables of currentObject while coding, because it hasn't been assigned yet. I think that really handicaps what you can do with object variables.

for instance, if i wanted to make a row of chairs, if what i wanted to do worked, i could do it with this code:

Code:
//set the next position for every chair

chairsList = chair1,chair2,chair3,chair4,chair5
myVector set value to Vector3(0,0,0)
for all world.chairsList one Obj item_from_chairsList at a time
      insert myVector at end of item_from_chairsList.nextPositionVector
      set myVector's Distance right (myVector's distance right + subject=item_from_chairsList's width)

// move everything in the world to the next position if it has one assigned.
// in a real language you could check somehow to see if there is an item in
// the list, but again, i see no way to do that here. not that it matters, 
// because this bit isn't possible either.

for all world.itemsList one Obj item_from_itemsList at a time
     item_from_itemsList move to world offset by = item_from_itemsList.NextPositionVector
     remove item from beginning of item_from_itemsList.NextPositionVector
but it isn't even possible to create that code in alice, even though that seems like the simplest way to create a row of chairs.

seems like the lack of ability to create/destroy objects during runtime, as well as be able to access variables and methods for the object that is assigned to an object variable is really limiting both functionality as well as an opportunity for students to learn about important OOP concepts like polymorphism.

Last edited by deus402; 12-08-2009 at 09:35 AM.
   
Reply With Quote
Reply

Tags
bug, limitation, object variable

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.