Is giftable: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
mNo edit summary
imported>Bale
gift.item proxy record
 
Line 15: Line 15:
}}|
}}|


function_description=This function checks to see if the item {{pspan|check_me}} can be sent as a gift, returning true if it can and false otherwise.|
function_description=This function checks to see if the item {{pspan|check_me}} can be sent as a gift, returning true if it can and false otherwise. Note that this will return true for all items that are not untradeable, not merely gift items. If you want to specifically know if an item is a gift item, then check the gift.item proxy record.|


needscode=yes|
code1={{CodeSample|
title=Code Sample|
description=Differentiate between Gift item and giftable item.|
code=
<syntaxhighlight>
void gift_kind( item check ) {
  if( check.gift == true )
      print( check + " is a gift item." );
  else if( is_giftable(check) )
      print( check + " can be sent to another player." );
  else
      print( check + " cannot be kMailed or traded to another player." );
}
</syntaxhighlight>}}|


see_also={{SeeAlso|is_displayable|is_tradeable}}|
see_also={{SeeAlso|is_displayable|is_tradeable}}|

Latest revision as of 10:40, 10 November 2014

Function Syntax

boolean is_giftable(item check_me )

  • check_me is an item to test

This function checks to see if the item check_me can be sent as a gift, returning true if it can and false otherwise. Note that this will return true for all items that are not untradeable, not merely gift items. If you want to specifically know if an item is a gift item, then check the gift.item proxy record.

Code Sample

Differentiate between Gift item and giftable item.

void gift_kind( item check ) {
   if( check.gift == true )
      print( check + " is a gift item." );
   else if( is_giftable(check) )
      print( check + " can be sent to another player." );
   else
      print( check + " cannot be kMailed or traded to another player." );
}

See Also

is_displayable() | is_tradeable()