Alice Community  

Go Back   Alice Community > General Discussion > Questions and Comments

Reply
 
Thread Tools Display Modes
Null error when passing parameters between methods
Old
keif8283
Junior Member
 
Status: Offline
Posts: 2
Join Date: Mar 2012
Default Null error when passing parameters between methods - 03-31-2012, 07:45 PM

Hi all! I am working on a program that is from the "Learning to Program with Alice" textbook. I and several of my classmates have come across an error in a particular program. In the program there are several world methods that are called to have Zeus zap an object that is clicked with the mouse. The program passes the target between methods to perform the zap. Once and item is clicked however, I get an error "Alice has detected a problem with your world: target value must not be null" If I change the code to only work when one named target is clicked I get the attached error code. I have included the world for reference. I am using Alice 2.2 for Windows with the textbook.
Attached Files
File Type: txt error.txt (6.6 KB, 4 views)
File Type: a2w Ch6Ex6.a2w (3.79 MB, 13 views)
   
Reply With Quote
Old
Muki
Junior Member
 
Status: Offline
Posts: 5
Join Date: Mar 2012
Default 04-02-2012, 12:03 AM

Heh, we had the same issue in our class.
   
Reply With Quote
Same issue
Old
ashleyfullstop
Guest
 
Status:
Posts: n/a
Default Same issue - 04-02-2012, 04:36 PM

I'm also having this exact issue. So frustrating! I can't tell if it's Alice or my own poor coding. Please let me know if you find a solution.
   
Reply With Quote
Old
BlackOpsZombieMaker
Member
 
Status: Offline
Posts: 15
Join Date: Mar 2012
Location: Milwaukee, WI
Default 04-02-2012, 04:41 PM

pretty sure its Alice. its a really stupid program
   
Reply With Quote
Old
ashleyfullstop
Guest
 
Status:
Posts: n/a
Default 04-02-2012, 04:47 PM

I saw in the troubleshooting thread that this is a known bug in Alice 2.2 and should be fixed in the update of 3/1/12 - I'm going to try downloading again.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 04-02-2012, 05:00 PM

There's a relatively simple workaround.

Just make a new variable of the same data type as the parameter being passed (local and global variables work), set the variable's value to the parameter, then use the variable as the value for the parameter of the method call.

Here's the fixed world implementing this.
Attached Files
File Type: a2w Ch6Ex6Mod.a2w (3.77 MB, 24 views)


(')>
   
Reply With Quote
Old
ashleyfullstop
Guest
 
Status:
Posts: n/a
Default 04-02-2012, 05:11 PM

I downloaded the updated version of Alice 2.2 and everything works fine now.
   
Reply With Quote
Update
Old
keif8283
Junior Member
 
Status: Offline
Posts: 2
Join Date: Mar 2012
Default Update - 04-02-2012, 05:48 PM

Thanks everyone for all the feedback. I am going to try the March 1 2012 version. I will report back if that fixes the issue for me as well.
   
Reply With Quote
Reply

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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.