UODiamondCodex

Friends System

A personal friends list (up to 10 slots) with mutual-consent invites, online/offline status, private messaging, and login/logout notifications. Source: UOD - System Friends.scp.

How it works

Each player carries an equipped script item i_friends that stores up to ten friend UIDs in tags TAG.FRIENDS_1 .. FRIENDS_10 (0 = empty slot). All commands read and write these tags via findid.i_friends.

Adding a friend (.fa) is a two-way handshake:

  1. .fa (FUNCTION fa) equips a temporary targeting item i_fa, which asks "Who do you wish to add into your friend list?" You may only target another player (not NPCs, ground, items, or yourself).
  2. The target's tag.friend_ask_uid is set and they are shown dialog d_friends — a gump with Accept / Decline buttons.
  3. On Accept, both sides run addfriend (adding each other's UID). The dialog rejects the invite if either list is full (isfriendfull) or the two are already friends (returnfriendnumber).

Removing (.fr N) calls removefriend on both parties so the friendship is severed on both sides.

Login/logout hooks: friend_login (which also runs F_CHECK_FRIEND_SANITY to purge friends whose characters were deleted) and friend_logoff notify all of a player's friends via friendgetmessagelog.

Commands / player-facing usage

Command Effect
.fa Target a player to send a friend invitation
.fl List your friends with online/offline status (FUNCTION fl)
.fr N Remove friend #N (1–10) (FUNCTION fr)
.fm <text> Message all your friends (FUNCTION fm)
.fm1 <text>.fm10 <text> Private-message a single friend by slot number

The friends FUNCTION prints this help (.fa / .fl / .fr / .fm / .fm1..fm10).

Key definitions

DEFNAME Role
i_friends Equipped store item holding TAG.FRIENDS_1..10
i_fa Temporary target item used by .fa (15s self-remove)
d_friends Accept/Decline invitation gump
addfriend / removefriend Write/clear a friend slot
isfriendfull Returns 1 when all 10 slots are used
returnfriendnumber / numberreturnfriend Convert between UID and slot index
onlinestate Formats a friend's online/offline line for .fl
friendgetmessage / friendgetmessagelog Deliver a private/system message to a friend if online
friend_login / friend_logoff Broadcast login/logout to friends
F_CHECK_FRIEND_SANITY GM-run cleanup of stale (deleted-character) friend entries
clearfriends / fixfiends Maintenance: wipe all / reset slots 6–10

Note: Message colours come from def.sysfriends, def.sysfriends_online, and def.sysfriends_offline. friendfix is a debug logger that dumps the first five friend UIDs to the server log.