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
Script Help Unexpected end of file error problem :(
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#11
RE: Unexpected end of file error problem :(

*facepalm* how did I not see this before >.>

Isn't it because he is missing the && in the second two?

Try the chasers one above first, then try this:
PHP Code: (Select All)
void UnlockDoor(string &in asEntityint LeverState)
{
if(
GetLeverState("Lever1") == -1)
&& (
GetLeverState("Lever2") == -1)
&& (
GetLeverState("Lever3") == 1)
&& (
GetLeverState("Lever4") == -1)

{
SetSwingDoorLocked("Door"falsetrue);
PlaySoundAtEntity("""unlock_door.snt""Door"0false);
}


And if that doesn't work, try this:
PHP Code: (Select All)
void UnlockDoor(string &in asEntityint LeverState)
{
if(
GetLeverState("Lever1") == -1
&& GetLeverState("Lever2") == -1
&& GetLeverState("Lever3") == 1
&& GetLeverState("Lever4") == -1)

{
SetSwingDoorLocked("Door"falsetrue);
PlaySoundAtEntity("""unlock_door.snt""Door"0false);
}


Discord: Romulator#0001
[Image: 3f6f01a904.png]
01-27-2014, 11:28 PM
Find
ingedoom Offline
Member

Posts: 120
Threads: 12
Joined: Feb 2012
Reputation: 0
#12
RE: Unexpected end of file error problem :(

Btw... I noticed that you do not call your unlockDoor function from anywhere in your code, so that might be the reason that nothing happens, but not the end of file problem which is surely due to bad syntax.

Also follow the second example remulator gave you in the post above this one. The first example has too many parenthesis.

Here is the full code as it compiles for me.. Should compile for you too. When you try to debug, make sure to load your map with a functioning script, so that it will not crash. Then you can use your debug menu to reload the map and see your error without crashes.

void OnStart()
{
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);
GiveSanityBoostSmall();
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, "");
}


void UnlockDoor(string &in asEntity, int LeverState)
{
        if(GetLeverState("Lever1") == -1
        && GetLeverState("Lever2") == -1
        && GetLeverState("Lever3") == 1
        && GetLeverState("Lever4") == -1)

        {
                SetSwingDoorLocked("Door", false, true);
                PlaySoundAtEntity("", "unlock_door.snt", "Door", 0, false);
        }
}

[Image: 23778.png]
(This post was last modified: 01-28-2014, 11:48 AM by ingedoom.)
01-28-2014, 11:31 AM
Website Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#13
RE: Unexpected end of file error problem :(

(01-28-2014, 11:31 AM)ingedoom Wrote: Btw... I noticed that you do not call your unlockDoor function from anywhere in your code, so that might be the reason that nothing happens, but not the end of file problem which is surely due to bad syntax.

Also follow the second example remulator gave you in the post above this one. The first example has too many parenthesis.

Here is the full code as it compiles for me.. Should compile for you too. When you try to debug, make sure to load your map with a functioning script, so that it will not crash. Then you can use your debug menu to reload the map and see your error without crashes.

void OnStart()
{
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);
GiveSanityBoostSmall();
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, "");
}


void UnlockDoor(string &in asEntity, int LeverState)
{
        if(GetLeverState("Lever1") == -1
        && GetLeverState("Lever2") == -1
        && GetLeverState("Lever3") == 1
        && GetLeverState("Lever4") == -1)

        {
                SetSwingDoorLocked("Door", false, true);
                PlaySoundAtEntity("", "unlock_door.snt", "Door", 0, false);
        }
}

How am I going to make the puzzle work and the door open after you do the lever puzzle, I've tried everything to make it work but nothing happens, and what do you mean there is no code foe the door, the is one "the unlock door one I guess" if not then pls tell
01-28-2014, 03:13 PM
Find
ingedoom Offline
Member

Posts: 120
Threads: 12
Joined: Feb 2012
Reputation: 0
#14
RE: Unexpected end of file error problem :(

Lever entities have a setting called "PlayerInteractCallback"; here you put a function name like "InteractLever"

Now some code
void InteractLever() {

if(LeverPuzzleSolved())
SetSwingDoorLocked("Door", false, true);
}

bool LeverPuzzleSolved() {

if (GetLeverState("Lever1") == -1
&& GetLeverState("Lever2") == -1
&& GetLeverState("Lever3") == 1
&& GetLeverState("Lever4") == -1)
return true;
else
return false;
}

This should unlock a door when the levers are set correctly.

[Image: 23778.png]
01-28-2014, 05:03 PM
Website Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#15
RE: Unexpected end of file error problem :(

should I put that in void on start?, because I don't know where I should exactly put it, here is my hps file

void OnStart()
{
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);
GiveSanityBoostSmall();
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, "");
}


void UnlockDoor(string &in asEntity, int LeverState)
{
        if(GetLeverState("Lever1") == -1
        && GetLeverState("Lever2") == -1
        && GetLeverState("Lever3") == 1
        && GetLeverState("Lever4") == -1)

        {
                SetSwingDoorLocked("Door", false, true);
                PlaySoundAtEntity("", "unlock_door.snt", "Door", 0, false);
        }
}
(This post was last modified: 01-28-2014, 05:40 PM by Radical Batz.)
01-28-2014, 05:39 PM
Find
ingedoom Offline
Member

Posts: 120
Threads: 12
Joined: Feb 2012
Reputation: 0
#16
RE: Unexpected end of file error problem :(

(01-28-2014, 05:39 PM)Badcat5550 Wrote: should I put that in void on start?, because I don't know where I should exactly put it, here is my hps file

I think you should be fine you just replace it with the current UnlockDoor function you made.

Please let me know if you get any errors and post the debug info.

[Image: 23778.png]
01-28-2014, 05:47 PM
Website Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#17
RE: Unexpected end of file error problem :(

(01-28-2014, 05:47 PM)ingedoom Wrote:
(01-28-2014, 05:39 PM)Badcat5550 Wrote: should I put that in void on start?, because I don't know where I should exactly put it, here is my hps file

I think you should be fine you just replace it with the current UnlockDoor function you made.

Please let me know if you get any errors and post the debug info.

It's not getting me an error but the lever puzzle is not working and won't unlock the door :/
01-28-2014, 05:59 PM
Find
ingedoom Offline
Member

Posts: 120
Threads: 12
Joined: Feb 2012
Reputation: 0
#18
RE: Unexpected end of file error problem :(

To help you further I will need your custom story.

The only advice I can give is to have a look at this
And make sure to use the void AddDebugMessage(string& asString, bool abCheckForDuplicates); to debug your code.

[Image: 23778.png]
01-28-2014, 08:11 PM
Website Find




Users browsing this thread: 1 Guest(s)