Frictional Games Forum (read-only)

Full Version: Meanings of Error Messages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As the title says, I'd like to know the meaning of some error messages that I'm getting. Now, normally, I can understand what they are all communicating and fix the error. However, I've been getting some that I can't seem to figure out how to fix. I am a bit leery of posting my code, so I'll do what I can to explain the situations.


main (31, 39) ERR: Expected expression value
if (GetLocalVarInt("Var1") == 1) && (GetLocalVarInt("Var2") == 1)
This one I can't seem to get right. I'm thinking my script is simply incorrect.

main (54, 2) ERR: No Matching Signatures to "AddEntityCollideCallback"
This one throws me off. I've triple checked all of my names in the editor as well as my function names.

main (94, 5) ERR: Timer is not declared.
main (94, 5) ERR: Expression must be of Boolean type

void Function(string &in asTimer)
{
if(timer == "timer_1")
{
//Stuff to happen
}
if (other timers continue)

I can't get this one either. I don't understand, as I've gotten a similarily scripted timer system to work before.

main (102, 11) ERR: No conversion from string @& to int available
This one is just tagged onto my other if(timer == "timer_x") functions


main (118, 13) ERR: Lightname not declared.
void Lightfunc(string &in asParent, string &in asChild, int alState)
{
SetLightVisible(Lightname, true);
}


Self explanatory, I think. But it seems as though it just wants to fight with me. Figured I'd post just in case.

So if any of you could offer some assistance, I'd really appreciate it. Smile
Lightname should be "Lightname".

And we need the specific code for the others to find out what exactly is wrong, it's almost always a syntax error. Not just the one line, the whole thing.
Bah. I suppose so. I just renamed things from my post to here. Though thanks on the light, I missed that.
There are going to be some functions that are EntityInteractCallback through the editor.
Code:
///////////////////
void OnStart()
{
    AddUseItemCallback("", "Lockpick", "StudyDoor", "UnlockStudy", true);
    AddUseItemCallback("", "Lockpick", "Chest", "UnlockChest", false);
    SetLeverStuckState("Chest", -1, true);
    SetLocalVarInt("HasShirt", 0);
    SetLocalVarInt("HasGem", 0);
    PlayMusic("20_amb.ogg", true, 1, 5, 1, true);
}
void UnlockStudy(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("StudyDoor", false, true);
    PlaySoundAtEntity("", "unlock_door", "StudyDoor", 0, false);
    SetMessage("ScreenText", "BrokenPick", 5);
}
void UnlockChest(string &in asItem, string &in asEntity)
{
    SetLeverStuckState("MedChest", 0, true);
    PlaySoundAtEntity("", "unlock_door", "Chest", 0, false);
}
void WearShirt(string &in asEntity)
{
    SetEntityActive("Shirt", false);
    PlaySoundAtEntity("", "pick_generic", "Shirt", 0, false);
    AddLocalVarInt("HasShirt", 1);
    
}
void BedroomDoorStatus(string &in asEntity)
{
    if (GetLocalVarInt("HasShirt") == 1) && (GetLocalVarInt("HasGem") == 1)
    {
        SetSwingDoorLocked("BedroomDoor", false);
    }
    if (GetLocalVarInt("HasShirt") == 1) && (GetLocalVarInt("HasGem" == 0))
    {
        SetMessage("OblivScreenText", "ShirtNoGem", 5);
    }
    if (GetLocalVarInt("HasShirt") == 0) && (GetLocalVarInt("HasGem" == 1))
    {
        SetMessage("OblivScreenText", "GemNoShirt", 5);
    }
}
void GemPickup(string &in asEntity)
{
    StartEffectFlash(0.5, 1, 0.5);
    PlaySoundAtEntity("", "insanity_imageflash.snt", "Player", 0, false);
    StopMusic(0, 1);
    PlayMusic("03_amb.ogg", true, 1, 3, 0, true);
    AddLocalVarInt("HasGem", 1);
}
void Gem2Pickup(string &in asEntity)
{
    AddEntityCollideCallback("Player", "FallBody", "Corpsefall", 1, true);
    StartEffectFlash(0.5, 1, 0.5);
    PlaySoundAtEntity("", "insanity_imageflash.snt", "Player", 0, false);
    StopMusic(0, 0);
    PlayMusic("17_amb.ogg", true, 1, 3, 1, true);
}
void Corpsefall(string &in asParent, string &in asChild, int alState)
{
    StartScreenShake(0.3, 5, 2, 1);
    PlaySoundAtEntity("", "21_intro_scream.snt", "Player", 0, false);
    SetEntityActive("corpse_male_*", true);
    GiveSanityDamage(25, true);
/////////////////////////////////
//Creates other effects outside the room.
    SetEntityActive("mansion_3", false);
    SetEntityActive("mansion_off_hinges_1", true);
    SetEntityActive("Slime*", true);
    SetLightVisible("StatueEye*", true);
    AddEntityCollideCallback("Player", "DisableLight", "StatueEyeRemove", 1, true);
}
void Daddy(string &in asEntity)
{
    SetMessage("ScreenText", "Father", 4);
    GiveSanityDamage(90, true);
    StopMusic(0, 1);
    PlayMusic("ui_terror_meter.ogg", true, 3, 1, 2, true);
    AddTimer("closet1", 4, "ClosetScare");
    AddTimer("closet2", 6, "ClosetScare");
    AddTimer("closet3", 8, "ClosetScare");
    AddTimer("closet4", 10, "ClosetScare");
    SetEntityActive("Painting*", false);
    SetEntityActive("Map*", false);
    SetEntityActive("MechSketch*", false);
    SetEntityActive("InsanePainting*", true);
    SetEntityActive("Rust*", true);
    SetEntityActive("mansion_2", false);
    SetEntityActive("PrisonExit", true);
}
void ClosetScare(string &in asTimer)
{
    if(timer == "closet1")
    {
        PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
        AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
        AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
        StartPlayerLookAt("DustArea", 1, 1, "");
    }
    if(timer == "closet2")
    {
        PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
        AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
        AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
        StopPlayerLookAt();
    }
    if(timer == "closet3")
    {
        PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
        AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
        AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
    }
    if (timer == "closet4")
    {
        PlaySoundAtEntity("", "break_wood.snt", "DustArea", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_break_25.ps", "DustArea", false);
        SetSwingDoorLocked("cabinet_nice_2*", false, false);
        AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
        AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
        AddEntityCollideCallback("Player", "EndLightArea", "EndLight", 1, true);
    }
}
void StatueEyeRemove(string &in asParent, string &in asChild, int alState)
{
    SetLightVisible("StatueEye*", false);
}
void EndLight(string &in asParent, string &in asChild, int alState)
{
    SetLightVisible("HallLight", true);
}

You need help or something with your script?

if (GetLocalVarInt("Var1") == 1) && (GetLocalVarInt("Var2") == 1)

Add another pair of parentheses around it like this:

if ((GetLocalVarInt("Var1") == 1) && (GetLocalVarInt("Var2") == 1))

This:

AddEntityCollideCallback("Player", "FallBody", "Corpsefall", 1, true);

To this:

AddEntityCollideCallback("Player", "FallBody", "Corpsefall", true, 1);

For timer, add this:

string x = asTimer;
if (x == "closet1")


Now replace "timer" with x for the rest of them.
(08-22-2011, 03:12 PM)Obliviator27 Wrote: [ -> ]main (31, 39) ERR: Expected expression value
if (GetLocalVarInt("Var1") == 1) && (GetLocalVarInt("Var2") == 1)
This one I can't seem to get right. I'm thinking my script is simply incorrect.
There were a few errors here, you had your GetLocalVarInt include the equality comparison operator on the last two ifs, and also I believe the whole if statement block must be in brackets. Fixed:
Code:
if (GetLocalVarInt("HasShirt") == 1 && GetLocalVarInt("HasGem") == 1)
    {
        SetSwingDoorLocked("BedroomDoor", false);
    }
    if (GetLocalVarInt("HasShirt") == 1 && GetLocalVarInt("HasGem") == 0)
    {
        SetMessage("OblivScreenText", "ShirtNoGem", 5);
    }
    if (GetLocalVarInt("HasShirt") == 0 && GetLocalVarInt("HasGem") == 1)
    {
        SetMessage("OblivScreenText", "GemNoShirt", 5);
    }

Quote:main (54, 2) ERR: No Matching Signatures to "AddEntityCollideCallback"
This one throws me off. I've triple checked all of my names in the editor as well as my function names.
You have the boolean true and int 1 arguments the wrong way around - so it is looking for a function with a different signature. Fixed:
Code:
AddEntityCollideCallback("Player", "FallBody", "Corpsefall", true, 1);
Quote:main (94, 5) ERR: Timer is not declared.
main (94, 5) ERR: Expression must be of Boolean type

void Function(string &in asTimer)
{
if(timer == "timer_1")
{
//Stuff to happen
}
if (other timers continue)

I can't get this one either. I don't understand, as I've gotten a similarily scripted timer system to work before.
You don't have a variable called "timer". you have a variable called asTimer. Fixed by renaming "asTimer" to timer.
Code:
void ClosetScare(string &in timer)
{
    if(timer == "closet1")
    {
        PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
        AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
        AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
        StartPlayerLookAt("DustArea", 1, 1, "");
    }
    if(timer == "closet2")
    {
        PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
        AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
        AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
        StopPlayerLookAt();
    }
    if(timer == "closet3")
    {
        PlaySoundAtEntity("", "scare_slam_door.snt", "cabinet_nice_2", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "DustArea", false);
        AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
        AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
    }
    if (timer == "closet4")
    {
        PlaySoundAtEntity("", "break_wood.snt", "DustArea", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_break_25.ps", "DustArea", false);
        SetSwingDoorLocked("cabinet_nice_2*", false, false);
        AddBodyForce("cabinet_nice_2_leftdoor", 0, 0, -1, "world");
        AddBodyForce("cabinet_nice_2_rightdoor", 0, 0, -1, "world");
        AddEntityCollideCallback("Player", "EndLightArea", "EndLight", 1, true);
    }
}

Edit: ninja'd Wink
Kyle, you sir, are a mastermind. Thank you! I feel silly looking back at my callbacks and seeing that they were backwards. It works flawlessly now. Thank you very much!