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


Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in Script file
jockelix Offline
Junior Member

Posts: 6
Threads: 3
Joined: Feb 2009
Reputation: 0
#1
Error in Script file

Hi, i am very new to scripting and when i try to open my level i get this error:

FATAL ERROR:could not load script file (points to my script)

main (16,8) : ERR : Expected ´(´


Can someone explain what is wrong?

void OnStart()
{
    if(ScriptDebugOn())
    {
        GiveItemFromFile("lantern", "lantern.ent");
        SetPlayerLampOil(100.0f);
        
        for(int i = 0;i < 10;i++)
        {
            GiveItemFromFile("tinderbox", "tinderbox.ent");
        }
            {    
                AddUseItemCallback("", "key_tower_1", "mansion_1", "KeyOnDoor", true);
            }

        void KeyOnDoor(string &in asItem, string &in asEntity)
        {
        SetSwingDoorLocked("mansion_1", false, true);
        PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
        }
    }
}
11-04-2010, 11:47 AM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#2
RE: Error in Script file

You do not put methods (void bla bla) into other methods.
Read this: http://hpl2.frictionalgames.com/tutorial...t_beginner

void OnStart()
{
    if(ScriptDebugOn())
    {
        GiveItemFromFile("lantern", "lantern.ent");
        SetPlayerLampOil(100.0f);
        
        for(int i = 0;i < 10;i++)
        {
            GiveItemFromFile("tinderbox", "tinderbox.ent");
        }
    }

    AddUseItemCallback("", "key_tower_1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
        SetSwingDoorLocked("mansion_1", false, true);
        PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

(This post was last modified: 11-04-2010, 11:59 AM by Pandemoneus.)
11-04-2010, 11:58 AM
Find
jockelix Offline
Junior Member

Posts: 6
Threads: 3
Joined: Feb 2009
Reputation: 0
#3
RE: Error in Script file

Thank you Pandemoneus, that was an easy fix Smile
11-04-2010, 12:19 PM
Find




Users browsing this thread: 1 Guest(s)