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
Scripting Problem
amnesiaplayer321 Offline
Junior Member

Posts: 31
Threads: 4
Joined: May 2013
Reputation: 0
#1
Scripting Problem

Hi.I am looking forward to create a new custom story for amnesia.But i have problems with my script.And i see nothing wrong.And when i launch my story,it gives that error:
FATAL ERROR: Could not load script file
'custom_stories/mystory/maps/lvl1.hps'!
main (17, 21): ERR :Unexpected end of file
My script file:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Key", "Mansion_door", "UsedKeyonDoor", true);
AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);

void UsedKeyonDoor(string &in asItem, string &in asEntity)

{
SetSwingDoorLocked("Mansion_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Mansion", 0, false);
SetSwingDoorLocked("Door2", false, true);
PlaySoundAtEntity("", "unlock_door", "Door2", 0, false);

RemoveItem("Key");
RemoveItem("Key2");

Whats wrong about it and how to i fix?
(This post was last modified: 05-21-2013, 01:08 PM by amnesiaplayer321.)
05-20-2013, 07:19 PM
Find
Bridge Offline
Posting Freak

Posts: 1,971
Threads: 25
Joined: May 2012
Reputation: 128
#2
RE: Scripting Problem

You have to use the } character to designate the end of your function declarations.

////////////////////////////

// Run first time starting map

void OnStart()

{

    AddUseItemCallback("", "Key", "Mansion_door", "UsedKeyonDoor", true);

    AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);

}


void UsedKeyonDoor(string &in asItem, string &in asEntity)

{

    SetSwingDoorLocked("Mansion_door", false, true);

    PlaySoundAtEntity("", "unlock_door", "Mansion", 0, false);

    SetSwingDoorLocked("Door2", false, true);

    PlaySoundAtEntity("", "unlock_door", "Door2", 0, false);



    RemoveItem("Key");

    RemoveItem("Key2");

}
05-20-2013, 07:31 PM
Find
amnesiaplayer321 Offline
Junior Member

Posts: 31
Threads: 4
Joined: May 2013
Reputation: 0
#3
RE: Scripting Problem

Thanks it did work but why is second door not locked?I did same thing on the first door's script.First door's locked but second is isn't.I downloaded beginneer set from youtube.
(This post was last modified: 05-20-2013, 07:41 PM by amnesiaplayer321.)
05-20-2013, 07:40 PM
Find
Bridge Offline
Posting Freak

Posts: 1,971
Threads: 25
Joined: May 2012
Reputation: 128
#4
RE: Scripting Problem

Are you certain the door is called "Door2"? The strings are probably case-sensitive.
(This post was last modified: 05-20-2013, 07:42 PM by Bridge.)
05-20-2013, 07:42 PM
Find
amnesiaplayer321 Offline
Junior Member

Posts: 31
Threads: 4
Joined: May 2013
Reputation: 0
#5
RE: Scripting Problem

I am sure its called Door2 in both name and PlayerInteractCallBack and locked is checked.
05-20-2013, 07:44 PM
Find
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#6
RE: Scripting Problem

Minor discrepancy in your callback function.


PHP Code: (Select All)
AddUseItemCallback("""Key""Mansion_door""UsedKeyonDoor"true);
AddUseItemCallback("""Key2""Door2""UsedKeyOnDoor"true);

//Two variations. UsedKeyOnDoor & UsedKeyonDoor

void UsedKeyonDoor(string &in asItemstring &in asEntity)

//It's "UsedKeyonDoor" here 

Try fixing that.
(This post was last modified: 05-20-2013, 07:59 PM by Tomato Cat.)
05-20-2013, 07:59 PM
Find
amnesiaplayer321 Offline
Junior Member

Posts: 31
Threads: 4
Joined: May 2013
Reputation: 0
#7
RE: Scripting Problem

Thanks again,key gones for nothing,because the door isn't still locked.I am searching a fix for this.Is there anyway to set Door2 locked on script?
05-20-2013, 08:06 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#8
RE: Scripting Problem

Derp. Ignore what I just said.
(This post was last modified: 05-20-2013, 10:10 PM by OriginalUsername.)
05-20-2013, 08:27 PM
Find
amnesiaplayer321 Offline
Junior Member

Posts: 31
Threads: 4
Joined: May 2013
Reputation: 0
#9
RE: Scripting Problem

Its even locked after i use the key.Why?
05-20-2013, 08:45 PM
Find
Bridge Offline
Posting Freak

Posts: 1,971
Threads: 25
Joined: May 2012
Reputation: 128
#10
RE: Scripting Problem

Did you see what Tomato Cat said? You're calling a function that doesn't exist.

AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);

Should be:

AddUseItemCallback("", "Key2", "Door2", "UsedKeyonDoor", true);
05-20-2013, 10:01 PM
Find




Users browsing this thread: 4 Guest(s)