Before consulting this chapter, make sure you have read ARES Tutorials: Personas for a basic introduction to why personas exist and what they are generally used for.

In technical terms, a persona file is a shell script that has been renamed to have the .p file extension. Like any other shell script, it is executed as though the user who triggered it is running each command, meaning it will inherit their credentials (See Security Rules in Operating ARES: Security.) Thus, when an Owner loads a persona, that persona has full access to the system.

The value of personas lies chiefly in organizing customization options for the unit, as persona scripts appear in the personalities... menu rather than the scripts... menu. In general, units and users expect a persona script to mainly consist of calls to the persona program, which in turn configures options in the LSD:persona section of the database. Thus the persona program can be seen as a restricted version of the db utility, and a .p file is a more powerful version of a .db database dump file. (It is entirely possible to accomplish most of the effects of a basic persona using a database dump rather than a shell script.)

"Most of"? Although the persona file is parsed by the system shell (the _exec script), running the @persona command as a front-end is necessary to perform outfit changes, and to send a notification to attached devices that the active persona has changed. Thus, while you can simply run @do <name>.p to apply the changes in a persona file, it is better to run @persona <name> when actually changing to a new persona.

Naming

Persona files should ideally be named with a single word in lower-case letters. This should be either an adjective or common noun, such as secretary.p or lazy.p. Long and fanciful names, such as My Super Cool Persona.p, are difficult to type in commands, will get cut off in the menus, and will fail to load because of the presence of spaces in the filename. Do not put spaces in filenames.

The persona program

The persona application is part of the standard (non-militarized) ARES distribution, and is used to switch personas, to set persona attributes, and to interpret preset messages. Its syntax is as follows:

persona <filename>
Attempts to load the persona <filename>, adding the .p extension automatically if missing. At the start of the loading process, LSD:persona.path is retrieved and the old #RLV folder is removed with @detachall. At the end, the value is retrieved again and the new #RLV folder is applied with @attachallover.
persona .<keyword>
Sends the preset message <keyword> to input as though it had been typed by the unit
persona set <setting> <value>
Assigns a <value> to one of the <setting>s in LSD:persona.
persona set marker <neuter> <feminine> <masculine>
Sets the UUIDs of sound effects to use for the chat markers while the persona is active. Note that the unit may opt out of these settings; see caveats at ARES Tutorial: How to modify the chat marker (speech sound).
persona set action {}
Clears all preset messages.
persona set action.<keyword> <message>
Creates a new preset message, which will send <message> to input whenever the unit types .<keyword>
persona set path <path>
Sets the path to use for RLV SharedWear. This is a partial directory path name assumed to exist inside #RLV, with a forward slash (/) used as a separator.) In typical use it should always consist of $rlv/persona/<name>, where <name> is the name of the persona (without the .p extension) and $rlv will automatically be replaced with whatever the unit has set in LSD:env.rlv (by default, ~ARES)

Typical persona

When creating a new persona, you might use this as your starting template:

persona set marker 245b5372-8f37-2b9a-aa38-ea33970581d1 d92316c9-b2db-1c81-1c52-0c72d677cda8 a9cb060a-7ca5-b953-6cd8-6ecbfd2097f7 persona set path $rlv/persona/custom persona set action {} persona set action.yes Yes. persona set action.no No. persona set action.hi Hello. persona set action.bye Goodbye. persona set action.ok Acknowledged. persona set action.lol Humor detected. persona set action.thanks This unit thanks you. persona set action.ready Ready. persona set action.cannot This unit cannot comply. persona set action.error An error has occurred. persona set action.use This unit is available to assist. persona set action.use? @say This unit offers \$pm.refl to assist. persona set action.help This unit requires assistance. persona set action.help? Do you require assistance? persona set action.explain Please, explain further. persona set action.mind @say This unit cannot comply while \$pm.gen cortex is disabled.

Copy the above text into a new notecard named custom.p, and drop it into ring 3 (the model badge) of your ARES HUD. Make sure you replace custom (both in the filename and in the persona set path ... line) with an actual name you want to use.

Advanced preset messages

Since persona preset messages are sent directly to the input processor, they can trigger anything that the unit can type to the system while powered on, including system (@) commands, light bus (!) commands, input directives (= commands) and even other preset messages. Try not to destroy yourself.

This power makes preset messages slightly more convenient than shell aliases for accomplishing certain tasks, although the most practical use is in simply leveraging the shell's ability to perform variable substitution. Instances of this are highlighted in blue in the sample persona above. These lines all begin with @say, which is shorthand for @input say. The @ tells _input to send the message to _exec, and the say tells _exec to send the message back to _input. But while _exec is processing the message, it also checks for words that start with $ and replaces them. This is how personas insert the correct pronouns into the message. See Using Pronouns in Operating ARES: Identity for a list of values to use.

What's with the slashes? Astute programmers will notice that shell scripts normally just make a direct reference to environment variables, such as writing say Hello, $username! when needed. We could do this in a persona, too, but using the @say ... \$<variable> construct makes it possible to ensure the pronouns are substituted when the preset message is executed, not when the persona is loaded. Thus the unit's pronouns will be correct even if they change while the persona is already activated. This is called "just-in-time" or "lazy" variable expansion.

The default persona

When the default persona is loaded, a different announcer sound effect is played (typically "Default persona restored" rather than "Persona activated"), but otherwise the system treats it the same as any other. Notably, the default.p file that ships with ARES includes some slightly different preamble:

if $marker-neuter is %undefined then set marker-neuter 245b5372-8f37-2b9a-aa38-ea33970581d1 if $marker-female is %undefined then set marker-female d92316c9-b2db-1c81-1c52-0c72d677cda8 if $marker-male is %undefined then set marker-male a9cb060a-7ca5-b953-6cd8-6ecbfd2097f7 if $rlv is %undefined then set rlv ~ARES persona set marker $marker-neuter $marker-female $marker-male

This allows the unit to specify custom default speech markers with @set marker-neuter <uuid>, @set marker-female <uuid>, or @set marker-male <uuid>, and ensures these values are always defined; additionally, it ensures that the environment variable rlv is always set. This preamble helps to make the persona system more resilient in the event that the LSD:env database section gets trashed; see The ARES Operating System: The Database for more information.