SphereCommunity
Clothing Bless Deed & ContextMenus - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Clothing Bless Deed & ContextMenus (/Thread-Clothing-Bless-Deed-ContextMenus)



Clothing Bless Deed & ContextMenus - Reflex - 04-21-2012 05:04 PM

Now, for some reason.. After I bless an Item with the CBD the blessed item always calls the contextmenu instead of only when i want it to call it ? Even if I get the else message it still displays the context menu? wth.. why?

Code:
//override for t_clothing
[TYPEDEF t_clothing]
ON=@Click
IF (<TAG0.isblessed> = 1)
    src.sysmessage This has tag.isblessed 1 and needs to call a contextmenu
    TRIGGER ContextMenuRequest
    message <name>
    return 1 // thought maybe the returns were causing this.. dunno
ELSE
src.sysmessage Else
message <name>
RETURN 1
ENDIF

ON=@ContextMenuRequest
SRC.AddContextEntry 1000,3006278,0
SRC.AddContextEntry 2000,3006208,0

ON=@ContextMenuSelect
IF (<ARGN>==1000)
    SRC.SAY CUT ARTICLE OF BLESSED CLOTHING
ENDIF
IF (<ARGN>==2000)
    SRC.SAY GET CBD BACK
ENDIF
[eof]

[itemdef i_cbd]
id=i_deed
name=Clothing Bless Deed

    on=@create
    attr=04
    CATEGORY=Custom
    SUBSECTION=Special
    DESCRIPTION=Clothing Bless Deed

ON=@DCLICK
IF (<CONT> == <SRC.FINDLAYER(21).uid>)
    //src.sysmessageloc 1 1045156 //these dont seem to want to work?
    src.sysmessageua 955 0 0 1 Select the article of clothing you wish to bless.
    TARGETF f_BlessAnItem
    RETURN 1
ELSE
    SRC.SYSMESSAGELOC 1 1045156 // must be in backpack
    RETURN 1  
ENDIF

[FUNCTION f_BlessAnItem]

IF <ARGO.ISITEM>
    IF (STRMATCH(*t_clothing*,<ARGO.TYPE>)) && (<ARGO.CONT> == <SRC.FINDLAYER(21).uid>)
        IF !(<ARGO.ATTR> & attr_newbie)
        SRC.SYSMESSAGELOC 1 1010025 1 // this cliloc wont display
               //src.sysmessageua 955 0 0 1 The <ARGO.name> is now Blessed.
        ARGO.ATTR=04
        ARGO.NAME=<ARGO.NAME> [Blessed]
        ARGO.HITPOINTS=0fffffff
        ARGO.tag.isblessed=1
        consume 1 i_cbd // is this ok or is there a more secure way?
        ELSE
           sysmessageua 955 0 0 1 This article of clothing is already Newbied or Blessed.
           RETURN 1
        ENDIF
    ELSE
    SRC.SYSMESSAGE This is not an article of clothing?
       SRC.SYSMESSAGELOC 1 1005019
       RETURN 1
    ENDIF
ELSE
   sysmessageua 955 0 0 1 This item is not able to be blessed.
    RETURN 1
ENDIF

ON=@Targon_Char
    src.sysmessageua 955 0 0 1 I dont think you can make someone else a newbie this way :/
    return 1

//end of cbd



RE: Clothing Bless Deed & ContextMenus - Shaklaban - 04-21-2012 05:59 PM

why you calling TRIGGER ContextMenuRequest under @click? there is @contextmenurequest trigger, you must define your statements under this trigger, not on click:

Code:
on=@contextmenurequest
if bla bla

endif