Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ERR : Expected expression value
XDJ5000
Unregistered

 
#1
ERR : Expected expression value

Hi everyone! I'm having some troubles while scripting my map. When I run the map the game says Fatal error ERR : Expected expression value main(1446, 9).
Here there is a function that may cause this error becuase it's between line 1267 and 1481:
void Respawn(string &in asName, int alCount)
{
if(GetLocalVarInt("NoKnockingVar") == 1){
SetLightVisible("PointLight_43", true);
}
else{
SetLightVisible("PointLight_43", false);
}
if(GetLocalVarInt("MemoriesVar") >= 27){
SetLightVisible("PointLight_20", true);
SetPlayerHealth(100.5f);
SetPlayerSanity(100.5f);
StartEffectEmotionFlash("Hints", "Hintmemorybonus05", "insanity_imageflash01");
AddEntityCollideCallback("Player", "AllClearArea", "Aclearend", true, 1);
}
else{
if(GetLocalVarInt("InsanityVar") >= 1)
{
SetEntityActive("human_bone_6", true);
SetEntityActive("human_bone_8", true);
SetEntityActive("human_bone_9", true);
SetEntityActive("human_bone_7", true);
SetEntityActive("human_bone_5", true);
SetEntityActive("human_skull_7", true);
SetEntityActive("rat_corpse_pile_4", true);
SetEntityActive("rat_corpse_pile_3", true);
SetEntityActive("rat_corpse_pile_2", true);
SetEntityActive("rat_corpse_pile_5", true);
SetEntityActive("rat_corpse_pile_6", true);
SetEntityActive("rat_corpse_pile_7", true);
SetEntityActive("rat_corpse_pile_8", true);
SetEntityActive("rat_corpse_pile_9", true);
SetEntityActive("rat_corpse_pile_10", true);
SetEntityActive("slime_anim_wall_5", true);
SetEntityActive("slime_anim_wall_4", true);
SetEntityActive("stuffed_dog_head_2", true);
}
SetInventoryDisabled(false);
SetPlayerMoveSpeedMul(0.99f);
SetPlayerRunSpeedMul(0.99f);
AddLocalVarInt("DeathVar", 1);
AddTimer("ScaryDeath05", 10.25f, "TimerReactBreath");
PlaySoundAtEntity("whisper", "insanity_whisper", "Player", 0, false);
AddEntityCollideCallback("Player", "ScaryStepsArea01", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea02", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea03", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea04", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea05", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea06", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea07", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea08", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea09", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea10", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea11", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea12", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea13", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea14", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea15", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea16", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "ScaryStepsArea17", "Ascarysteps", true, 1);
AddEntityCollideCallback("Player", "WhispersArea01", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea02", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea03", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea04", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea05", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea06", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea07", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea08", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea09", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea10", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea11", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea12", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea13", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea14", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea15", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea16", "Awhispers", true, 1);
AddEntityCollideCallback("Player", "WhispersArea17", "Awhispers", true, 1);
SetEntityActive("empty_frame_2", false);
if(GetLocalVarInt("DeathVar") >= 4)
{
if(GetLocalVarInt("NoMonstersVar") >= 3)
{
SetPlayerHealth(55.5f);
SetPlayerSanity(25.5f);
SetPlayerLampOil(20.5f);
PlayMusic("01_dungeon.ogg", true, 1.0f, 4.0f, 0, true);
AddTimer("Waitformusic02", 1.25f, "TimerDeathMusic02");
SetEntityActive("candle_floor_small_84", false);
SetEntityActive("candle_floor_small_85", false);
SetEntityActive("candle_floor_small_86", false);
SetEntityActive("candle_floor_small_87", false);
SetEntityActive("candlestick_wall_1", false);
SetEntityActive("candlestick_wall_2", false);
SetEntityActive("candlestick_wall_3", false);
SetEntityActive("candlestick_wall_4", false);
SetEntityActive("candlestick_wall_5", false);
SetEntityActive("candlestick_wall_6", false);
SetEntityActive("candlestick_wall_7", false);
SetEntityActive("candlestick_wall_8", false);
SetEntityActive("stove_corner_1", false);
SetEntityActive("bonfire_1", false);
SetEntityActive("sofa_1", false);
SetEntityActive("table_nice_round_1", false);
SetEntityActive("chair_nice01_1", false);
SetEntityActive("chair_nice01_2", false);
SetEntityActive("chest_of_drawers_nice_1", false);
SetEntityActive("arabic_statue_1", false);
SetEntityActive("arabic_statue_gold_1", false);
SetEntityActive("candlestick01_1", false);
SetEntityActive("banner01_1", false);
SetEntityActive("banner01_2", false);
SetEntityActive("plate_1", false);
SetEntityActive("plate_2", false);
SetEntityActive("rolled_up_carpet_1", false);
SetEntityActive("pot_plant_small02_1", false);
SetEntityActive("stool_wood_1", false);
SetEntityActive("stool_wood_2", false);
SetEntityActive("armchair_1", false);
SetEntityActive("armchair_2", false);
SetEntityActive("armchair_3", false);
}
else
{
SetPlayerHealth(55.5f);
SetPlayerSanity(25.5f);
SetPlayerLampOil(20.5f);
PlayMusic("01_dungeon.ogg", true, 1.0f, 4.0f, 0, true);
AddTimer("Waitformusic02", 1.25f, "TimerDeathMusic02");
AddEntityCollideCallback("Player", "GruntArea01", "Agrunt01", true, 1);
AddEntityCollideCallback("Player", "GruntArea02", "Agrunt02", true, 1);
AddEntityCollideCallback("Player", "GruntArea03", "Agrunt03", true, 1);
AddEntityCollideCallback("Player", "GruntArea04", "Agrunt04", true, 1);
AddEntityCollideCallback("Player", "GruntArea06", "Agrunt06", true, 1);
AddEntityCollideCallback("Player", "BruteArea01", "Abrute01", true, 1);
AddEntityCollideCallback("Player", "BruteArea02", "Abrute02", true, 1);
AddEntityCollideCallback("Player", "BruteArea03", "Abrute03", true, 1);
AddEntityCollideCallback("Player", "BruteArea04", "Abrute04", true, 1);
AddEntityCollideCallback("Player", "BruteArea06", "Abrute06", true, 1);
AddEntityCollideCallback("Player", "SuitorArea02", "Asuitor02", true, 1);
AddEntityCollideCallback("Player", "SuitorArea03", "Asuitor03", true, 1);
AddEntityCollideCallback("Player", "SuitorArea04", "Asuitor04", true, 1);
AddEntityCollideCallback("Player", "SuitorArea05", "Asuitor05", true, 1);
AddEntityCollideCallback("Player", "SuitorArea06", "Asuitor06", true, 1);
SetEntityActive("candle_floor_small_84", false);
SetEntityActive("candle_floor_small_85", false);
SetEntityActive("candle_floor_small_86", false);
SetEntityActive("candle_floor_small_87", false);
SetEntityActive("candlestick_wall_1", false);
SetEntityActive("candlestick_wall_2", false);
SetEntityActive("candlestick_wall_3", false);
SetEntityActive("candlestick_wall_4", false);
SetEntityActive("candlestick_wall_5", false);
SetEntityActive("candlestick_wall_6", false);
SetEntityActive("candlestick_wall_7", false);
SetEntityActive("candlestick_wall_8", false);
SetEntityActive("stove_corner_1", false);
SetEntityActive("bonfire_1", false);
SetEntityActive("sofa_1", false);
SetEntityActive("table_nice_round_1", false);
SetEntityActive("chair_nice01_1", false);
SetEntityActive("chair_nice01_2", false);
SetEntityActive("chest_of_drawers_nice_1", false);
SetEntityActive("arabic_statue_1", false);
SetEntityActive("arabic_statue_gold_1", false);
SetEntityActive("candlestick01_1", false);
SetEntityActive("banner01_1", false);
SetEntityActive("banner01_2", false);
SetEntityActive("plate_1", false);
SetEntityActive("plate_2", false);
SetEntityActive("rolled_up_carpet_1", false);
SetEntityActive("pot_plant_small02_1", false);
SetEntityActive("stool_wood_1", false);
SetEntityActive("stool_wood_2", false);
SetEntityActive("armchair_1", false);
SetEntityActive("armchair_2", false);
SetEntityActive("armchair_3", false);
}
}
}
else{

if(GetLocalVarInt("NoMonstersVar") >= 3)
{
SetPlayerHealth(75.5f);
SetPlayerSanity(50.5f);
SetPlayerLampOil(30.5f);
PlayMusic("01_dungeon.ogg", true, 1.0f, 4.0f, 0, true);
AddTimer("Waitformusic01", 1.25f, "TimerDeathMusic01");
}
else
{
SetPlayerHealth(75.5f);
SetPlayerSanity(50.5f);
SetPlayerLampOil(30.5f);
PlayMusic("01_dungeon.ogg", true, 1.0f, 4.0f, 0, true);
AddTimer("Waitformusic01", 1.25f, "TimerDeathMusic01");
AddEntityCollideCallback("Player", "GruntArea01", "Agrunt01", true, 1);
AddEntityCollideCallback("Player", "GruntArea02", "Agrunt02", true, 1);
AddEntityCollideCallback("Player", "GruntArea03", "Agrunt03", true, 1);
AddEntityCollideCallback("Player", "GruntArea04", "Agrunt04", true, 1);
AddEntityCollideCallback("Player", "GruntArea06", "Agrunt06", true, 1);
AddEntityCollideCallback("Player", "BruteArea01", "Abrute01", true, 1);
AddEntityCollideCallback("Player", "BruteArea02", "Abrute02", true, 1);
AddEntityCollideCallback("Player", "BruteArea03", "Abrute03", true, 1);
AddEntityCollideCallback("Player", "BruteArea04", "Abrute04", true, 1);
AddEnttityCollideCallback("Player", "BruteArea06", "Abrute06", true, 1);
AddEntityCollideCallback("Player", "SuitorArea02", "Asuitor02", true, 1);
AddEntityCollideCallback("Player", "SuitorArea03", "Asuitor03", true, 1);
AddEntityCollideCallback("Player", "SuitorArea04", "Asuitor04", true, 1);
AddEntityCollideCallback("Player", "SuitorArea05", "Asuitor05", true, 1);
AddEntityCollideCallback("Player", "SuitorArea06", "Asuitor06", true, 1);
}
}

}

Oh I have forgotten to tell you that line 1446 is this one:
1446: else{

if(GetLocalVarInt("NoMonstersVar") >= 3)
{
SetPlayerHealth(75.5f);
SetPlayerSanity(50.5f);
SetPlayerLampOil(30.5f);
PlayMusic("01_dungeon.ogg", true, 1.0f, 4.0f, 0, true);
AddTimer("Waitformusic01", 1.25f, "TimerDeathMusic01");
}
else
{
SetPlayerHealth(75.5f);
SetPlayerSanity(50.5f);
SetPlayerLampOil(30.5f);
PlayMusic("01_dungeon.ogg", true, 1.0f, 4.0f, 0, true);
AddTimer("Waitformusic01", 1.25f, "TimerDeathMusic01");
AddEntityCollideCallback("Player", "GruntArea01", "Agrunt01", true, 1);
AddEntityCollideCallback("Player", "GruntArea02", "Agrunt02", true, 1);
AddEntityCollideCallback("Player", "GruntArea03", "Agrunt03", true, 1);
AddEntityCollideCallback("Player", "GruntArea04", "Agrunt04", true, 1);
AddEntityCollideCallback("Player", "GruntArea06", "Agrunt06", true, 1);
AddEntityCollideCallback("Player", "BruteArea01", "Abrute01", true, 1);
AddEntityCollideCallback("Player", "BruteArea02", "Abrute02", true, 1);
AddEntityCollideCallback("Player", "BruteArea03", "Abrute03", true, 1);
AddEntityCollideCallback("Player", "BruteArea04", "Abrute04", true, 1);
AddEnttityCollideCallback("Player", "BruteArea06", "Abrute06", true, 1);
AddEntityCollideCallback("Player", "SuitorArea02", "Asuitor02", true, 1);
AddEntityCollideCallback("Player", "SuitorArea03", "Asuitor03", true, 1);
AddEntityCollideCallback("Player", "SuitorArea04", "Asuitor04", true, 1);
AddEntityCollideCallback("Player", "SuitorArea05", "Asuitor05", true, 1);
AddEntityCollideCallback("Player", "SuitorArea06", "Asuitor06", true, 1);
}
}

}
09-20-2016, 04:14 PM
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: ERR : Expected expression value

This code is... rather... overcomplicated. I won't judge harshly on that, but it did take a while to weed through it to find out your error.

Please note I'm referring to my image, thus I will use the numbers relative to your code. For example, instead of stating Line 1446, I will state Line 185. You can also click the image if it is too small.

[Image: 12f8650e76.png]

From what I can see, after formatting your code, you start an if-then-else conditional on Line 12 and call the else at Line 20. That's fine, but then all of the code between Line 21 and Line 184 runs.

Your error, however, is because you have declared the else statement at Line 20, you can't declare the else at Line 185. The reason being is this:

PHP Code: (Select All)
if(conditionis true    //Line 12
{
 
//execute                       //Line 14-18
}
else, 
condition is false       //Line 20
{
 
//execute                       //Line 22-184
}
else, 
condition is false       //Line 185
{
 
//Error                          //There is an error, because we check for a true condition, and otherwise give a false. 


There are two ways you can fix this, other than reorganising your code so it is just that little bit more pleasing to view.

1. Use an else if statement to check for another set conditional. This means, adding another conditional check to your if-then-else for another specific value or range. This would turn the above snippet into this:
if(condition_1 is true)
{
//execute
}
else if(condition_2 is true)
{
//execute
}
else (condition is false)
{
//execute
}

You can find more info about that here: https://wiki.frictionalgames.com/hpl2/am...-statement

Or 2. You can add another if-then-else to do the checking necessary against the value or variable you would like, outside of the original if-then-else between Line 20 and Line 184.

Not much more I can suggest. Good luck! Also - you've posted this in the wrong section, it should go into Development Support, but I understand that unregistered users cannot post there, so no biggie! I'll move it over when this issue is solved Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 09-20-2016, 04:53 PM by Romulator.)
09-20-2016, 04:48 PM
Find
XDJ5000
Unregistered

 
#3
RE: ERR : Expected expression value

Thank you Romulator I've fixed the error and I've reorganized the whole function following your tips and reading control flow lessons Smile now it's fixed there's no error thank you so much! Big Grin
09-20-2016, 05:39 PM




Users browsing this thread: 1 Guest(s)