[FIXED] Issues with UOX3's targeting handling

Here we stuff all the bugs we've managed to squash/squish/squelch.
Locked
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:

Issues with UOX3's targeting handling

Post by Xuri »

There are most definitely some issues with how UOX3 handles targeting stuff using the target cursor in UO. I've repeatedly noticed that sometimes the effects I want to give a specific targeted object, are instead performed on my own character.

Basically it seems that every now and then UOX3 doesn't read what you target correctly, and somehow defaults it to your own character instead.

This was most easily visible when I used the 'RREMOVE command I have written earlier (after modifying it to accept characters as well as items) to remove multiple NPCs, and my own character was deleted (while I was online!) instead of the targeted NPC character. I had no checks in the command for if the target was my own character, but still - I targeted another character, not my own.

The modified command, goes in UOX3\JS\COMMANDS\CUSTOM\repeatingcmds.js:

Code: Select all

//Repeated Command: REMOVE
function command_RREMOVE( pSock, execString )
{
	pUser = pSock.currentChar;
	pUser.CustomTarget( 7, "Which object do you wish to remove?" );
}
function onCallback7( pSock, myTarget )
{
	var pUser = pSock.currentChar; 
	if( !pSock.GetWord( 1 ))
			myTarget.Delete();
	else
		pUser.SysMessage( "That's not an object you can remove!" );
	pUser.CustomTarget( 7, "Which object do you wish to remove?" );
}
The error seems to be happening mostly when the targeted object is a character, from my testing.
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

I believe I have found and fixed this issue.

It should have only been happening to a player with serial number 0. I've modified the handling so when it should be invalid the serial number will be changed to 0xFFFFFFFF instead of 0 (as 0 could be a valid character).
Scott
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 »

Great :D I believe the bug was indeed happening with the first character on my admin account in a world without prespawned NPCs, so it would have had serial 0x00 :)
-= Ho Eyo He Hum =-
Locked