SetPlayerLook
Gives a player a look - the skin, the face, the hair and the beard - on every screen.
look is a table {body, head, hair, beard} of part names (GetLookParts), or the one line LookToString makes -
what a database column gave back. A part left out, or "", is the one the body’s soul gives it; {} takes the
whole look off. Everyone who sees the player gets the new look at once - the body changes in place, no respawn - and so
does the player’s own game; it lasts through every respawn until the next call. A look given before the spawn arrives
with it.
gender = "female" (or a look of a woman’s parts alone) gives the player a woman’s body: the others see her body at
once; her own game shows it after she rejoins, which it asks her to do when her body changed while she was in the
world. A look set before her spawn (a saved character, at login) needs no rejoin after the first time: her game
remembers the body for the next visit to the server.
Every part is checked against the game’s lists: a name that is not a part of its kind, a woman’s part on a man’s body
or a man’s on a woman’s, or a beard on a woman, refuses the whole look - false and the reason, worded for a player.
Without the tables export ([combat] tables in server.toml) any word of
letters, digits and _ passes unchecked (a name starting f_ counts as a woman’s).
Syntax
Section titled “Syntax”SetPlayerLook(pid, look)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
look |
table | string | {body, head, hair, beard, gender}, or its one-line form |
Returns
Section titled “Returns”boolean, string | nil - true, or false and the reason (“There is no hair ‘x’.”)
Example
Section titled “Example”-- a stranger's look, the same every visit for the same nameSetPlayerLook(pid, {head = "m_head_004", hair = "m_hair_005_black", beard = "m_beard_03", body = "m_body_tan_02"})
-- a womanSetPlayerLook(pid, {gender = "female", head = "f_head_013", hair = "f_hair_004_blonde", body = "f_body_pale_01"})
-- back from the database: the column holds LookToString's linelocal ok, why = SetPlayerLook(pid, row.look)if not ok then Log("the saved look of " .. GetPlayerName(pid) .. " is gone: " .. why) endSee also
Section titled “See also”GetPlayerLook · LookToString · OnPlayerLookChange · GetLookParts · the Looks and character creation group of the index
