Difference between revisions of "HasKeyword - Form"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>DiemCarpe
imported>JustinOther
m (Removed erroneous note. Native functions don't have to be defined in any script.)
Line 18: Line 18:
== Examples ==
== Examples ==
<source lang="papyrus">
<source lang="papyrus">
Scriptname ExampleScript
ScriptName ExampleScript Extends ObjectReference


Keyword Property DoomKeywordProperty auto
Keyword Property DoomKeywordProperty Auto


; Does this object have a doom keyword?
Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akFormReference, ObjectReference akSourceContainer)
if (NiceSwordProperty.HasKeyword(DoomKeywordProperty))
If akBaseItem.HasKeyword(DoomKeywordProperty) ; Does the added object have a doom keyword?
; Note: You do not need to state the function's syntax in your script
Debug.Trace("The added sword is a doom sword")
; to be able to use the function
EndIf
  Debug.Trace("The nice sword is a doom sword")
EndEvent
endIf
</source>
</source>


== See Also ==
== See Also ==
*[[Form Script]]
*[[Form Script]]

Revision as of 16:08, 16 September 2012

Member of: Form Script

Checks to see if the specified keyword is attached to this form.

Syntax

bool Function HasKeyword(Keyword akKeyword) native

Parameters

  • akKeyword: The Keyword to query for.

Return Value

Whether this form has the specified keyword or not. If the form doesn't support keywords, it will always return false.

Examples

ScriptName ExampleScript Extends ObjectReference

Keyword Property DoomKeywordProperty Auto

Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akFormReference, ObjectReference akSourceContainer)
	If akBaseItem.HasKeyword(DoomKeywordProperty) ; Does the added object have a doom keyword?
		Debug.Trace("The added sword is a doom sword")
	EndIf
EndEvent

See Also