Frictional Games Forum (read-only)
[SCRIPT] 1 error which I can't solve/find?! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] 1 error which I can't solve/find?! (/thread-24451.html)

Pages: 1 2


RE: 1 error which I can't solve/find?! - Romulator - 01-24-2014

(01-24-2014, 11:15 PM)Badcat5550 Wrote:
Code:
void Puzzle (string &in asEntity, int LeverState)
{
    if(GetLeverState("Lever1") == -1
    && GetLeverState("Lever2" ) == 1)
    && GetLeverState("Lever3" ) == -1
    && GetLeverState("Lever4" ) == -1
}

{      void UnlockDoor(string &in asEntity, int LeverState)
    SetSwingDoorLocked("Door", false, true);
    PlaySoundAtEntity("", "door_safety_open.ogg", "Door", 0, false);

}

PHP Code:
void Puzzle (string &in asEntityint LeverState)
{
    if(
GetLeverState("Lever1") == -1
    
&& GetLeverState("Lever2" ) == 1)
    && 
GetLeverState("Lever3" ) == -1
    
&& GetLeverState("Lever4" ) == -1
}

void UnlockDoor(string &in asEntityint LeverState)
{
    
SetSwingDoorLocked("Door"falsetrue);
    
PlaySoundAtEntity("""door_safety_open.ogg""Door"0false);

Your parenthesis ( { ) in the second void was wrong. Also, I know there is something wrong with your puzzle, but I can't help there because I don't work with if statements. There is at least one bracket missing/too many.


RE: 1 error which I can't solve/find?! - Radical Batz - 01-24-2014

(01-24-2014, 11:23 PM)Romulator Wrote:
(01-24-2014, 11:15 PM)Badcat5550 Wrote:
Code:
void Puzzle (string &in asEntity, int LeverState)
{
    if(GetLeverState("Lever1") == -1
    && GetLeverState("Lever2" ) == 1)
    && GetLeverState("Lever3" ) == -1
    && GetLeverState("Lever4" ) == -1
}

{      void UnlockDoor(string &in asEntity, int LeverState)
    SetSwingDoorLocked("Door", false, true);
    PlaySoundAtEntity("", "door_safety_open.ogg", "Door", 0, false);

}

PHP Code:
void Puzzle (string &in asEntityint LeverState)
{
    if(
GetLeverState("Lever1") == -1
    
&& GetLeverState("Lever2" ) == 1)
    && 
GetLeverState("Lever3" ) == -1
    
&& GetLeverState("Lever4" ) == -1
}

void UnlockDoor(string &in asEntityint LeverState)
{
    
SetSwingDoorLocked("Door"falsetrue);
    
PlaySoundAtEntity("""door_safety_open.ogg""Door"0false);

Your parenthesis ( { ) in the second void was wrong. Also, I know there is something wrong with your puzzle, but I can't help there because I don't work with if statements. There is at least one bracket missing/too many.

Hey a friend of mine told me to put it on voidonstart maybe the code puzzle will happen instantly if that works, so i put the code on void on start but now when I launch the game it gets me these 2 errors

FATAL ERROR: Could not load script file 'custom_stories/Lifeless_The Abandon/maps/Lifeless_The Abandon.hps'!
main (17, 7) : ERR : Expected identifier
main (18, 1) : ERR : Unexpected token '}'

here is the updated code maybe you can tell me what I did wrong, sorry for being like I know nothing. but I'm a beginner at coding and stufd, I'm still kinda learning little by little Smile

Code:
void OnStart()
{
    void Puzzle (string &in asEntity, int LeverState)
{
    if(GetLeverState("Lever1") == -1
    && GetLeverState("Lever2" ) == 1)
    && GetLeverState("Lever3" ) == -1
    && GetLeverState("Lever4" ) == -1
}

void UnlockDoor(string &in asEntity, int LeverState)
{
    SetSwingDoorLocked("Door", false, true);
    PlaySoundAtEntity("", "door_safety_open.ogg", "Door", 0, false);
}
}
wakeUp();
}

void wakeUp() {
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(10); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(0, 2);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.5, 2);
SetPlayerCrouching(true); // Simulates being on the ground
PlayMusic("18_amb.ogg", true, 1, 4, 1, true);
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
AddTimer("trig1", 11.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer) {
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
SetPlayerLampOil(29);
GiveSanityDamage(80, false);
GivePlayerDamage(30 , "false" , false, false);
SetPlayerMoveSpeedMul(0.56f);
SetPlayerRunSpeedMul(0);
//SetPlayerLookSpeedMul(0.5);
AddUseItemCallback("", "HollowNeedle", "CellDoor", "UseHollowNeedleOnDoor", true);
}

void UseHollowNeedleOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("CellDoor", false, true);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}

void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("CellGuardGrunt", true);
AddEnemyPatrolNode("CellGuardGrunt", "Node_1",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_4",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_6",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_10",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_15",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_18",0.001f, "");
}



RE: 1 error which I can't solve/find?! - PutraenusAlivius - 01-25-2014

Spoiler below!

PHP Code:
void OnStart()
{
wakeUp();
AddEntityCollideCallback("Player""AreaCollide""EventCollide"true1);
AddUseItemCallback("""HollowNeedle""CellDoor""UseHollowNeedleOnDoor"true);
}

void wakeUp() {
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(10); // Amount of seconds the fade in takes
FadeImageTrailTo(22);
FadeSepiaColorTo(02);
SetPlayerActive(false); 
FadePlayerRollTo(50220220); // "Tilts" the players head
FadeRadialBlurTo(0.52);
SetPlayerCrouching(true); // Simulates being on the ground
PlayMusic("18_amb.ogg"true141true);
AddTimer("trig1"11.0f"beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer) {
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(03333); // Change all settings to defaults
FadeRadialBlurTo(0.01);
FadeSepiaColorTo(04);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
SetPlayerLampOil(29);
GiveSanityDamage(80false);
GivePlayerDamage(30 "false" falsefalse);
SetPlayerMoveSpeedMul(0.56f);
SetPlayerRunSpeedMul(0);
//SetPlayerLookSpeedMul(0.5);
}

void UseHollowNeedleOnDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("CellDoor"falsetrue);
PlaySoundAtEntity("""unlock_door.ogg"asEntity0false);
RemoveItem(asItem);
}

void EventCollide(string &in asParentstring &in asChildint alState)
{
SetEntityActive("CellGuardGrunt"true);
AddEnemyPatrolNode("CellGuardGrunt""Node_1",0.001f"");
AddEnemyPatrolNode("CellGuardGrunt""Node_4",0.001f"");
AddEnemyPatrolNode("CellGuardGrunt""Node_6",0.001f"");
AddEnemyPatrolNode("CellGuardGrunt""Node_10",0.001f"");
AddEnemyPatrolNode("CellGuardGrunt""Node_15",0.001f"");
AddEnemyPatrolNode("CellGuardGrunt""Node_18",0.001f""); 


//Um where did you call the Puzzle callback function? 
void Puzzle(string &in asEntityint LeverState)
{
    if(
GetLeverState("Lever1") == -1
    
&& GetLeverState("Lever2" ) == 1
    
&& GetLeverState("Lever3" ) == -1
    
&& GetLeverState("Lever4" ) == -1)
     {
     
void UnlockDoor(string &in asEntityint LeverState)
     {
     
SetSwingDoorLocked("Door"falsetrue);
     
PlaySoundAtEntity("""door_safety_open.ogg""Door"0false);
    } 




RE: 1 error which I can't solve/find?! - ZyLogicX - 01-25-2014

Code:
void OnStart()
{
    void Puzzle (string &in asEntity, int LeverState)
{
    if(GetLeverState("Lever1") == -1
    && GetLeverState("Lever2" ) == 1)
    && GetLeverState("Lever3" ) == -1
    && GetLeverState("Lever4" ) == -1
}

void UnlockDoor(string &in asEntity, int LeverState)
{
    SetSwingDoorLocked("Door", false, true);
    PlaySoundAtEntity("", "door_safety_open.ogg", "Door", 0, false);
}
}

wakeUp();
{
}

void wakeUp()
{
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(10); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(0, 2);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.5, 2);
SetPlayerCrouching(true); // Simulates being on the ground
PlayMusic("18_amb.ogg", true, 1, 4, 1, true);
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
AddTimer("trig1", 11.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer)
{
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
SetPlayerLampOil(29);
GiveSanityDamage(80, false);
GivePlayerDamage(30 , "false" , false, false);
SetPlayerMoveSpeedMul(0.56f);
SetPlayerRunSpeedMul(0);
//SetPlayerLookSpeedMul(0.5);
AddUseItemCallback("", "HollowNeedle", "CellDoor", "UseHollowNeedleOnDoor", true);
}

void UseHollowNeedleOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("CellDoor", false, true);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
}

void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("CellGuardGrunt", true);
AddEnemyPatrolNode("CellGuardGrunt", "Node_1",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_4",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_6",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_10",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_15",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_18",0.001f, "");
}

Perhaps this may work?


RE: 1 error which I can't solve/find?! - FlawlessHappiness - 01-25-2014

Nooope nope nope nope!
Never put void into another void. Especially not void OnStart()

Please try the script fromJustAnotherPlayer