Run time error 6: "Invalid instruction" - Any Ideas?
#1

Hey all,

I made a simple textdraw menu, which you open by calling 'furni_showCatalog(playerid, _page=1) '

This works fine no errors, but when call it in the function ShowDialog (which is called from a dialog response) I get a Run time error 6: "Invalid instruction". I have tried calling showCatalog with local functions and timers but the error always occurs.


pawn Code:
furni_showCatalog(playerid, _page=1) {
    printf("furni_showCatalog (%i,%i)", playerid, _page);
    cat_player_page[playerid] = _page;
    TextDrawShowForPlayer(playerid, cat_background_0);
    TextDrawShowForPlayer(playerid, cat_background_1);
    TextDrawShowForPlayer(playerid, cat_background_2);
    TextDrawShowForPlayer(playerid, cat_background_next);
    TextDrawShowForPlayer(playerid, cat_background_back);
    furni_redrawCatalogItems(playerid);
    new pageText[20];
    format(pageText, 20, "Page %d of %d", _page, cat_list_pages);
    if (cat_page_text[playerid] == PlayerText:INVALID_TEXT_DRAW) {
        cat_page_text[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 376.000000, pageText);
        PlayerTextDrawAlignment(playerid,cat_page_text[playerid], 2);
        PlayerTextDrawBackgroundColor(playerid,cat_page_text[playerid], 255);
        PlayerTextDrawFont(playerid,cat_page_text[playerid], 1);
        PlayerTextDrawLetterSize(playerid,cat_page_text[playerid], 0.329999, 1.500000);
        PlayerTextDrawColor(playerid,cat_page_text[playerid], -1);
        PlayerTextDrawSetOutline(playerid,cat_page_text[playerid], 1);
        PlayerTextDrawSetProportional(playerid,cat_page_text[playerid], 1);
    } else {
        PlayerTextDrawSetString(playerid, cat_page_text[playerid], pageText);
    }
    PlayerTextDrawShow(playerid, cat_page_text[playerid]);
    SelectTextDraw(playerid, 0xFF4040AA);
}

furni_showDialog(playerid, furni_page=-1, furni_stage=0, furni_substage=0) {
    _furni_page[playerid] = furni_page;
    _furni_stage[playerid] = furni_stage;
    _furni_substage[playerid] = furni_substage;

    if (furni_page==-1) {
        ShowPlayerDialog(playerid, FURNI_DIALOGID_MAIN, DIALOG_STYLE_LIST, "House furniture", "Buy furniture\nEnable Select Mode\nSelect Item from list\nSell furniture", "Select", "Close");
    } else {
        switch (furni_page) {
            case FURNIPAGE_MAIN_BUY: {
                //furni_showCatalog(playerid);
                //CallLocalFunction("furni_showCatalog_pub", "i", playerid);
                print(">1");
                SetTimerEx("furni_showCatalog_pub", 5000, false, "i", playerid);
            }
        }
    }
    return 1;
}

furni_DialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    #pragma unused inputtext
    if (dialogid==FURNI_DIALOGID_MAIN) {
        new furni_page = _furni_page[playerid];
        new furni_stage = _furni_stage[playerid];
        //new furni_substage = _furni_substage[playerid];
        if (response) {
            switch (furni_page) {
                case -1: {
                    furni_showDialog(playerid, listitem); //When user selects 'Buy furniture' furni_showDialog(playerid,FURNIPAGE_MAIN_BUY) is called
                }
            }
        } else {
            _furni_page[playerid]=0;
            _furni_stage[playerid]=0;
            _furni_substage[playerid]=0;
            if (furni_page>-1) {
                furni_showDialog(playerid);
            }
        }
        return 1;
    }
    return 0;
}
Error:
pawn Code:
[16:19:08] >1
[16:19:08] [debug] Run time error 6: "Invalid instruction"
[16:19:08] [debug]  Unknown opcode 0x80000000 at address 0x0000001C
[16:19:08] [debug] AMX backtrace:
[16:19:08] [debug] #0 0000001c in public OnDialogResponse () from grimrandomerCNR.amx
[16:19:14] >2
[16:19:14] furni_showCatalog (0,1)

Any help appreciated.



Thanks, Grim.



Edit:
I found my own error xD

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if (furni_DialogResponse(playerid, dialogid, response, listitem)) return 1;
}
Should be:

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if (furni_DialogResponse(playerid, dialogid, response, listitem, inputtext)) return 1;
}
Reply


Messages In This Thread
Run time error 6: "Invalid instruction" [Fixed] - by Grimrandomer - 03.05.2014, 15:15

Forum Jump:


Users browsing this thread: 1 Guest(s)