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
typedef question
Author Message
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #11
RE: typedef question
09-03-2012 10:00 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #12
RE: typedef question
layer

[Image: 2nis46r.jpg]
09-04-2012 03:37 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
daedelus
Journeyman
*

Posts: 69
Likes Given: 0
Likes Received: 2 in 1 posts
Joined: Aug 2012
Reputation: 0



Post: #13
RE: typedef question
(09-01-2012 05:48 AM)Extreme Wrote:  
PHP Code:
ON=@ITEMEQUIPTEST
IF STRMATCH(*T_BOW*,<ACT.TYPE>)
 IF 
STRMATCH(*T_PLATE*,<SRC.FINDLAYER.LAYER_GLOVES.TYPE>)
  
SRC.FINDLAYER.LAYER_GLOVES.UNEQUIP
 
ENDIF
 IF 
STRMATCH(*T_PLATE*,<SRC.FINDLAYER.LAYER_ARMS.TYPE>)
  
SRC.FINDLAYER.LAYER_ARMS.UNEQUIP
 
ENDIF
ENDIF
IF 
STRMATCH(*T_PLATE*,<ACT.TYPE>) && ((<ACT.LAYER> == LAYER_ARMS) || (<ACT.LAYER> == LAYER_GLOVES))
 IF 
STRMATCH(*T_BOW*,<SRC.FINDLAYER.2.TYPE>)
  
SRC.FINDLAYER.2.UNEQUIP
 
ENDIF
ENDIF 

19:14:ERROR:(sphere_item_provisions_armor_color.scp,26)Can't resolve <ACT.TYPE>
19:14:ERROR:(sphere_item_provisions_armor_color.scp,34)Can't resolve <ACT.TYPE>
19:14:ERROR:(sphere_item_provisions_armor_color.scp,34)Can't resolve <ACT.LAYER>
19:14:ERROR:(sphere_item_provisions_armor_color.scp,34)Can't resolve <ACT.LAYER>
19:14:ERROR:(sphere_item_provisions_armor_color.scp,34)Undefined symbol ''
19:14:ERROR:(sphere_item_provisions_armor_color.scp,34)Undefined symbol ''

I try yo fix them, but i can't xD.

Thanks
09-05-2012 08:15 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #14
RE: typedef question
Tip of the Day: Write out the logic first using comments, then fill in the actual code...

For example, this:

Code:
ON=@ITEMEQUIPTEST
//Is the player equipping a bow?
   //Player wants to equip a bow, first check if they are wearing gloves
      //They are wearing gloves... but what kind?
         //They are plate, so unequip them
   //Are they wearing arms?
      //They are wearing arms... but what kind?
         //They are plate, so unequip them
//Is the player equipping arms or gloves made of plate?
   //The player wants to equip plate arms or gloves, so check if they have a weapon in their second hand
      //They do have an item in their second hand... is it a bow?
         //They are wielding a bow, so unequip it

...eventually becomes this:

Code:
ON=@ITEMEQUIPTEST
//Is the player equipping a bow?
IF STRMATCH(*T_BOW*,<ACT.TYPE>)
   //Player wants to equip a bow, first check if they are wearing gloves
   IF (<SRC.FINDLAYER.LAYER_GLOVES>)
      //They are wearing gloves... but what kind?
      IF STRMATCH(*T_PLATE*,<SRC.FINDLAYER.LAYER_GLOVES.TYPE>)
         //They are plate, so unequip them
         SRC.FINDLAYER.LAYER_GLOVES.UNEQUIP
      ENDIF
   ENDIF
   //Are they wearing arms?
   IF (<SRC.FINDLAYER.LAYER_ARMS>)
      //They are wearing arms... but what kind?
      IF STRMATCH(*T_PLATE*,<SRC.FINDLAYER.LAYER_ARMS.TYPE>)
         //They are plate, so unequip them
         SRC.FINDLAYER.LAYER_ARMS.UNEQUIP
      ENDIF
   ENDIF
ENDIF
//Is the player equipping arms or gloves made of plate?
IF ((<ACT.LAYER> == LAYER_ARMS) || (<ACT.LAYER> == LAYER_GLOVES)) && (STRMATCH(*T_PLATE*,<ACT.TYPE>))
   //The player wants to equip plate arms or gloves, so check if they have a weapon in their second hand
   IF (<SRC.FINDLAYER.LAYER_HAND2>)
      //They do have an item in their second hand... is it a bow?
      IF STRMATCH(*T_BOW*,<SRC.FINDLAYER.2.TYPE>)
         //They are wielding a bow, so unequip it
         SRC.FINDLAYER.2.UNEQUIP
      ENDIF
   ENDIF
ENDIF
09-05-2012 08:52 AM
Find all posts by this user Like Post Quote this message in a reply
daedelus
Journeyman
*

Posts: 69
Likes Given: 0
Likes Received: 2 in 1 posts
Joined: Aug 2012
Reputation: 0



Post: #15
RE: typedef question
Ok, but how i can define de t_plate

Code:
[typedef t_plate]
IF (<SRC.FINDLAYER.LAYER_GLOVES.BASEID> = I<ARGV[0]>_PLATEMAIL_GLOVES) || (<SRC.FINDLAYER.LAYER_ARMS.BASEID> = I<ARGV[0]>_PLATEMAIL_ARMS)

i try and try and try but nothing Sad i'm feeling stupid...

thanks
09-05-2012 09:27 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #16
RE: typedef question
Ahhh I thought you got that sorted out already.

There doesn't need to be any code in the typedef... just declare it, then apply it to the items you want to have it like this:

Code:
[ITEMDEF 01410]
DEFNAME=i_platemail_arms
TYPE=t_armor
FLIP=1
WEIGHT=5
REQSTR=80
RESOURCES=18 i_ingot_iron
SKILLMAKE=Blacksmithing 66.3
CATEGORY=Provisions - Armor - Blacksmithing
SUBSECTION=Platemail Armor
DESCRIPTION=Platemail Arms
TAG.Penalty.Meditation=1
TAG.Penalty.Stealth=10
TAG.ResPhysical=5
TAG.ResFire=3
TAG.ResCold=2
TAG.ResPoison=3
TAG.ResEnergy=2
DUPELIST=01417
TEVENTS=t_plate
ON=@Create
   COLOR=color_o_iron
   HITPOINTS={36 48}

...although your code might need to change to check TEVENTS instead of TYPE.

Another way to accomplish the result is using an item TAG (if you put the TAG above the @create then all items of that type already in game will have it.)
09-05-2012 09:41 AM
Find all posts by this user Like Post Quote this message in a reply
daedelus
Journeyman
*

Posts: 69
Likes Given: 0
Likes Received: 2 in 1 posts
Joined: Aug 2012
Reputation: 0



Post: #17
RE: typedef question
Code:
[FUNCTION F_DESEQUIPAR]
ON=@ITEMEQUIPTEST
//Is the player equipping a bow?
IF STRMATCH(*T_BOW*,<ACT.TYPE>)
   //Player wants to equip a bow, first check if they are wearing gloves
   IF (<SRC.FINDLAYER.LAYER_GLOVES>)
      //They are wearing gloves... but what kind?
      IF STRMATCH(*T_PLATE*,<SRC.FINDLAYER.LAYER_GLOVES.TYPE>)
         //They are plate, so unequip them
         SRC.FINDLAYER.LAYER_GLOVES.UNEQUIP
      ENDIF
   ENDIF
   //Are they wearing arms?
   IF (<SRC.FINDLAYER.LAYER_ARMS>)
      //They are wearing arms... but what kind?
      IF STRMATCH(*T_PLATE*,<SRC.FINDLAYER.LAYER_ARMS.TYPE>)
         //They are plate, so unequip them
         SRC.FINDLAYER.LAYER_ARMS.UNEQUIP
      ENDIF
   ENDIF
ENDIF
//Is the player equipping arms or gloves made of plate?
IF ((<ACT.LAYER> == LAYER_ARMS) || (<ACT.LAYER> == LAYER_GLOVES)) && (STRMATCH(*T_PLATE*,<ACT.TYPE>))
   //The player wants to equip plate arms or gloves, so check if they have a weapon in their second hand
   IF (<SRC.FINDLAYER.LAYER_HAND2>)
      //They do have an item in their second hand... is it a bow?
      IF STRMATCH(*T_BOW*,<SRC.FINDLAYER.2.TYPE>)
         //They are wielding a bow, so unequip it
         SRC.FINDLAYER.2.UNEQUIP
      ENDIF
   ENDIF
ENDIF
[/quote]

On item :
TEVENTS=t_type

ON=@create
blablalba

ON=@equip
call f_desequipar

And do nothing Confused and don't give me errors. Sorry men, i don't understand.
09-05-2012 12:32 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #18
RE: typedef question
You cannot put triggers in a function.
09-05-2012 12:48 PM
Find all posts by this user Like Post Quote this message in a reply
daedelus
Journeyman
*

Posts: 69
Likes Given: 0
Likes Received: 2 in 1 posts
Joined: Aug 2012
Reputation: 0



Post: #19
RE: typedef question
(09-05-2012 12:48 PM)RanXerox Wrote:  You cannot put triggers in a function.

good point Smile at night i try.


thanks
09-05-2012 10:05 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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