Adrianis 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 620 
	Threads: 6 
	Joined: Feb 2012
	
 Reputation: 
27
		
	 | 
	
		
			
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.
 void OnStart() {     AddUseItemCallback("", "StrangeDoorKey", "StrangeDoor", "UnlockStrangeDoor", false);    SetEntityCallbackFunc("GuestRoomKey", "ActiveEntity");    AddUseItemCallback("", "GuestRoomKey", "door01", "UnlockDoor", false); }      
  void UnlockDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door01", false, true); PlaySoundAtEntity("", "Unlock_door", "door01", 0, false); RemoveItem("GuestRoomKey"); }
 
  void ActiveEntity(string &in asEntity, string &in type) { SetEntityActive("corpse01", true); PlaySoundAtEntity("", "12_girl_scream.snt", "corpse01", 0, false); StartScreenShake(0.5f, 2, 0, 0.25); }
 
  void UnlockStrangeDoor(string &in asItem, string &in asEntity)
  { SetSwingDoorLocked("StrangeDoor", false, true); PlaySoundAtEntity("", "unlock_door", "StrangeDoor", 0, false); 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  | 
	
		
	 | 
 
 
	
		
		No Author 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 962 
	Threads: 10 
	Joined: Jun 2012
	
 Reputation: 
13
		
	 | 
	
		
			
RE: Script Problems 
			 
			
				This thread is the longest script error thread.
			 
			
			
 
			
		 |  
	 
 | 
 
	| 03-12-2013, 01:13 PM  | 
	
		
	 | 
 
 
	
		
		Adrianis 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 620 
	Threads: 6 
	Joined: Feb 2012
	
 Reputation: 
27
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	
		
		Coolfromdah00d 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 38 
	Threads: 5 
	Joined: Mar 2013
	
 Reputation: 
0
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	
		
		PutraenusAlivius 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 4,713 
	Threads: 75 
	Joined: Dec 2012
	
 Reputation: 
119
		
	 | 
	
		
			
RE: Script Problems 
			 
			
				Try removing the  
It may work.
			  
			
			
 
"Veni, vidi, vici." 
"I came, I saw, I conquered." 
			
		 |  
	 
 | 
 
	| 03-13-2013, 08:08 AM  | 
	
		
	 | 
 
 
	
		
		Adrianis 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 620 
	Threads: 6 
	Joined: Feb 2012
	
 Reputation: 
27
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	
		
		PutraenusAlivius 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 4,713 
	Threads: 75 
	Joined: Dec 2012
	
 Reputation: 
119
		
	 | 
	
		
			
RE: Script Problems 
			 
			
				void OnStart() {     AddUseItemCallback("", "StrangeDoorKey", "StrangeDoor", "UnlockStrangeDoor", false);    SetEntityCallbackFunc("GuestRoomKey", "ActiveEntity");    AddUseItemCallback("", "GuestRoomKey", "door01", "UnlockDoor", false); }      
  void UnlockDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door01", false, true); PlaySoundAtEntity("", "unlock_door.snt", "door01", 0, false); RemoveItem("GuestRoomKey"); }
 
  void ActiveEntity(string &in asEntity, string &in type) { SetEntityActive("corpse01", true); PlaySoundAtEntity("", "12_girl_scream.snt", "corpse01", 0, false); StartScreenShake(0.5f, 2, 0, 0.25); }
 
  void UnlockStrangeDoor(string &in asItem, string &in asEntity)
  { SetSwingDoorLocked("StrangeDoor", false, true); PlaySoundAtEntity("", "unlock_door.snt", "StrangeDoor", 0, false); 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;
 void SetEntityCallbackFunc(string& asName, string& asCallback); 
 
 Since   was the internal name and   is stated as the callback.
			  
			
			
 
"Veni, vidi, vici." 
"I came, I saw, I conquered." 
			
		 |  
	 
 | 
 
	| 03-13-2013, 03:34 PM  | 
	
		
	 | 
 
 
	
		
		Coolfromdah00d 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 38 
	Threads: 5 
	Joined: Mar 2013
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Script Problems 
			 
			
				 (03-13-2013, 03:34 PM)JustAnotherPlayer Wrote:  void OnStart() {     AddUseItemCallback("", "StrangeDoorKey", "StrangeDoor", "UnlockStrangeDoor", false);    SetEntityCallbackFunc("GuestRoomKey", "ActiveEntity");    AddUseItemCallback("", "GuestRoomKey", "door01", "UnlockDoor", false); }      
  void UnlockDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door01", false, true); PlaySoundAtEntity("", "unlock_door.snt", "door01", 0, false); RemoveItem("GuestRoomKey"); }
 
  void ActiveEntity(string &in asEntity, string &in type) { SetEntityActive("corpse01", true); PlaySoundAtEntity("", "12_girl_scream.snt", "corpse01", 0, false); StartScreenShake(0.5f, 2, 0, 0.25); }
 
  void UnlockStrangeDoor(string &in asItem, string &in asEntity)
  { SetSwingDoorLocked("StrangeDoor", false, true); PlaySoundAtEntity("", "unlock_door.snt", "StrangeDoor", 0, false); 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; 
void SetEntityCallbackFunc(string& asName, string& asCallback); 
 
  Since  was the internal name and  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  | 
	
		
	 | 
 
 
	
		
		Adrianis 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 620 
	Threads: 6 
	Joined: Feb 2012
	
 Reputation: 
27
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	
		
		Coolfromdah00d 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 38 
	Threads: 5 
	Joined: Mar 2013
	
 Reputation: 
0
		
	 | 
	
		
			
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  | 
	
		
	 | 
 
 
	 
 |