The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic target when equipping weapons through dclick
Author Message
karma
Moderator
****

Posts: 178
Likes Given: 17
Likes Received: 32 in 29 posts
Joined: Jul 2012
Reputation: 3



Post: #1
Automatic target when equipping weapons through dclick
As Sphere's default behavior, when you equip a weapon by dclicking it, a target is called. Is there any way to prevent this?
It would be ideal if dclicking an unequipped weapon simply equips it, and then if you dclick the equipped weapon the target appears.
10-09-2014 06:51 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes karma's post
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #2
RE: Automatic target when equipping weapons through dclick
Check if you can equip it and use EQUIP then return 1 on @dclick

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
10-09-2014 06:56 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Extreme's post
karma
Moderator
****

Posts: 178
Likes Given: 17
Likes Received: 32 in 29 posts
Joined: Jul 2012
Reputation: 3



Post: #3
RE: Automatic target when equipping weapons through dclick
I have considered this solution, but i'm afraid to interfere with other events which manage @DClick. Do you say there won't be any problems?
10-09-2014 07:32 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes karma's post
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #4
RE: Automatic target when equipping weapons through dclick
you can softcode the dclick behavior creating a typedef to override the hardcoded typedef

the softcoded typedef will always run before the hardcoded typedef, so you can use return 1 to prevent the hardcoded action

Code:
[TYPEDEF t_weapon_axe]
ON=@DClick
return <DClickWeapon>

[TYPEDEF t_weapon_sword]
ON=@DClick
return <DClickWeapon>

[TYPEDEF t_weapon_fence]
ON=@DClick
return <DClickWeapon>

[TYPEDEF t_weapon_mace_pick]
ON=@DClick
return <DClickWeapon>

[TYPEDEF t_weapon_mace_smith]
ON=@DClick
return <DClickWeapon>

[TYPEDEF t_weapon_mace_crook]
ON=@DClick
return <DClickWeapon>

[TYPEDEF t_weapon_mace_sharp]
ON=@DClick
return <DClickWeapon>

[TYPEDEF t_weapon_mace_staff]
ON=@DClick
return <DClickWeapon>


[FUNCTION DClickWeapon]
IF (<CONT> == <SRC>)        //show target selection if the weapon is already equiped
  TARGET <DEFMSG.itemuse_weapon_promt>
ELIF (<TOPOBJ> != <SRC>)    //check TOPOBJ to prevent equip weapons locked on ground (houses) or steal weapons dclicking on another paperdoll
  SRC.SYSMESSAGE <DEFMSG.reach_fail>
ELSE
  EQUIP
ENDIF
return 1        //this will stop the hardcoded behavior for @DClick
(This post was last modified: 10-09-2014 08:51 AM by Coruja.)
10-09-2014 08:50 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Coruja's post
karma
Moderator
****

Posts: 178
Likes Given: 17
Likes Received: 32 in 29 posts
Joined: Jul 2012
Reputation: 3



Post: #5
RE: Automatic target when equipping weapons through dclick
That should work fine! I re-read the wiki, the order of firing for events/types is:
1) event
2) tevent
3) type
4) itemdef
So, if i RETURN 1 in the @DClick declared in the typedef, i will stop only the execution of the code under @DClick in the itemdef. Not too bad, but i have to remember that Big Grin
Thanks to both of you!
10-09-2014 09:10 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #6
RE: Automatic target when equipping weapons through dclick
it's your lucky day, XuN added a new OF_NODClickTarget .ini setting that will do it automatically

Quote:XuN r2051 10.10.14

Added OF_NODClickTarget to ini, enabling this will not make the cursor appear as a target when double clicking weapons to equip them.

it works on all t_weapon_* except weapons that can get resources from trees (t_weapon_mace_sharp, t_weapon_sword, t_weapon_fence, t_weapon_axe)
I don't know if this exclusion is planned or if XuN forgot to change the code on these typedefs lol
10-11-2014 04:51 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Coruja's post
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #7
RE: Automatic target when equipping weapons through dclick
Its working in these types too, notice that there's no break, continue or return above these ones so they are being grouped together with t_weapon_mace_staff and t_weapon_mace_smith.

EDIT: Otherwise Ben would've commited to fix it! Big Grin
(This post was last modified: 10-11-2014 06:16 PM by XuN.)
10-11-2014 05:49 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 4 users Like XuN's post
karma
Moderator
****

Posts: 178
Likes Given: 17
Likes Received: 32 in 29 posts
Joined: Jul 2012
Reputation: 3



Post: #8
RE: Automatic target when equipping weapons through dclick
(10-11-2014 04:51 PM)Coruja Wrote:  it's your lucky day, XuN added a new OF_NODClickTarget .ini setting that will do it automatically

Quote:XuN r2051 10.10.14

Added OF_NODClickTarget to ini, enabling this will not make the cursor appear as a target when double clicking weapons to equip them.

it works on all t_weapon_* except weapons that can get resources from trees (t_weapon_mace_sharp, t_weapon_sword, t_weapon_fence, t_weapon_axe)
I don't know if this exclusion is planned or if XuN forgot to change the code on these typedefs lol

I know, thanks Coruja Big Grin
(This also fixes a bug in the EC with equipping items from ground not disappearing from ground, what a lovely guy is XuN LOL)
10-12-2014 09:22 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #9
RE: Automatic target when equipping weapons through dclick
roflmao I didn't saw this line Tongue

but just a note, spells anim got broken on latest build, it's playing the non-mounted anim on mounted chars (classic client 5.x.x). Only spells seems to have this issue, weapons anim are working fine
10-13-2014 04:12 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Coruja's post
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #10
RE: Automatic target when equipping weapons through dclick
I'll take a look, I have to commit some more code anyways.
10-13-2014 10:23 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)