Difference between revisions of "TruxtonArtifactType"

From truxwiki.com
Jump to navigation Jump to search
Line 13: Line 13:
 
A human readable label for the artifact type.
 
A human readable label for the artifact type.
  
==<code>save() -> bool</code>==
+
==<code>save() -> boolean</code>==
 
This will commit the information to the <code>[EntityType]</code> table.
 
This will commit the information to the <code>[EntityType]</code> table.
 
It will return [https://docs.python.org/3/library/constants.html#True True] if the record was saved to the database, [https://docs.python.org/3/library/constants.html#False False] if there was an error.
 
It will return [https://docs.python.org/3/library/constants.html#True True] if the record was saved to the database, [https://docs.python.org/3/library/constants.html#False False] if there was an error.

Revision as of 05:00, 14 September 2022

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__":
  main()