dim3 Forum

Full Version: 'Missing Formal Parameter'- Eh?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Missing Formal Parameter

Another error of which I have no idea of its meaning. A quick google search said that it arises in javascript when you put in a 'var' when you don't need to, like in say: thisfunction(var id).
And the section of my script the error is referring to does involve function variables, but it doesn't look like I'm doing anything wrong:
Code:
function playerMessage(obj,subEvent,id)
{
        // we are only checking for player_X key
        // message here, we can ignore all others
    if (subEvent!=DIM3_EVENT_MESSAGE_FROM_KEY_DOWN) return;
        // check messages
    switch (id) {
        case 4: //Secondary Weapon Back
            function weaponChange(2);
            return;
        case 5: //Secondary Weapon Forward
            function weaponChange(3);
            return;
        case 6: //Weapon Fire
            function weaponFire(true);
            return;
        case 7: //Weapon Forward
            function weaponChange(1);
            return;    
        case 8: //Weapon Backward
            function weaponChange(0);
            return;
        case 9: //Secondary Weapon Fire
            function weaponFire(false);
            return;
        case 10: // Fire Modifier
    // Heck man, I don't even know if I'm using this yet.
            return;    
    }
}
I'm trying to implement a primary and secondary weapon system here. So I'm not able to use all the built in weapon niceties.
Code:
function weaponChange(1);
Not sure what your trying to do here, but you need to remove function from the beginning and I don't think there should be a number in-between the parentheses.
No, I'm pretty sure thats right. Its how the case setup for the player function works anyway. The integer "id" is passed form the player message event. So I assume that putting an integer in there will work just as well.
Edit: Okay yeah, you were right about the not needing 'function' in there. That was a stupid mistake. :P
Thanks.
It's supposed to pass API to load to variables, correct me if I'm wrong.
I honestly don't know, this is just from what I've observed. It appears to be working now anyway.
Reference URL's