alice-teacher (object)'s variable named (variableName) of type (valueClass) function help

Findley, Scott SFindley at sd43.bc.ca
Sun Dec 4 11:54:14 EST 2011


Question from a student regarding: (object)'s variable named (variableName) of type (valueClass) function help:

I'm trying to have Alice check the value of a variable in a list of objects and if that test returns false, I want to set that variable to a random number. However, alice's built in function for this, (object) 's variable named (variableName) of type (valueClass), only seems to be able to drop if the stars align (ie, I have no idea why it sometimes accepts it but mostly won't let me drop it in my code). Also I have only been successful in getting this to work when I'm checking a value in an if statement, however I also want to set the variable to a number. Here is kind of what I want my code to look like:

for all world.spawnPoints one item_from_spawnPoints at a time
 if ((item_from_spawnPoints's variable named timeBuffer of type Number) <=0) //this I managed to do but it was very difficult to to get the function in there and I'm not sure how I did it.
  //do stuff
  item_from_spawnPoints's variable named timeBuffer of type Number set value to world.random number //I have no idea how to do this line...
 else
  //do other stuff

I realize I could get around this by using multiple class level methods and having them change their own local variable, but that kind of defeats the whole purpose of a list (plus, I don't want to make 10+ methods when I could just use one).
I'd appreciate any solutions you guys have.


Mr. Scott Findley
sfindley at sd43.bc.ca<https://webmail.sd43.bc.ca/owa/redir.aspx?C=0a9bf7b1630b4554891428589166e563&URL=mailto%3asfindley%40sd43.bc.ca>
Gleneagle Secondary School http://gleneagle.org<https://webmail.sd43.bc.ca/owa/redir.aspx?C=0a9bf7b1630b4554891428589166e563&URL=http%3a%2f%2fgleneagle.org%2f>
Mr. Findley's Homeroom Site<http://teachers.sd43.bc.ca/sfindley/default.aspx>    Twitter @ rsfindley<http://twitter.com/rsfindley>    Mr. Findley's Blog @ Posterous<http://sfindley.posterous.com/>    Writing 12 Posterous Site<http://writing12.posterous.com/>
1195 Lansdowne Drive, Coquitlam, BC V3B 7Y8  604.464.5793 / 604.464.5796 (F)
While email is repeatedly checked, I typically reserve an hour daily for correspondence. Should you need a more immediate reply, please flag your message as urgent. Any emails received without a clear indication of the sender will receive no response.

This e-mail (including attachments, if any) may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Unless absolutely necessary, please do not print this email for environmental reasons.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20111204/ea03b640/attachment.html 


More information about the alice-teachers mailing list