Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 2 Votes - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in Script file
Author Message
jockelix Offline
Junior Member

Posts: 6
Joined: Feb 2009
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
jockelix Offline
Junior Member

Posts: 6
Joined: Feb 2009
Reputation: 0
Post: #3
RE: Error in Script file
Thank you Pandemoneus, that was an easy fix Smile
11-04-2010 12:19 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)