Fatal Error when loading Custom Story? - FurtherGames - 05-04-2013
It's not the first time I've had one, but all the other errors I have solved! But not this one. I think I know where the error is but I don't know what the error is.
I started a custom map, it's going well. I been scripting so that when the Player collides with a Script Area, a candle will go out. It's sort of hard to explain because it's more complex than that.
Inside one room, there are FIVE Candles. You can blow them out by walking up to them (Colliding with the area). Once all five candles have been blown out, the screen will fade. But because I don't want there to be a specific order the candles have to be blown out in, I've set it to after each candle has been blown out, the scripting will check for a Varible Count of 5 for "lamplit". Each time you blow out a candle the script checks for the count and adds one varible count is added on aswell. So no matter what candle you blow out last it should always fade to black. The script is made up of "if(GetLocalVarInt...". I'm having trouble with the "Else"
THE ERROR:
FATAL ERROR: Could not load script file 'custom_stories/Razors/maps/01_Tomb.hps'
main (121, 1) : ERR : Expected expression value
Line 121 is where the Else statement is placed.
HPS File:
PHP Code: void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_4", "Func1", true, 0); AddEntityCollideCallback("Player", "ScriptArea_5", "Func2", true, 0); AddEntityCollideCallback("Player", "ScriptArea_6", "Func3", true, 0); AddEntityCollideCallback("Player", "ScriptArea_7", "Func4", true, 0); AddEntityCollideCallback("Player", "ScriptArea_8", "Func5", true, 0); SetLocalVarInt("lamplit", 0); }
void OnEnter() {
}
void OnLeave() {
}
void Func1(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick01_1", false, true); SetLightVisible("PointLight_1", false); AddLocalVarInt("lamplit", 1); check(); }
void Func2(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick_floor_2", false, true); SetLightVisible("PointLight_11", false); AddLocalVarInt("lamplit", 1); check(); }
void Func3(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick_floor_1", false, true); SetLightVisible("PointLight_12", false); AddLocalVarInt("lamplit", 1); check(); }
void Func4(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick02_1", false, true); AddLocalVarInt("lamplit", 1); check(); }
void Func5(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick02_2", false, true); SetLightVisible("PointLight_13", false); AddLocalVarInt("lamplit", 1); check(); } void check() { if(GetLocalVarInt("lamplit")==5); { FadeOut(2); } else; {
} }
Please help! I don't want anything to happen in the "Else;" part.
RE: Fatal Error when loading Custom Story? - The chaser - 05-04-2013
Just remove the ; in the else and after the Variable. Like this:
PHP Code: void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_4", "Func1", true, 0); AddEntityCollideCallback("Player", "ScriptArea_5", "Func2", true, 0); AddEntityCollideCallback("Player", "ScriptArea_6", "Func3", true, 0); AddEntityCollideCallback("Player", "ScriptArea_7", "Func4", true, 0); AddEntityCollideCallback("Player", "ScriptArea_8", "Func5", true, 0); SetLocalVarInt("lamplit", 0); }
void OnEnter() {
}
void OnLeave() {
}
void Func1(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick01_1", false, true); SetLightVisible("PointLight_1", false); AddLocalVarInt("lamplit", 1); check(); }
void Func2(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick_floor_2", false, true); SetLightVisible("PointLight_11", false); AddLocalVarInt("lamplit", 1); check(); }
void Func3(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick_floor_1", false, true); SetLightVisible("PointLight_12", false); AddLocalVarInt("lamplit", 1); check(); }
void Func4(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick02_1", false, true); AddLocalVarInt("lamplit", 1); check(); }
void Func5(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick02_2", false, true); SetLightVisible("PointLight_13", false); AddLocalVarInt("lamplit", 1); check(); } void check() { if(GetLocalVarInt("lamplit")==5) { FadeOut(2); } else {
} }
RE: Fatal Error when loading Custom Story? - FurtherGames - 05-04-2013
(05-04-2013, 04:19 PM)The chaser Wrote: Just remove the ; in the else and after the Variable. Like this:
PHP Code: void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_4", "Func1", true, 0); AddEntityCollideCallback("Player", "ScriptArea_5", "Func2", true, 0); AddEntityCollideCallback("Player", "ScriptArea_6", "Func3", true, 0); AddEntityCollideCallback("Player", "ScriptArea_7", "Func4", true, 0); AddEntityCollideCallback("Player", "ScriptArea_8", "Func5", true, 0); SetLocalVarInt("lamplit", 0); }
void OnEnter() {
}
void OnLeave() {
}
void Func1(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick01_1", false, true); SetLightVisible("PointLight_1", false); AddLocalVarInt("lamplit", 1); check(); }
void Func2(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick_floor_2", false, true); SetLightVisible("PointLight_11", false); AddLocalVarInt("lamplit", 1); check(); }
void Func3(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick_floor_1", false, true); SetLightVisible("PointLight_12", false); AddLocalVarInt("lamplit", 1); check(); }
void Func4(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick02_1", false, true); AddLocalVarInt("lamplit", 1); check(); }
void Func5(string &in asParent, string &in asChild, int alState) { SetLampLit("candlestick02_2", false, true); SetLightVisible("PointLight_13", false); AddLocalVarInt("lamplit", 1); check(); } void check() { if(GetLocalVarInt("lamplit")==5) { FadeOut(2); } else {
} }
Yours doesn't look that different to mine, but it did the trick! Thanks so much![/b]
|