SphereServer BugTracker - SphereServer
View Issue Details
0001978SphereServerexecutable - windows buildpublic17-06-11 06:2303-05-14 20:48
xantier 
 
normalminoralways
newreopened 
 
 
Automated (specify build number)
None
None
0001978: @spellselect triggered twice?
I'm trying to do some checks on @select -the only way to stop magery without fizzle- but even a "return 1" doesn't prevent it to be called twice..

this is the code :

on=@spellselect
if (<findlayer.1.uid>) || (<findlayer.2.uid>)
if !((<findlayer.2.type>==t_wand) || (<findlayer.1.type>==t_wand) || (<findlayer.1.baseid>==i_spellbook)) || (<findlayer(2).uid>)
src.message @022 Your hands must be free to cast spells.
argn3=2
return 1
endif
endif


and when i try to cast spell with a weapon, it prevents casting successfully but i get "Your hands must be free to cast spells." message twice.. i tried to check it with argn3, but starting and finishing flags are same (03) and both are called even with return 1.
No tags attached.
Issue History
17-06-11 06:23xantierNew Issue
17-06-11 18:42babidiNote Added: 0001118
17-06-11 19:27xantierNote Added: 0001119
18-06-11 18:23MrSugarCubeNote Added: 0001125
18-06-11 18:23MrSugarCubeStatusnew => closed
18-06-11 18:23MrSugarCubeResolutionopen => unable to reproduce
18-06-11 21:01xantierNote Added: 0001128
18-06-11 21:01xantierStatusclosed => feedback
18-06-11 21:01xantierResolutionunable to reproduce => reopened
18-06-11 23:12MrSugarCubeNote Added: 0001129
19-06-11 00:54xantierNote Added: 0001130
19-06-11 00:54xantierStatusfeedback => new
19-06-11 01:01xantierNote Edited: 0001130bug_revision_view_page.php?bugnote_id=0001130#r355
19-06-11 01:02xantierNote Edited: 0001130bug_revision_view_page.php?bugnote_id=0001130#r356
19-06-11 06:59xantierNote Added: 0001133
19-06-11 07:03xantierNote Edited: 0001133bug_revision_view_page.php?bugnote_id=0001133#r358
20-06-11 19:43xantierNote Added: 0001139
20-06-11 19:48xantierNote Edited: 0001139bug_revision_view_page.php?bugnote_id=0001139#r364
03-05-14 20:48BenNote Added: 0002147

Notes
(0001118)
babidi   
17-06-11 18:42   
- Changed: Return values for @SPELLSELECT trigger. Touchup for @SELECT with spells. Different
  server behaviour can be achieved with the following RETURN values in trigger scripts:
  @SELECT
      RETURN 0 - proceed without mana, spellbook, and reagent check as if these checks were
                           successful
        RETURN 1 - Abort processing (so aborting the spell)
      RETURN 2 - proceed as normal
      RETURN 6 - like RETURN 0 (for compatibility with @SPELLSELECT)
  @SPELLSELECT
      RETURN 0 - proceed as normal
        RETURN 1 - abort processing (so aborting the spell)
      RETURN 2 - proceed as normal
      RETURN 6 - proceed without mana, spellbook, and reagent check as if these checks were
                           successful
  @SPELLSELECT will be called after @SELECT -
(0001119)
xantier   
17-06-11 19:27   
RETURN 1 - abort processing (so aborting the spell)

this doesn't abort it completely. it still triggers twice. for starting (argn3=03) and for the completion (argn3=03)..
(0001125)
MrSugarCube   
18-06-11 18:23   
I can't reproduce this on the latest automated build. Using your script I only see the message once, when trying to cast a spell with a sword equipped.


You should also check ARGN3 before showing any messages, to prevent CANCAST from displaying the message:

...
IF (<ARGN3> & 02)
    SRC.MESSAGE @022 Your hands must be free to cast spells.
ENDIF
RETURN 1
...
(0001128)
xantier   
18-06-11 21:01   
i have to reopen this because i forgot to add an option. i have precast opened and this happens at magicf_precast. i have just tried the classic cast and it triggered once but it triggers twice on magicf_precast.
(0001129)
MrSugarCube   
18-06-11 23:12   
Nothing changes here when I switch MAGICF_PRECAST on or off. Are you using the latest automated build?

Does this happen with the default script pack? Which spell(s) are you casting? Are you casting from spellbook, wand, .cast, etc?
(0001130)
xantier   
19-06-11 00:54   
(edited on: 19-06-11 01:02)
Yes i am using latest build. It happens with all spells. I tried all sources of magic. It happens at both starting and finishing casting. Because argn3 value is 3 for both and i can't decide which one means starting casting..

according to here, argn3 is same for both stages (start-end):
http://wiki.sphere.torfo.org/index.php/@SpellSelect [^]

Actually when you d-click on the spell, it triggers once with argn3 = 3. and when target cursor appears, another one triggers with argn3 = 3 again. but these all happen immediately when you put a return 1 under @spellselect.


all the code i have under @spellselect is :

if (<argn3>==03)
if (<findlayer.1.uid>) || (<findlayer.2.uid>)
if !((<findlayer.2.type>==t_wand) || (<findlayer.1.type>==t_wand) || (<findlayer.1.baseid>==i_spellbook)) || (<findlayer(2).uid>)
src.message @022 Your hands must be free to cast spells.
return 1
endif
endif
endif

(i had tried to change the if check with argn3 and also tried to remove it but still got the same result)

here is a screenshot from game : http://i52.tinypic.com/6fczg8.png [^]

(0001133)
xantier   
19-06-11 06:59   
(edited on: 19-06-11 07:03)
oh by the way the numbers in the screenshot (3-0-3) don't include 0. it is from another trigger. i think the problem is about same argn3 values for different stages of spell casting. implementing specific argn3 value for each stage must fix that and allow us to control all of the stages i think.

(0001139)
xantier   
20-06-11 19:43   
(edited on: 20-06-11 19:48)
and there's one more problem about precast. this code is a part of runebook script from community pack :

ACT = <Ref1.Uid>
ACTPRV = <Ref1.UID>
ACTARG1 = 32
ACTION = 25

but it has no effect. it casts recall and target cursor appears, but it doesn't select the rune(ACT) automatically.

maybe adding actarg3 option, works like act but for precast may solve this.

(0002147)
Ben   
03-05-14 20:48   
I have looked into this one, and it seems things are not what it seems.
ARGN3 is really only used for 2 flags... 0x1 for testing if a spell can be casted (CANCAST, no reagent consumption) and 0x2 is used to display a fail message if it were to fail.

The 0x3 that is mentioned here as a stage flag is only a combination of the 0x1 and 0x2 flags used for other purposes... so there really isn't a "stage" flag.

I'll have another look into this to see if the whole behavior can be changed to make this work better.