Difference between revisions of "TruxtonArtifactType"

From truxwiki.com
Jump to navigation Jump to search
 
Line 33: Line 33:
  
 
if __name__ == "__main__":
 
if __name__ == "__main__":
   main()
+
   sys.exit(main())
 
</source>
 
</source>

Latest revision as of 15:06, 27 January 2024

This class lets you add to the [EntityType] table in Truxton. This is how you add your own custom artifact types to Truxton.

Attributes and Methods

id: int

An 16-bit integer value for the type of event this is. This should be a value over 1000.

longname: str

A human readable description of the artifact type.

shortname: str

A human readable label for the artifact type.

save() -> boolean

This will commit the information to the [EntityType] table. It will return True if the record was saved to the database, False if there was an error.

Sample

import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton

def main():
  t = truxton.create()

  new_type = t.newartifacttype()
  new_type.id = 1003
  new_type.shortname = "Nuke ID"
  new_type.longname = "Nuclear weapon unique identifier"
  new_type.save()

if __name__ == "__main__":
  sys.exit(main())