Truxton artifact set type
Jump to navigation
Jump to search
This sets the type of the artifact.
This corresponds to the [EntityTypeID] column of the [Entity] table.
Syntax
void truxton_artifact_set_type( uint64_t artifact_handle, uint64_t value );
Parameters
artifact_handle
The artifact instance.
This handle comes from calling truxton_artifact_create().
value
The type of the artifact.
This value should match one stored in the [ID] column of the [EntityType] table or one of the defined constants.
Sample
void create_artifact( void )
{
uint64_t truxton = truxton_create();
uint64_t artifact = truxton_artifact_create(truxton);
truxton_artifact_set_name( artifact, "Ducky Momo Server" );
truxton_artifact_set_type( artifact, ENTITY_TYPE_MACHINE_NAME );
truxton_artifact_save( artifact );
truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 );
uint64_t entity_type = truxton_artifact_get_type( artifact );
printf( "Artifact type is %" PRIu64 "\n", data_type );
truxton_artifact_destroy( artifact );
truxton_destroy( truxton );
}
The PRIu64 in the sample code above is a standard way of formatting a 64-bit unsigned integer in C.
Over the years, different compilers on different operating systems used different format specifiers for things, these PRI macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic.