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
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 786 - File: showthread.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/showthread.php 786 errorHandler->error






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CanUse extension
Author Message
golfin
Banned

Posts: 213
Likes Given: 2
Likes Received: 32 in 28 posts
Joined: Nov 2017

Eranova

Post: #1
CanUse extension
Hello to everybody.

I'm dealing with the CanUse problem. I'm trying to extend this definition to other career options - That means for a warrior, ranger, sorcerer, alchemist, and thief. The question is, can it be done? I could use a selection based on typedef (t_armor, t_weapon, etc.), but that is not enough. I need a separate feature for each item. And the definition of CanUse seemed to me to be appropriate for this. I have some script that works well for basic subjects. But once I add, for example, can_u_warrior to an object that only Elf can wear, the entire CanUse stops working. It does not write any system message and does not assign the subject to anyone. Here is a sample of the script I've compiled. It is built into [TYPEDEF t_equipitem] in sphere_item_typedef_equipitem.scp. The ToolTip also does not work even though I edited the cliloc.enu file and assembled the upper script sample for the ON = @ ClientToolTip.
Code:
[TYPEDEF t_equipitem]
ON=@ClientToolTip
//IF ((<DISPID>!=<BASEID>) || (<DISPIDDEC>>16381))
//   ADDCLILOC 1042971,<NAME>
//ELSE
//   ADDCLILOC <EVAL 1020000+<DISPIDDEC>>
//ENDIF
SRC.ADDCLILOC 1042971,<NAME>
IF !(<ATTR> & attr_identified)
    SRC.ADDCLILOC 1041522,<def.BFONT_RED>,#1038000,<def.BFONT_WHITE>
ENDIF
IF (<TYPE>==t_wand)
    IF (<MOREX> > 0) && (<MOREX> <= 64)
        LOCAL.SpellCliloc=<EVAL 3002010+<MOREX>>
        SRC.ADDCLILOC <dLOCAL.SpellCliloc>,<dMORE2>
    ENDIF
    SRC.ADDCLILOC 1060741,<dMORE2>
ENDIF
IF (<Rarity>)
    SRC.ADDCLILOC 1061078,<INSTANCES>//"Artifact rarity: ~"
ENDIF
IF (<canuse>&can_u_gargoyle) && !((<canuse>&can_u_human) || (<canuse>&can_u_elf))
    SRC.ADDCLILOC 1111709//"Gargoyles Only"
ENDIF
IF (<canuse> &can_u_elf) && !((<canuse>&can_u_human) || (<canuse>&can_u_gargoyle))
    SRC.ADDCLILOC 1075086
ENDIF
//////////////Start editing
IF (<canuse> &can_u_warrior) && !((<canuse>&can_u_ranger) || (<canuse>&can_u_sorcerer) || (<canuse>&can_u_alchemyst) || (<canuse>&can_u_thiev))
    SRC.ADDCLILOC 1030829
ENDIF
IF (<canuse> &can_u_ranger) && !((<canuse>&can_u_warrior) || (<canuse>&can_u_sorcerer) || (<canuse>&can_u_alchemyst) || (<canuse>&can_u_thiev))
    SRC.ADDCLILOC 1030830
ENDIF
IF (<canuse> &can_u_sorcerer) && !((<canuse>&can_u_ranger) || (<canuse>&can_u_warrior) || (<canuse>&can_u_alchemyst) || (<canuse>&can_u_thiev))
    SRC.ADDCLILOC 1030831
ENDIF
IF (<canuse> &can_u_alchemyst) && !((<canuse>&can_u_ranger) || (<canuse>&can_u_sorcerer) || (<canuse>&can_u_warrior) || (<canuse>&can_u_thiev))
    SRC.ADDCLILOC 1030832
ENDIF
IF (<canuse> &can_u_thiev) && !((<canuse>&can_u_ranger) || (<canuse>&can_u_sorcerer) || (<canuse>&can_u_alchemyst) || (<canuse>&can_u_warrior))
    SRC.ADDCLILOC 1030833
ENDIF
//////////////End editing

Code:
ON=@EquipTest
IF (<CanUse>&can_u_none)
    RETURN 1
ELSEIF (<CanUse>&can_u_all)
    return 0
ENDIF
IF (<SRC.IsPlayer>)
    IF (<CanUse>&can_u_gargoyle)
        IF !(<SRC.f_isgarg>)
            SRC.SYSMESSAGELOC color_text,1111707                            
            RETURN 1
        ENDIF
    ELSEIF !(<CanUse>&can_u_all)
        IF (<SRC.f_isgarg>)
            SRC.SYSMESSAGELOC color_text,1111708                            
            RETURN 1
        ENDIF
    ENDIF
    //return 0
    IF ( (<CanUse>&can_u_female) && !(<CanUse>&can_u_male) )         
        IF !(<SRC.f_isfemale>)                                                    
            SRC.SYSMESSAGELOC color_text,1010388                            
            RETURN 1
        ENDIF
    ELSEIF ( (<CanUse>&can_u_male) && !(<CanUse>&can_u_female) )    
        IF (<SRC.f_isfemale>)                                                    
            SRC.SYSMESSAGELOC color_text,1063343                            
            RETURN 1
        ENDIF
    ENDIF
//////////////Start editing
    IF ( ( (<CanUse>&can_u_human) && !(<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && (<src.f_IsElf>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
        SRC.SYSMESSAGELOC color_text,1071936                                
        RETURN 1
    ELSEIF ( ( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )    
            SRC.SYSMESSAGELOC color_text,1072203                            
            RETURN 1
    ELSEIF ( ( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
            SRC.SYSMESSAGELOC color_text,1072203                            
            RETURN 1
    ELSEIF ( ( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
            SRC.SYSMESSAGELOC color_text,1072203                            
            RETURN 1
    ELSEIF ( ( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
            SRC.SYSMESSAGELOC color_text,1072203                            
            RETURN 1
    ELSEIF ( ( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) )
            SRC.SYSMESSAGELOC color_text,1072203                            
            RETURN 1
    ELSEIF ( ( (<CanUse>&can_u_thiev) && (<src.IsThiev>) ) && !( (<CanUse>&can_u_human) && (<src.f_IsHuman>) ) && !( (<CanUse>&can_u_elf) && !(<SRC.f_iself>) ) && !( (<CanUse>&can_u_warrior) && (<src.IsWarior>) ) && !( (<CanUse>&can_u_ranger) && (<src.IsRanger>) ) && !( (<CanUse>&can_u_sorcerer) && (<src.IsSorcerer>) ) && !( (<CanUse>&can_u_alchemyst) && (<src.IsAlchemyst>) ) )
            SRC.SYSMESSAGELOC color_text,1072203                            
            RETURN 1
        ENDIF
    ENDIF
ENDIF
//////////////End editing

Why am I doing this? I want an elf warrior, for example, to wear all the armor, but Ranger no longer. The Ranger could not wear platemail. And, for example, Dwarf alchemyst to wear only leather armor. I need the objects to be adjusted according to race, by profession, and then to make an exception to an object - For a sorcerer, a magical platemail to wear it. This is just an example.
(This post was last modified: 10-23-2018 03:12 AM by golfin.)
10-23-2018 03:01 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
CanUse extension - golfin - 10-23-2018 03:01 AM
RE: CanUse extension - darksun84 - 10-23-2018, 06:12 PM
RE: CanUse extension - golfin - 10-23-2018, 06:55 PM
RE: CanUse extension - darksun84 - 10-23-2018, 08:30 PM
RE: CanUse extension - golfin - 10-23-2018, 09:14 PM
RE: CanUse extension - golfin - 10-25-2018, 04:35 AM

Forum Jump:


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