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
Script Problems
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#61
RE: Script Problems

(03-10-2013, 12:52 PM)JustAnotherPlayer Wrote: When i was seeing the script functions on the Script Functions thread, what does internal name mean?

Off-topic first - unfortunately as far as I can tell, the usage of 'internal name' changes.
Sometimes it's the name for the callback/connection you have made, for example in AddUseItemCallback, internal name refers to the name of the callback you have made, so that you can use RemoveCallback with that name to remove it.
But then there are several examples, such as SetEntityPlayerInteractCallback, where internal name refers to the name of the entity.
It's a little inconsistent.

PHP Code: (Select All)
void OnStart()

   
AddUseItemCallback("""StrangeDoorKey""StrangeDoor""UnlockStrangeDoor"false);
   
SetEntityCallbackFunc("GuestRoomKey""ActiveEntity");
   
AddUseItemCallback("""GuestRoomKey""door01""UnlockDoor"false);
}
     

void UnlockDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("door01"falsetrue);
PlaySoundAtEntity("""Unlock_door""door01"0false);
RemoveItem("GuestRoomKey");
}


void ActiveEntity(string &in asEntitystring &in type)
{
SetEntityActive("corpse01"true);
PlaySoundAtEntity("""12_girl_scream.snt""corpse01"0false);
StartScreenShake(0.5f200.25);
}


void UnlockStrangeDoor(string &in asItemstring &in asEntity)

{
SetSwingDoorLocked("StrangeDoor"falsetrue);
PlaySoundAtEntity("""unlock_door""StrangeDoor"0false);
RemoveItem("StrangeDoorKey");


Just a note, PlaySoundAtEntity function, the sound name requires the .snt extension
PlaySoundAtEntity("", "Unlock_door.snt", "door01", 0, false);
Also, UnlockDoor func uses uppercase Unlock_door for the sound name, wheras UnlockStrangeDoor uses lowercase unlock_door, one of those is wrong.


On the actual problem of the 'cannot use item this way' message, try giving the AddUseItemCallback an internal name (the first parameter), something like "callback1" & "callback2" just to test if that's the issue, and double check the names of the keys in the inventory & the doors

03-12-2013, 01:03 PM
Find
No Author Offline
Posting Freak

Posts: 962
Threads: 10
Joined: Jun 2012
Reputation: 13
#62
RE: Script Problems

This thread is the longest script error thread.

[Image: the-cabin-in-the-woods-masked-people.jpg]
03-12-2013, 01:13 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#63
RE: Script Problems

I had one go 8 pages before iirc, that one basically came down to me begging the guy not to give up on it xD

Hopefully this won't end the same way!

03-12-2013, 01:45 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#64
RE: Script Problems

(03-12-2013, 01:45 PM)Adrianis Wrote: I had one go 8 pages before iirc, that one basically came down to me begging the guy not to give up on it xD

Hopefully this won't end the same way!

I'll test the new scriptings you've fixed. if it desent work I don't knw what to do

(03-13-2013, 07:32 AM)Coolfromdah00d Wrote:
(03-12-2013, 01:45 PM)Adrianis Wrote: I had one go 8 pages before iirc, that one basically came down to me begging the guy not to give up on it xD

Hopefully this won't end the same way!

I'll test the new scriptings you've fixed. if it desent work I don't knw what to do

First I got the "no matching signatures to AddUseItemCallback1" error so i tried to change the void function instead but I got the cannot use this item thi way error anyway. I dont understand, it works with the first door but not with the second one.
(This post was last modified: 03-13-2013, 07:44 AM by Coolfromdah00d.)
03-13-2013, 07:32 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#65
RE: Script Problems

Try removing the
PHP Code: (Select All)
SetEntityCallbackFunc 
It may work.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-13-2013, 08:08 AM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#66
RE: Script Problems

(03-13-2013, 07:32 AM)Coolfromdah00d Wrote: I'll test the new scriptings you've fixed. if it desent work I don't knw what to do

Sorry if you misunderstood, but I didn't fix anything, the code I posted was yours un-edited

Can you post your most recent script up?

03-13-2013, 12:56 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#67
RE: Script Problems

PHP Code: (Select All)
void OnStart()

   
AddUseItemCallback("""StrangeDoorKey""StrangeDoor""UnlockStrangeDoor"false);
   
SetEntityCallbackFunc("GuestRoomKey""ActiveEntity");
   
AddUseItemCallback("""GuestRoomKey""door01""UnlockDoor"false);
}
     

void UnlockDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("door01"falsetrue);
PlaySoundAtEntity("""unlock_door.snt""door01"0false);
RemoveItem("GuestRoomKey");
}


void ActiveEntity(string &in asEntitystring &in type)
{
SetEntityActive("corpse01"true);
PlaySoundAtEntity("""12_girl_scream.snt""corpse01"0false);
StartScreenShake(0.5f200.25);
}


void UnlockStrangeDoor(string &in asItemstring &in asEntity)

{
SetSwingDoorLocked("StrangeDoor"falsetrue);
PlaySoundAtEntity("""unlock_door.snt""StrangeDoor"0false);
RemoveItem("StrangeDoorKey");

I don't know what is wrong. There is nothing wrong with it. The SetEntityCallbackFunc was correct. Taken from the script functions page;
PHP Code: (Select All)
void SetEntityCallbackFunc(stringasNamestringasCallback); 
Since
PHP Code: (Select All)
string asName 
was the internal name and
PHP Code: (Select All)
stringasCallback 
is stated as the callback.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-13-2013, 03:34 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#68
RE: Script Problems

(03-13-2013, 03:34 PM)JustAnotherPlayer Wrote:
PHP Code: (Select All)
void OnStart()

   
AddUseItemCallback("""StrangeDoorKey""StrangeDoor""UnlockStrangeDoor"false);
   
SetEntityCallbackFunc("GuestRoomKey""ActiveEntity");
   
AddUseItemCallback("""GuestRoomKey""door01""UnlockDoor"false);
}
     

void UnlockDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("door01"falsetrue);
PlaySoundAtEntity("""unlock_door.snt""door01"0false);
RemoveItem("GuestRoomKey");
}


void ActiveEntity(string &in asEntitystring &in type)
{
SetEntityActive("corpse01"true);
PlaySoundAtEntity("""12_girl_scream.snt""corpse01"0false);
StartScreenShake(0.5f200.25);
}


void UnlockStrangeDoor(string &in asItemstring &in asEntity)

{
SetSwingDoorLocked("StrangeDoor"falsetrue);
PlaySoundAtEntity("""unlock_door.snt""StrangeDoor"0false);
RemoveItem("StrangeDoorKey");

I don't know what is wrong. There is nothing wrong with it. The SetEntityCallbackFunc was correct. Taken from the script functions page;
PHP Code: (Select All)
void SetEntityCallbackFunc(stringasNamestringasCallback); 
Since
PHP Code: (Select All)
string asName 
was the internal name and
PHP Code: (Select All)
stringasCallback 
is stated as the callback.
Here's the most recent scriptings I've made

void OnStart ()
{
AddUseItemCallback("", "StrangeDoorKey", "door03", "UsedKeyOnDoor", false);
SetEntityCallbackFunc("GuestRoomKey", "jump");
AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", false);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "12_girl_scream.snt", "corpse01", 0, false);
StartScreenShake(0.5f, 2, 0, 0.25);
GiveSanityDamage(5.0f, true);
}



void UsedKeyOnDoor(string &in asItem, string &in asEntity)

{
SetSwingDoorLocked("door03", false, true);
PlaySoundAtEntity("", "Unlock_door", "door03", 0, false);
RemoveItem("StrangeDoorKey");
}
03-13-2013, 04:24 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#69
RE: Script Problems

EDIT: Wait, you've got 2 functions called UsedKeyOnDoor. Name one of those different, because as it is that won't work

(This post was last modified: 03-13-2013, 05:16 PM by Adrianis.)
03-13-2013, 05:14 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#70
RE: Script Problems

(03-13-2013, 05:14 PM)Adrianis Wrote: EDIT: Wait, you've got 2 functions called UsedKeyOnDoor. Name one of those different, because as it is that won't work

I've tried to name it something else but then it cant find the function (or cant read it) any idea what I can name it to?
03-13-2013, 05:26 PM
Find




Users browsing this thread: 4 Guest(s)