Alice Community

Alice Community (
-   How do I...? (
-   -   Referring to 3D text objects as variables (

mdalis 06-20-2011 03:43 PM

Referring to 3D text objects as variables
Hi! :D This is my first post in the Alice Community, though I have been constantly referring to it throughout this summer as I have been doing Alice research at Duke University.

I'm writing a program to help kids learn how to multiply matrices. To multiply two 2x2 matrices together, I have 8 3D text objects to fill the matrices that I'm multiplying. I have an 8-item object array of these objects so I can easily refer to them and do the same thing to all of them, rather than doing it 8 times.

One thing I want to do to all of these number objects is change their text (set text to) to a number that the user inputs (or anything, for that matter), and I obviously use what as a string to change the number to a string type. The problem is that when I refer to an item in the array, Alice doesn't know for sure that it is a text object, so it doesn't let me drag objects from the array into set text to lines, or set the values of the arrays to strings. It seems to be that any object that is obviously a 3D text object can use the set text to, but if a variable object could be a 3D text object or could be something else, Alice doesn't let you use the text property. How can I, in a sense, promise Alice that my whole array is 3D text objects so that I can use the set text to method or the what as a string function?

Thank you so so much for all of your help!! Let me know if you need any more clarification! I don't think I want to post the whole program on the Internet (yet, but it will hopefully be available soon as a finished version on a Duke Alice website), but I can definitely write out some code if that would help.

arty-fishL 06-20-2011 04:59 PM

Put in a 'print' tile.
Drag 'as a string' onto the 'print' tile.
Drag array onto 'as a string'.
It might then be moveable from there into the appropriate place.
If not, then drag it onto a clipboard at the top right hand corner, then try dragging from the clipboard onto the appropriate place.

mdalis 06-21-2011 09:20 AM

Thank you for your response! That doesn't quite work, though. Although 'item 0 from world.matrixNumbers as a string' is indeed in the form of a string, I can't set its text to anything because now it's just a text string, not an object or variable that has properties or methods. I can set my object left(0,0)'s text to that since it is a string, but I can't set that string's text to anything. Anyone else have any ideas?

arty-fishL 06-21-2011 03:26 PM

I misunderstood what you wanted. Sorry, I don't think that can be done without scripting.

mdalis 06-21-2011 04:51 PM

What do you mean by scripting?

TauTrumpsPi 06-21-2011 04:59 PM

Using Java or Jython and editing the Alice software to make it do something beyond what Alice was originally made for.

All times are GMT -5. The time now is 01:30 PM.

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