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
Callback help?
WatzUpzPeepz Offline
Member

Posts: 106
Threads: 12
Joined: May 2011
Reputation: 0
#1
Callback help?

How exactly would I go about doing this?
When I interact with a locked door a message appears?
My current code doesnt work.
I just get:Unexpected end of file error report?
This is what I have:

"void InteractOfficeDoor (string &in asEntity)
{
}
if(GetSwingDoorLocked("OfficeDoor")== true)
{
SetMessage("Map4", "OfficeDoorMessage", 5.0f);
}"
which is at the end of the script

I have this at the voidOnStart

"SetEntityPlayerInteractCallback("OfficeDoor", "InteractOfficeDoor", true);"

The error is comming from the } at the end of file,If that helps!

(This post was last modified: 05-13-2011, 09:08 PM by WatzUpzPeepz.)
05-13-2011, 08:57 PM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#2
RE: Callback help?

You never closed your InteractStudyDoor function. Add another "}" after the if statement and you should be set.

05-13-2011, 08:59 PM
Find
WatzUpzPeepz Offline
Member

Posts: 106
Threads: 12
Joined: May 2011
Reputation: 0
#3
RE: Callback help?

(05-13-2011, 08:59 PM)Anxt Wrote: You never closed your InteractStudyDoor function. Add another "}" after the if statement and you should be set.

I made the change(as now shown above) but I still get the same thingSad
I have no idea of scripting what so ever, so I wouldn't even see the most obvious mistake.

05-13-2011, 09:10 PM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#4
RE: Callback help?

Did you make sure you closed your OnStart function as well? Unexpected end of file almost always, if not always, means you are missing a bracket. Check every function for an opening and a close.

05-13-2011, 09:11 PM
Find
Karai16 Offline
Member

Posts: 164
Threads: 24
Joined: Apr 2011
Reputation: 0
#5
RE: Callback help?

Try putting this in your file, instead of what you have
void InteractOfficeDoor (string &in asEntity)
{
if(GetSwingDoorLocked("OfficeDoor")== true)
{
  SetMessage("Map4", "OfficeDoorMessage", 5.0f);
}
}

Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
05-13-2011, 09:16 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#6
RE: Callback help?

(05-13-2011, 09:11 PM)Anxt Wrote: Did you make sure you closed your OnStart function as well? Unexpected end of file almost always, if not always, means you are missing a bracket. Check every function for an opening and a close.

It is also possible that you have a left-over quotation mark around for example a bool. i.e AddDebugMessage("Message", false");

That would produce the same result.
(This post was last modified: 05-13-2011, 09:21 PM by Roenlond.)
05-13-2011, 09:20 PM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#7
RE: Callback help?

Oh, thank you Karai. I didn't even notice that his if statement wasn't in the function anymore.

Listen to her, Watz Smile

05-13-2011, 09:20 PM
Find
WatzUpzPeepz Offline
Member

Posts: 106
Threads: 12
Joined: May 2011
Reputation: 0
#8
RE: Callback help?

Thanks man but Its not helping,Ill be fine without itUndecided

05-13-2011, 09:21 PM
Find
Karai16 Offline
Member

Posts: 164
Threads: 24
Joined: Apr 2011
Reputation: 0
#9
RE: Callback help?

(05-13-2011, 09:21 PM)WatzUpzPeepz Wrote: Thanks man but Its not helping,Ill be fine without itUndecided

Can you put up your entire code please? I have a great eye for detail, maybe I can see what's wrong

Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
05-13-2011, 09:38 PM
Find
WatzUpzPeepz Offline
Member

Posts: 106
Threads: 12
Joined: May 2011
Reputation: 0
#10
RE: Callback help?

Yea here ya go:
void OnStart()
{
AddUseItemCallback("", "crowbar_1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "key1", "door3", "KeyOnClosetDoor", true);
AddEntityCollideCallback("Player", "DoorSlamArea", "CollideDoorSlam", true, 1);
SetEntityPlayerInteractCallback("OfficeDoor", "InteractOfficeDoor", true);"
}

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


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

void CollideDoorSlam(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("door3", 10, 50, "");
AddTimer("", 0.5f, "TimerSlamDoor");
SetEntityActive("ParticleSystem_1" , true);
}
void TimerSlamDoor(string &in asTimer)
{
SetSwingDoorLocked("door2", true, true);
SetSwingDoorClosed("door3", true, true);
GiveSanityDamage(4.0f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
AddTimer("", 2.0f, "TimerStopLook");
SetEntityActive("armour2", true);
SetEntityActive("armour1", false);
}

void TimerStopLook(string &in asTimer)
{
StopPlayerLookAt();
}

void InteractOfficeDoor (string &in asEntity)
{
if(GetSwingDoorLocked("OfficeDoor")== true)
{
SetMessage("Map4", "OfficeDoorMessage", 5.0f);
{
}

05-13-2011, 09:59 PM
Find




Users browsing this thread: 1 Guest(s)