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
Key will now not work
A.I. Offline
Member

Posts: 114
Threads: 16
Joined: Feb 2012
Reputation: 2
#1
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
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#2
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
Find
A.I. Offline
Member

Posts: 114
Threads: 16
Joined: Feb 2012
Reputation: 2
#3
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
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#4
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. Smile



02-15-2012, 03:35 AM
Find
A.I. Offline
Member

Posts: 114
Threads: 16
Joined: Feb 2012
Reputation: 2
#5
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. Smile
Lol
Bump?
(This post was last modified: 02-15-2012, 04:26 AM by A.I..)
02-15-2012, 03:39 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#6
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
Find
A.I. Offline
Member

Posts: 114
Threads: 16
Joined: Feb 2012
Reputation: 2
#7
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
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#8
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
Find
A.I. Offline
Member

Posts: 114
Threads: 16
Joined: Feb 2012
Reputation: 2
#9
RE: Key will now not work

OHH THANK YOU!!! THANK YOU THANK YOU!!! It works correctly so no more problems Smile
02-15-2012, 06:35 AM
Find




Users browsing this thread: 2 Guest(s)