A.I.
Member
Posts: 114
Threads: 16
Joined: Feb 2012
Reputation:
2
|
Key will now not work
EDIT: I am struggling 20 minutes later with the door not opening I have looked at the script and look at my code looked at just about all the lines of code on the wiki and I still can't figure out what is wrong
void OnStart()
{
AddUseItemCallback("", "corridorkey", "corridordoor", "KeyOnDoor", true);
}
void MyFunc(string &in asName, int alCount)
{
SetSwingDoorLocked("corridordoor", false, true);
PlaySoundAtEntity("", "unlock_door", "corridordoor", 0, false);
RemoveItem("corridorkey");
}
(This post was last modified: 02-15-2012, 06:35 AM by A.I..)
|
|
02-15-2012, 03:15 AM |
|
Obliviator27
Posting Freak
Posts: 792
Threads: 10
Joined: Jul 2011
Reputation:
66
|
RE: 'key' Not Declared
You need to put them in Quotation marks.
"corridordoor" and "corridorkey"
By not doing this, you tell the engine that they are variables, as opposed to the strings that they are.
|
|
02-15-2012, 03:21 AM |
|
A.I.
Member
Posts: 114
Threads: 16
Joined: Feb 2012
Reputation:
2
|
RE: 'key' Not Declared
Ohh thanks, it now works, this makes me feel a bit dumb......
(This post was last modified: 02-15-2012, 03:57 AM by A.I..)
|
|
02-15-2012, 03:25 AM |
|
Obliviator27
Posting Freak
Posts: 792
Threads: 10
Joined: Jul 2011
Reputation:
66
|
RE: 'key' Not Declared
(02-15-2012, 03:25 AM)Vaelwing22 Wrote: Ohh thanks, it now works, this makes me feel a bit dumb...... Don't worry about it. When I first started, I couldn't figure out for the life of me why me extra_english.lang file didn't work. Turns out I misspelled Entry. We all start somewhere.
|
|
02-15-2012, 03:35 AM |
|
A.I.
Member
Posts: 114
Threads: 16
Joined: Feb 2012
Reputation:
2
|
RE: 'key' Not Declared
(02-15-2012, 03:35 AM)Obliviator27 Wrote: (02-15-2012, 03:25 AM)Vaelwing22 Wrote: Ohh thanks, it now works, this makes me feel a bit dumb...... Don't worry about it. When I first started, I couldn't figure out for the life of me why me extra_english.lang file didn't work. Turns out I misspelled Entry. We all start somewhere. Lol
Bump?
(This post was last modified: 02-15-2012, 04:26 AM by A.I..)
|
|
02-15-2012, 03:39 AM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Key will now not work
If you are wondering why it is not working still, it's because you have the incorrect syntax, use this:
(string &in asItem, string &in asEntity)
|
|
02-15-2012, 05:40 AM |
|
A.I.
Member
Posts: 114
Threads: 16
Joined: Feb 2012
Reputation:
2
|
RE: Key will now not work
Still not working but I am not sure if it is void FUNCTION(string &in asItem, string &in asEntity) or void MyFunc(string &in asItem, string &in asEntity)?
|
|
02-15-2012, 06:26 AM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Key will now not work
void OnStart()
{
AddUseItemCallback("", "corridorkey", "corridordoor", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("corridordoor", false, true);
PlaySoundAtEntity("", "unlock_door", "corridordoor", 0, false);
RemoveItem("corridorkey");
}
You didn't name the functions properly and you didn't use the right syntax. Use the one above.
|
|
02-15-2012, 06:29 AM |
|
A.I.
Member
Posts: 114
Threads: 16
Joined: Feb 2012
Reputation:
2
|
RE: Key will now not work
OHH THANK YOU!!! THANK YOU THANK YOU!!! It works correctly so no more problems
|
|
02-15-2012, 06:35 AM |
|
|