View Full Version : If/Else Events Alice 2.4.1

04-14-2014, 07:47 AM
I'm currently in a class using this version of Alice, and one of the assignments is to modify a world with 3 buttons; each button should toggle up+down with keystrokes from an event; and while each button is depressed it should play an audio file.
The starting world has an if/else statement in Events, with a boolean variable attached to the object inside (which I couldn't figure out how to duplicate, until I made the if/else statement inside of a function for that object, dragged the boolean over, ignoring recursive error, and then dragging the if/else into the events tab). That one toggles up+down correctly, and I did figure out how to duplicate that.
The problem that still alludes me, is toggling an audio file only while the button is depressed. The initial startup world's example audio file does not work, as it has a variable for the object as the condition (which I cant duplicate, only a world variable seems to work in this location as i cant drag the function to the object to copy over).
But when I setup a world variable for that function, and add it to the method's (an existing method that toggles the boolean inside the up+down function; added the world variable inside those as well so it toggles both on depressing) the audio file does not play. Tried multiple variations, but none seem to have an effect. The only way to get the audio file to play from events, is to add the method containing it (or just the play sound from object). When doing that, the audio file plays the entire track and then terminates, the instructions were to have the file loop until the button was raised again.

Any help? Can provide the worlds if needed.

Cancel that question... Apparently its the version of Alice I'm using (2.4.1). In whatever version the school is using the audio toggle works just fine.