Frictional Games Forum (read-only)

Full Version: Help...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I mean just delete it
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"
////////////////////////////
// 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
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
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()
{

}
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 ','
Code:
UsedKeyOnDoor(string&in asItem, string &in as Entity)

to:

Code:
UsedKeyOnDoor(string&in asItem, string &in as Entity);
(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
////////////////////////////
// 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 '{'
(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
Pages: 1 2 3