#include "fcb_inc_vars"
#include "fcb_inc_cvgen"
#include "fcb_inc_cvdisp"
#include "fcb_inc_general"
#include "fcb_inc_parser"
#include "fcb_inc_typespec"

//==========================================/
void main()
//==========================================/
    {
    object user = GetLastSpeaker();

    switch(GetListenPatternNumber())
        {
        case LISTEN_NUMBER_STANDARD:
            {
            //user filtering
            if(user == GetLocalObject(FCB_HOST, USER))
                {
                if(IsInConversation(FCB_CV))
                    {
                    string input = parse_init(GetMatchedSubstring(0));

                    //--------------------------------------/
                    switch(FILTER_F100 & GetLocalInt(FCB_HOST, SCRIPT_PARAM))
                        {
                        //--------------------------------------/
                        case SCRIPT_INDEX_LISTEN_SETNAME:
                            {
                            ui_disp_set_txt(DISP_INDEX_LOCAL1, UI_TXT_SETNAME_ENTERED, input);
                            SetLocalString(FCB_HOST, SETNAME_SEL, input);

                            ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 1, 0);
                            ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 2, 0);
                            ui_main_set_hidden_refresh(MAIN_FOLDER_INDEX_SETNAME | 3, 0);

                            ui_disp_refresh_txt();
                            //clear script number
                            clear_script_param();

                            start_conversation(user);

                            break;
                            }
                        }
                    }
                }

            break;
            }

        default:
            {
            object item_sel = GetFirstItemInInventory(EXT_PLACEABLE);

            if(GetIsObjectValid(item_sel)
            && !GetIsObjectValid(GetNextItemInInventory(EXT_PLACEABLE)))
                {
                SetLocalObject(FCB_HOST, USER, user);

                ui_main_initialize(MAIN_FOLDER_INDEX_MAINMENU);

                ui_set_active_disp_index(DISP_INDEX_HEADER);

                select_working_item(item_sel);
                ui_disp_refresh_txt();
                start_conversation(user);

                disp_delayed_msg(user, UI_TXT_EXT_INFO);
                }

            else
                {
                //SpeakString(c_crs(UI_TXT_EXT_INVALID));  //red
                SpeakString(UI_TXT_EXT_INVALID);           //normal color
                }

            break;
            }
        }
    }
