Two lines to replace, brightly marked and easily for you to spot.
You were creating one set of invalid string structures,(in the addInv function)
and one set on fixed-length strings that were locked to zero length.(in the 'main' function)

Easy to do.

PS if you see any other changes in the code, try to remove them as they were
un-intentional changes...

Code:
TEXT* inventory[20];
TEXT* tempTxt = {
    string ("");
}
var inventorySell[20];
TEXT* namess[20];
var tempNum = 1;

function addInv(STRING* itemName,var itemAtk, var itemDef, var itemSell){
    if(inventorySell[20] == 0){
        var i;    for(i=0; i<20; i++){
            if(inventorySell[i] == 0){
                str_cpy( ((tempTxt.pstring)[0]) , itemName);
                str_cat( ((tempTxt.pstring)[0]), " [");
                if(itemAtk)    str_cat_num( ((tempTxt.pstring)[0]),"%.0f", itemAtk);
                if(itemDef)    str_cat_num( ((tempTxt.pstring)[0]),"%.0f", itemDef);
                str_cat( ((tempTxt.pstring)[0]), "]");
                //((inventory[i].pstring)[0]) = ((tempTxt.pstring)[0]);<<<<<<<<<<<<<<<<<<<<<<<<<<Ditch this
                str_cpy((inventory[i].pstring)[0], (tempTxt.pstring)[0]);    //<<<<<<<<<<<<<<<<<<<<<Replace with this
                inventorySell[i] = itemSell;
                return;
            }
        }
    }
    return;
}

function main(){
    video_mode = 7;
    var i;
    for(i = 0;i<20;i++){
        inventory[i] = txt_create(1,20);
        (inventory[i])->pos_x = 630;
        (inventory[i])->pos_y = 100+(i*10);
        (inventory[i])->flags = VISIBLE;
        //((inventory[i])->pstring)[0] = "";<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Also Ditch this
        ((inventory[i])->pstring)[0] = str_create("");    //<<<<<<<<<<<<<<<<<<<and replace with this
    }
    
    namess[1] = txt_create(1,20);
    ((namess[1])->pstring)[0] = "name1";
    namess[2] = txt_create(1,20);
    ((namess[2])->pstring)[0] = "name2";
    namess[3] = txt_create(1,20);
    ((namess[3])->pstring)[0] = "name3";
    namess[4] = txt_create(1,20);
    ((namess[4])->pstring)[0] = "name4";
    namess[5] = txt_create(1,20);
    ((namess[5])->pstring)[0] = "name5";

    
    while(1){
        if(key_space)    {    addInv(((namess[tempNum])->pstring)[0],2+integer(random(13)),0,1);    wait(-0.5);        tempNum++;    }
        wait(1);
    }



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial