[VERIFIED] onCreateDFN in global scripts borken?

Found a bug in UOX3? Or experienced a server crash? Perhaps you've noticed a broken feature? Post the details here!
Post Reply
Puck
UOX3 Novice
Posts: 72
Joined: Sat Jan 23, 2010 3:22 pm
Has thanked: 0
Been thanked: 0

onCreateDFN in global scripts borken?

Post by Puck »

using UOX3 0.98-4.0d
Issues first encountered with 4.011 client, now testing with 5.0.9.1

Like mentioned in this thread:
viewtopic.php?t=1842

I do this:
Xuri wrote:Another work-around:

Put the following in a .js file and set it up as a global script (by giving it script ID = 0 in jse_fileassociations.scp):

Code: Select all

function onCreateDFN( objMade, objType ) 
{ 
   if( objType == 0 ) 
      objMade.decayable = 0; 
} 

function onCreateTile( objMade, objType ) 
{ 
   if( objType == 0 ) 
      objMade.decayable = 0; 
}
This will set all new objects created to non-decayable. Not ideal, but at least the items should longer vanish on you. :/
All of a sudden spinning wheels wont stop spinning after they have been started.

removing the onCreateTile part and and restarting the server:
spinning wheels still wont spinning once started.

removing onCreateDFN part and restarting the server:
spinning wheels work correctly again.

therefor... well, you get the picture.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Verified, same thing happens here.
-= Ho Eyo He Hum =-
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Actually, the onCreateDFN/Tile-stuff seems to be doing what it's supposed to be doing, just has side-effects.

I found a work-around though. If you open JS/SKILLS/TAILORING/flaxtothread.js and look for the following:

Code: Select all

	if( pUser.CheckSkill( 34, 0, 1000 ) )
	{
        	pUser.UseResource( 1, iUsed.id ); 	// remove some flax
		pUser.SoundEffect( 0x021A, true );        
	        var itemMade = CreateDFNItem( pUser.socket, pUser, "0x0fA0", 6, "ITEM", true ); // makes spools of thread
		pUser.SysMessage( "You spin some spools of thread, and put them in your backpack." );
		[color=red]myTarget.id++;
		myTarget.StartTimer( 2000, 1, true );[/color]
	}
and replace it with the following:

Code: Select all

	if( pUser.CheckSkill( 34, 0, 1000 ) )
	{
		pUser.UseResource( 1, iUsed.id ); 	// remove some flax
		pUser.SoundEffect( 0x021A, true );        
		[color=red]myTarget.id++;
		myTarget.StartTimer( 2000, 1, true );[/color]
		var itemMade = CreateDFNItem( pUser.socket, pUser, "0x0fA0", 1, "ITEM", true ); // makes spools of thread
		pUser.SysMessage( "You spin some spools of thread, and put them in your backpack." );
	}
(cleaned up the tabs and moved the two highlighted lines)

The spinning wheel will stop breaking. For some reason, if you start the timer BEFORE spawning the new spools of thread (which will then make use of the global onCreateDFN script), everything works ok.
-= Ho Eyo He Hum =-
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

The above change is also necessary for
wthreadspools-6.js
and
wyarnballs-3.js
-= Ho Eyo He Hum =-
Post Reply