NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
RE: Help...
I mean just delete it
|
|
04-04-2013, 07:43 PM |
|
Yare
Junior Member
Posts: 22
Threads: 2
Joined: Mar 2013
Reputation:
0
|
RE: Help...
Every action you include within OnStart() or OnEnter() comes without "void". It means you need to write just:
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
instead of:
void AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor"
|
|
04-04-2013, 07:44 PM |
|
Darkboot
Junior Member
Posts: 31
Threads: 8
Joined: Jun 2012
Reputation:
0
|
RE: Help...
////////////////////////////
// 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
(This post was last modified: 04-04-2013, 08:00 PM by Darkboot.)
|
|
04-04-2013, 07:59 PM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
RE: Help...
Well, you took out the right void, but you also took out another void that you needed. Add void in front of this line: UsedKeyOnDoor(string&in asItem, string &in as Entity)
so it looks like this: void UsedKeyOnDoor(string &in asItem, string &in asEntity)
Edit: fixed code. It's not very easy to write code on my phone :p
(This post was last modified: 04-04-2013, 09:36 PM by NaxEla.)
|
|
04-04-2013, 08:47 PM |
|
Yare
Junior Member
Posts: 22
Threads: 2
Joined: Mar 2013
Reputation:
0
|
RE: Help...
Now you unnecessarly removed "void" from the place it should be
I will try to explain:
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:
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()
{
}
|
|
04-04-2013, 08:48 PM |
|
Darkboot
Junior Member
Posts: 31
Threads: 8
Joined: Jun 2012
Reputation:
0
|
RE: Help...
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 ','
(This post was last modified: 04-04-2013, 09:09 PM by Darkboot.)
|
|
04-04-2013, 09:06 PM |
|
OriginalUsername
Posting Freak
Posts: 896
Threads: 42
Joined: Feb 2013
Reputation:
34
|
RE: Help...
UsedKeyOnDoor(string&in asItem, string &in as Entity)
to:
UsedKeyOnDoor(string&in asItem, string &in as Entity);
|
|
04-04-2013, 09:30 PM |
|
Slanderous
Posting Freak
Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation:
63
|
RE: Help...
(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 (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
|
|
04-04-2013, 09:30 PM |
|
Darkboot
Junior Member
Posts: 31
Threads: 8
Joined: Jun 2012
Reputation:
0
|
RE: Help...
////////////////////////////
// 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 '{'
(This post was last modified: 04-05-2013, 11:53 AM by Darkboot.)
|
|
04-05-2013, 10:44 AM |
|
OriginalUsername
Posting Freak
Posts: 896
Threads: 42
Joined: Feb 2013
Reputation:
34
|
RE: Help...
(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
|
|
04-05-2013, 12:18 PM |
|
|