Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   Bugs and Troubleshooting (http://www.alice.org/community/forumdisplay.php?f=18)
-   -   Custom Object Variables Inaccessable (http://www.alice.org/community/showthread.php?t=3554)

deus402 12-08-2009 01:03 AM

Custom Object Variables Inaccessable
 
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[/CODE]

but i can't do:

[CODE]currentObject set value to chair
insert myVector at at beginning of currentObject.NextPositionVector[/CODE]

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
[/CODE]

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.


All times are GMT -5. The time now is 02:15 AM.

Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.