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

Don Slater dslater at andrew.cmu.edu
Sun Dec 4 21:27:40 EST 2011


This is a bug in the current version of Alice 2.2, which should be fixed in the next release, which will happen in the next couple of days…

Thank you for your patience,

Don Slater

On Dec 4, 2011, at 11:54 AM, Findley, Scott wrote:

> 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
> Gleneagle Secondary School http://gleneagle.org
> Mr. Findley's Homeroom Site    Twitter @ rsfindley    Mr. Findley’s Blog @ Posterous    Writing 12 Posterous Site    
> 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.
>  
>  
>  
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers



More information about the alice-teachers mailing list