Difference between revisions of "TruxtonArtifactType"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This class lets you add to the <code>[EntityType]</code> table in Truxton. This is how you add your own custom artifact types to Truxton. =Attributes and Methods= ==<code>id<...")
 
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
=Attributes and Methods=
 
=Attributes and Methods=
==<code>id</code>==
+
==<code>id: int</code>==
 
An 16-bit integer value for the type of event this is.
 
An 16-bit integer value for the type of event this is.
 
This should be a value over 1000.
 
This should be a value over 1000.
  
==<code>longname</code>==
+
==<code>longname: str</code>==
 
A human readable description of the artifact type.
 
A human readable description of the artifact type.
  
==<code>shortname</code>==
+
==<code>shortname: str</code>==
 
A human readable label for the artifact type.
 
A human readable label for the artifact type.
  
==<code>save()</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.
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())