Dblclickself

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am

Dblclickself

Post by xeon »

I found a weird thing about dblclickself.src. It's called only when a player is mounting an animal. If the player is afoot, it's not called.
Anyone experienced the same thing?
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am

Re: Dblclickself

Post by xeon »

Anyone? :(
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Re: Dblclickself

Post by *Edwards »

This is the code I use and there is no problems..

Code: Select all

use uo;
use os;
use npc;

include "include/client";
include ":mounts:mounts";

program core_dblClickSelf( who )

	var mount := GetEquipmentByLayer( who, LAYER_MOUNT );
	if( mount && !who.warmode && !who.paralyzed && !who.frozen )
		return MP_Unmount( who );
	endif
	
	return OpenPaperdoll( who, who );
endprogram
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am

Re: Dblclickself

Post by xeon »

Thank you for your answer Edwards. The problem is that the script isn't simply called if player is afoot. I checked this with a simple

Code: Select all

program dblClickSelf(who)
print("called");
endprogram

If player is on an horse, it's correctly called. I don't understand why.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: Dblclickself

Post by CWO »

OK I've tested this and confirmed that the script doesn't run when you're not mounted. I've looked into the POL source code to find out where this problem lies and what I've discovered is that this is actually a lot to do with the client.

When you double click something, it sends a packet with the serial number of what is double clicked.
When you are mounted and double click yourself, it does what I mentioned above just fine.
When you are dismounted and double click yourself, it sends your serial number + 0x80000000.
Now POL knows about this and it will send your paperdoll but skip running the script. Why? Because if you use the "Open Paperdoll" button on the menu or use the macro hotkeys, it sends the double click with your serial number + 0x80000000 whether you're mounted or not. So the reason it doesn't run while dismounted is because the client tells POL the exact same thing when you use the "Open Paperdoll" macro and double clicking yourself while dismounted.
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am

Re: Dblclickself

Post by xeon »

Aaaah, now I've understood, thank you CWO!
I was trying to do a workaround for a bug of the client version which we use (AoS) when player account is set to "UOExpansion AoS". In this situation, when the player open it's paperdoll, our client show the player as in war status, even if player is in peace. This is obviously a client bug. I've almost fixed it, but after these information, I think I'll do a packet hook for the "Display paperdoll" packet.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: Dblclickself

Post by CWO »

Just be very careful with this one because this handles double clicking of everything too...
Post Reply