Jump to content
You are about to reply to a thread that has been inactive for 1606 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Posted (edited)

Hi

I have a weird bug.

My pre-processed source code is dropping several functions from the raw source. If I comment out one short function from my source, they all reappear.

I have been having stack-heap collision issues as the script is quite large.

Could this be a symptom of the pre-processor running out of memory during its run? I'm at a loss.

(It's the Firestorm pre-processor I'm referring to btw).

Any help appreciated.

Edited by CiciEf
missed info
Posted

The preprocessor isn't limited by memory the same way scripts are. It's extremely unlikely that'd be your issue.

Though, it will remove any unused functions/variables from the source. If that "one short function" calls other functions, but those other functions aren't used anywhere else, they'll all be removed.

Are you getting actual syntax (or other) errors? Share those.

Posted (edited)

Hi Wulfie

Not sure how best to share. Should I post my whole script file?

I'm getting a syntax error which appears to be being caused by the disappearing functions

 

Edited by CiciEf
update
Posted
Just now, CiciEf said:

Hi Wulfie

Not sure how best to share. Should I post my whole script file?

Sure. When you're writing a new post, there's a little <> button above the text field, which allows you to insert a code-block.

a3f5af6f10.png

Posted (edited)

OK so here are 

 

a) my source code (extract)

b) the preprocessor output

I get a syntax error on the first line of deductScores()

 

The functions in between are used in the program.

If I comment out deductScores, the functions reappear in the preprocessed output (with no syntax error)

//Re-pack table to the left
defragTable()
{

    integer i;
    integer j;
    integer cnt = 0;
    list tempTable = [];

    // Put active tiles in temp list
    for (i=0; i<15; i++) { 
        if (l2i(TABLE, i) > 0) {
            tempTable += l2i(TABLE, i);
            cnt++;
        }
    }
    // Clear table
    TABLE = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];

    for (i=0, j=0; i<15; i++)
        clearTile(offset(BOARD_TABLE,i));

    // Rebuild table
    for (i=0; i<len(tempTable); i++) { 
        if (l2i(tempTable, i) > 0) {
            TABLE[j] = l2i(tempTable, i);
            placeTile(offset(BOARD_TABLE,j), (integer)TABLE[j]);
            j++;
        }
    }

}

switchTurns()
{
    if (whoseTurn == 1)
        whoseTurn = 0;
    else whoseTurn = 1;
}

// Bomb out if we ever overflow the hand area
integer checkHandsOverflow(integer count)
{
    if ( count > maxHANDS-1) {

        llSay(0, "Sorry - game has overflowed hand area - please complain to the designer!");
        return( 1 );
    }
    return( 0 );
}

setMeld(integer row, integer tile)
{

    integer rStart;
    integer indx;
    integer score;
    integer rTouch; integer vTouch;


    //debug("TABLE: setMeld got row " + (string)row + " tile " + (string)tile);

    /* Hand baton to scoring script */

    logMeld(row, tile);

    llMessageLinked(LINK_ROOT, TO_SCORER, (string)row + "|" + (string)tile, (string)activePlayer);

}


integer deductScores(pl)
{

    integer i;
    integer s = 0;

    for (i=0; i < (integer)cntDEDUCT[pl];  i++) {

        if (i < 2)
            s += 1;
        else if (i < 5)
            s += 2;
        else
            s += 3;
    }

    return( s );

}
 
defragTable()
{

    integer i;
    integer j;
    integer cnt = 0;
    list tempTable = [];

    
    for (i=0; i<15; i++) { 
        if (llList2Integer(TABLE,  i) > 0) {
            tempTable += llList2Integer(TABLE,  i);
            cnt++;
        }
    }
    
    TABLE = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];

    for (i=0, j=0; i<15; i++)
        clearTile(offset(BOARD_TABLE,i));

    
    for (i=0; i<llGetListLength(tempTable); i++) { 
        if (llList2Integer(tempTable,  i) > 0) {
            TABLE=lazy_list_set(TABLE,j,[llList2Integer(tempTable,  i)]);
            placeTile(offset(BOARD_TABLE,j), llList2Integer(TABLE,j));
            j++;
        }
    }

}


integer deductScores(pl)
{

    integer i;
    integer s = 0;

    for (i=0; i < llList2Integer(cntDEDUCT,pl);  i++) {

        if (i < 2)
            s += 1;
        else if (i < 5)
            s += 2;
        else
            s += 3;
    }

    return( s );

}

 

Edited by CiciEf
.
Posted (edited)
3 minutes ago, CiciEf said:

integer deductScores(pl)

Well, there's your problem. Missing type.

Also, the three other functions aren't used anywhere by these functions, so they get removed.

Edited by Wulfie Reanimator
  • Like 1
You are about to reply to a thread that has been inactive for 1606 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...