Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Change object's (parameter) variable in a World Method.
Old
SonicSam
Guest
 
Status:
Posts: n/a
Default Change object's (parameter) variable in a World Method. - 04-23-2010, 07:12 AM

I have 40 squares (tile) each with a "HidingObject" object variable I added in via the Properties Tab.



What I am trying to do via a World Method is assign other objects to it.

HOWEVER



What I am trying to do is set

Tile.HiddenObject set value to Object
Bolded items are parameters.

However, it will not let me specify a parameter, to access its variable.

The only solution I see is to do an IF statement for every square I have. (40 if statements)



So in conclusion

I am trying to change a variable of a object, specified via a parameter of a world method.

Help would be appreciated
   
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-23-2010, 12:44 PM

Put simply: you can't. You need to fake it by using one of the built in variables that all of the objects have. For example, since you need an object variable, you could have Tile set it's vehicle to Object, then reference it accordingly (since Alice will let you reference and alter the value of the Vehicle of a parameter).


(')>
   
Reply With Quote
Old
SonicSam
Guest
 
Status:
Posts: n/a
Default 04-23-2010, 02:24 PM

Quote:
Originally Posted by x2495iiii View Post
Put simply: you can't. You need to fake it by using one of the built in variables that all of the objects have. For example, since you need an object variable, you could have Tile set it's vehicle to Object, then reference it accordingly (since Alice will let you reference and alter the value of the Vehicle of a parameter).
Hello,

Setting the Tile's vehicle to the object won't work due to limitations in what I'm trying to do (I would explain, but for the sake of simplicity I'll just say I know that won't work).

What I ended up doing was 40 if's in a Do Together,

if Tile = square { square.HidingObject set to Object }
if Tile = square2 { square2.HidingObject set to Object }
if Tile = square3 { square3.HidingObject set to Object }

It works great and while it is a little work around, I'm satisfied

Thanks,
Sam
   
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-23-2010, 05:49 PM

Glad you got it working and sorry the simple, obvious solution didn't work. Believe me, I'd love more references to references in Alice as well.


(')>
   
Reply With Quote
Reply


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.