Frictional Games Forum (read-only)
[SCRIPT] Help... - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Help... (/thread-21042.html)

Pages: 1 2 3


RE: Help... - NaxEla - 04-04-2013

I mean just delete it


RE: Help... - Yare - 04-04-2013

Every action you include within OnStart() or OnEnter() comes without "void". It means you need to write just:
Code:
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);

instead of:
Code:
void AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor"



RE: Help... - Darkboot - 04-04-2013

////////////////////////////
// Run first time starting map

void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
}


UsedKeyOnDoor(string&in asItem, string &in as Entity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}



Getting insane haha, this is right?

now i get this error.. :
Expected Identifier


RE: Help... - NaxEla - 04-04-2013

Well, you took out the right void, but you also took out another void that you needed. Add void in front of this line:
Code:
UsedKeyOnDoor(string&in asItem, string &in as Entity)
so it looks like this:
Code:
void UsedKeyOnDoor(string &in asItem, string &in asEntity)

Edit: fixed code. It's not very easy to write code on my phone :p


RE: Help... - Yare - 04-04-2013

Now you unnecessarly removed "void" from the place it should be Tongue

I will try to explain:
Code:
void OnStart()
{
Everything inside this goes without "void".
}

Outside "OnStart" every function name must be preceded with "void"

So your script should be like this:

Code:
void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
}


void UsedKeyOnDoor(string&in asItem, string &in as Entity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}



RE: Help... - Darkboot - 04-04-2013

Im doing something wrong now? O.o

////////////////////////////
// Run first time starting map

void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
}



void UsedKeyOnDoor(string&in asItem, string &in as Entity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}

Question: Why cant i put i in in the same as the other? in this {}
so it looks like this.

////////////////////////////
// Run first time starting map

void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
UsedKeyOnDoor(string&in asItem, string &in as Entity)
}


{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}

PS: I Asume that somethings wrong cause i cant open the custom story yet, i still get

Expected '(' or ','


RE: Help... - OriginalUsername - 04-04-2013

Code:
UsedKeyOnDoor(string&in asItem, string &in as Entity)

to:

Code:
UsedKeyOnDoor(string&in asItem, string &in as Entity);



RE: Help... - Slanderous - 04-04-2013

(04-04-2013, 07:37 PM)Darkboot Wrote:
(04-04-2013, 07:22 PM)NaxEla Wrote: You need to take out the void before AddUseItemCallback.

Edit: you also need to write
Code:
(string &in asItem, string &in asEntity)
after void UsedKeyOnDoor.

How do you mean with " take out the void"?

AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
}


void UsedKeyOnDoor
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}

The error appears because of "void" before adduseitemcallback. It should work now Big Grin


RE: Help... - Darkboot - 04-05-2013

////////////////////////////
// Run first time starting map

void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string&in asItem, string &in as Entity);

{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}
------------------------------------------------------------------------------------------------------------------------------------
My script right now.

If i deleted the " Void " of "adduseitemcallback" i got another error and the others 2 in the beginning of this page said that the " void " should fix the prolem when i had it.

ERROR:
unexpected token '{'


RE: Help... - OriginalUsername - 04-05-2013

(04-05-2013, 10:44 AM)Darkboot Wrote: ////////////////////////////
// Run first time starting map

void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string&in asItem, string &in as Entity);

{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}
------------------------------------------------------------------------------------------------------------------------------------
My script right now.

If i deleted the " Void " of "adduseitemcallback" i got another error and the others 2 in the beginning of this page said that the " void " should fix the prolem when i had it.

ERROR:
unexpected token '{'

You don't need an ';' after UsedKeyOnDoor(string&in asItem, string &in as Entity). That's only for inside the functions