Difference between revisions of "GetName - Form"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Tania
m (typo)
imported>Qazaaq
(style and example tweak for actor name)
Line 20: Line 20:
<source lang="papyrus">
<source lang="papyrus">
; If you want to know the name of player's current cell.
; If you want to know the name of player's current cell.
String sCellName = Game.GetPlayer().GetParentCell().GetName()
string cellName = Game.GetPlayer().GetParentCell().GetName()
debug.trace("My parent cell's name is: " +sCellName)
Debug.Trace("My parent cell's name is: " + cellName)


; If you want to know an actor's name.
; If you want to know an actor's name.
PrestonRef.GetActorBase().GetName()
string prestonName = PrestonRef.GetActorBase().GetName()
Debug.Trace(prestonName + " says hello.")
</source>
</source>



Revision as of 20:12, 12 October 2017


F4SE member of: Form Script

Gets the name of the form, full name if possible. Requires F4SE 0.03.1.

Syntax

string Function GetName() Native

Parameters

None

Return Value

The name of the form as a string.

Examples

; If you want to know the name of player's current cell.
string cellName = Game.GetPlayer().GetParentCell().GetName()
Debug.Trace("My parent cell's name is: " + cellName)

; If you want to know an actor's name.
string prestonName = PrestonRef.GetActorBase().GetName()
Debug.Trace(prestonName + " says hello.")

Notes

  • For actors and object references, must be used on the base object.
  • The return value is the name found under the name column for objects in the editor.

See Also

Form Script