It looks like you're new here. If you want to get involved, click one of these buttons!
I hate to sound like a total dillweed, but I just can't figure out the if() function.
Here's my first attempt;
//-----------------------------------------------------------------------------
function Sub1Fortune()  // This function subtracts one point from the current
                        // Fortune.
    {
        var iCurrFortune = Fortune.value;
        var iNewFortune = 0;
        iNewFortune = iCurrFortune - 1
        if(iNewFortune < 0, 0, iNewFortune);
    }
//-----------------------------------------------------------------------------
Didn't do a thing.
Then, thinking maybe I'd misunderstood the meaning of "Return" in the if() function syntax from the help document, I tried this;
//-----------------------------------------------------------------------------
function Sub1Fortune()  // This function subtracts one point from the current
                        // Fortune.
    {
        var iCurrFortune = Fortune.value;
        var iNewFortune = 0;
        iReturnFortune = 0;
        iNewFortune = iCurrFortune - 1
        iReturnFortune = if(iNewFortune < 0, 0, iNewFortune);
        return iReturnFortune;
    }
//-----------------------------------------------------------------------------
This just gave me a syntax error on the if() line, which I figured it would.
Basically, all I want to do is subtract 1 from the current Fortune, unless that would result in a value less than 0, in which case it needs to remain 0. It seems this should be a simple thing.
Thanx for any assistance!
Comments
The if function is for expressions. If you're using javascript, you need to use regular javascript syntax, ie,
if (x) { doY()}Oh, well, heck. I thought the CSD functions would override JS functions.
Well, that makes things easy. Thanx!