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
What's wrong with this simple script.
JD Zombie Offline
Junior Member

Posts: 11
Threads: 3
Joined: Jun 2011
Reputation: 0
#1
What's wrong with this simple script.

I've just copied the sample script from the wiki and added something to it as per instructional video but when I try to run the game after this alteration I get
Quote:(15,1) unexpected token "{"
error.



////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "TestKey_1", "castle_arched_no_grav01_1", "KeyOnDoor", true);
    //Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
    if(ScriptDebugOn())
    {
        GiveItemFromFile("lantern", "lantern.ent");

        for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
    }
}
void KeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("castle_arched_no_grav01_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_arched_no_grav01_1", 0, false);
RemoveItem("TestKey_1");
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Dedicated to the butterfly.
(This post was last modified: 06-20-2011, 01:02 PM by JD Zombie.)
06-20-2011, 12:46 PM
Find
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#2
RE: What's wrong with this simple script.

void KeyOnDoor(string &in asItem, string &in asEntity);

Take off the ; at the end.

06-20-2011, 01:00 PM
Find
JD Zombie Offline
Junior Member

Posts: 11
Threads: 3
Joined: Jun 2011
Reputation: 0
#3
RE: What's wrong with this simple script.

Thank you. That got it working and yay my key unlocks its door, this monumental feat calls for cigars and bubbly.

Now I guess I missed the meaning of ; somewhere, if it's not a terribly complicated explanation why was that putting the brakes on things?

Dedicated to the butterfly.
06-20-2011, 01:05 PM
Find
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#4
RE: What's wrong with this simple script.

(06-20-2011, 01:05 PM)JD Zombie Wrote: Thank you. That got it working and yay my key unlocks its door, this monumental feat calls for cigars and bubbly.

Now I guess I missed the meaning of ; somewhere, if it's not a terribly complicated explanation why was that putting the brakes on things?

From my understanding semi-colons are used at the end of commands rather than functions. So it was treating it like a command, then seeing the open bracket after it made it cause the error.

06-20-2011, 01:08 PM
Find




Users browsing this thread: 1 Guest(s)