joystick object
This function returns a list of all the buttons on the joystick that have just been released.
int[] buttons_released()
Parameters:
None.
Return value:
An array with the buttons that have just been released, or an empty array if no buttons have been released since the last call or if an error occurs.
Remarks:
The difference between buttons_up and buttons_released is that buttons_released will only return a list of the buttons that the user has just released, while buttons_up will return a list of the buttons that are currently up regardless of whether the same buttons have been reported as being up in a previous call.
Please note that buttons_released and button_released use the same joystick state, so if a call to buttons_released is made right before a call to button_released, none of the buttons returned by buttons_released will be reported as just having been released by button_released. The same holds true for the reverse senario.
The joystick object supports up to 128 buttons, ranging from 0 to 127. However the actual maximum button is determined by the buttons property for the given device, ranging from 0 to buttons minus 1.
It is important to remember when mapping functions to joystick buttons that devices can vary greatly between models, supporting anything between 3 and 15 buttons, and therefore it is always a good idea to map the most common activities to buttons with lower numbers.
Example:

    // Speak the button codes of any buttons that are released, and exit if the user presses escape.

    void main()
    {
    show_game_window("buttons released Test");
    tts_voice speech;
    joystick stick;
    if(stick.joysticks==0)
    {
    alert("Error", "No joysticks seem to be attached.");
    exit();
    }
    int[] list;
    while(key_pressed(KEY_ESCAPE)==false)
    {
    list=stick.buttons_released();
    for(int i=0;i<list.length();i++)
    {
    if(i==0)
    {
    speech.speak_interrupt(list[i]);
    }
    else
    {
    speech.speak(list[i]);
    }
    }
    wait(5);
    }
    }