Problem with the JS version of resurrect command

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
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:

Problem with the JS version of resurrect command

Post by Xuri »

Code: Select all

function command_RESURRECT( socket, cmdString )
{
	var targMsg = GetDictionaryEntry( 194, socket.Language );
	socket.CustomTarget( 1, targMsg );
}

function onCallback1( socket, ourObj )
{
	if( ourObj.isChar )
		ourObj.Resurrect();
}
When trying to use it on a character, I get this in console:
| ERROR: JS script failure: Message (TypeError: ourObj has no properties), detai
led data is
| ERROR: Filename: d:/uox3/js/commands/targeting/kill.js
Line Number: 61
| ERROR: Erroneous Line: (null)
Token Ptr: (null)
-= 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 »

Hm apparently only happens when the dead GM ghost tries to resurrect himself. Targeting another player character seems to work fine.
-= 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 »

Is line 61 the isChar check or the Resurrect() call ?
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 »

The isChar line. But it doesn't matter, because I tried commenting it out, and whee - UOX3 then crashed out on the Resurrect() call =)
-= 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 »

More info on the bug. After closing the client and logging back in with my dead GM character, the resurrect command works. So there's apparently something that happens when my character dies which stops UOX3 from seeing the character as a valid target or something.

BTW, I added PACK as a shortcut for KILLing layer 0x15.
-= 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 »

Xuri wrote:BTW, I added PACK as a shortcut for KILLing layer 0x15.
And that is what I love about JS ;)

Well, basically that means that something is fudgy with it automatically calculating the serial sent as the target from the client. I'll have to look into it and see what is causing the issue.
Scott
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

As for the crash when you try to run Resurrect() with a bad character... I suppose I should start making use of JSEncapsulate in the JSMethods...

*sigh* ahh well, more work ;)
Scott
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Well... I added a check to prevent that crash if you pass a bad character.

Still need to look into why it was passing you a bad object to begin with.
Scott
Post Reply