Multiuser Lingo Dictionary > Multiuser Lingo Dictionary > setAttribute |
![]() ![]() ![]() |
setAttribute
Syntax
system.group.setAttribute [#group: "@groupName", #attribute: [#attribute1
:
value1
{,#attribute2
:value2
} {,#lastUpdateTime
: "timeString
"}]] system.DBUser.setAttribute [#userID: "userName", #attribute: [#attribute1
:value1
{,#attribute2
:value2
} {,#lastUpdateTime
: "timeString
"}]] system.DBPlayer.setAttribute [#userID: "userName", #application: "appName", #attribute: [#attribute1
:value1
{,#attribute2
:value2
} {,#lastUpdateTime
: "timeString
"}]] system.DBApplication.setAttribute [#application: "appName", #attribute: [#attribute1
:value1
{,#attribute2
:value2
} {,#lastUpdateTime
: "timeString
"}]]
Description
Multiuser Server command; sets the value of an attribute for a group or a database object. To set a group attribute, supply the group name. To set a database object attribute, supply the #userID
attribute, the #application
attribute, or both. If both are supplied, the attribute is set for the DBPlayer
object for the given user in the given application.
The #lastUpdateTime
property is optional and lets you determine whether some other user has updated the attributes of the group since you last checked them with getAttribute
. When you use getAttribute
, the server responds with the values of the attributes you requested plus a #lastUpdateTime
property, which indicates the moment in time when the server read the values of those attributes for the group you requested. The #lastUpdateTime
property is a string containing the year, month, day, hour, minutes, seconds, and microseconds on the server. By sending this same string with your setAttribute
command, you allow the server to check whether the attributes for the group have been updated since you last checked them.
If the server determines that the attributes for the group have been updated by someone else since you checked them, it responds with a value in the #errorCode
property indicating a concurrency error. If no one else has updated the attributes since you checked them, the server responds with a new value in the #lastUpdateTime
property for the group or database object, indicating that you have just updated the attributes.
Examples
This statement sets the attributes #teamLeader
and #location
for the group @RedTeam:
errCode = gMultiuserInstance.sendNetMessage("system.group.setAttribute", "anySubject", [#group: "@RedTeam", #attribute: [#teamLeader: "Mary", #location: "New York", #lastUpdateTime: "2001
/07/26 15:26:33:123456"]])
The server's response looks like this:
[#errorCode: 0, #recipients: ["userName"], #senderID: "system.group.setAttribute", #subject: "anySubject", #content: ["@RedTeam": [#lastUpdateTime: "2001/08/25 18:55:33.132456"]], #timeStamp: 32189685]
This statement sets the attribute #favoriteColor
for the DBUser object Bob:
errCode = gMultiuserInstance.sendNetMessage("system.DBUser.setAttribute", "anySubject", [#userID: "Bob", #attribute: [#favoriteColor: "Blue", #lastUpdateTime:
"2001/07/26 15:26:33:123456"]])
The server's response looks like this:
[#errorCode: 0, #recipients: ["userName"], #senderID: "system.DBUser.setAttribute", #subject: "anySubject", #content: ["Bob": [#lastUpdateTime: "2001/08/25 13:28:22.123456"]], #timeStamp: 184472070]
The following statement sets the attributes #accountBalance
and #cardHand
for the DBPlayer object of the user Bob in the movie Poker. The #accountBalance
and #cardHand
attributes have already been declared with declareAttribute
.
errCode = gMultiuserInstance.sendNetMessage("system.DBPlayer.setAttribute", "anySubject", [#userID: "Bob", #application: "Poker", #attribute: [#accountBalance: 3500, #cardHand: "Royal Flush", #lastUpdateTime: "2001/07/26 15:26:33:123456"]])
The server's response looks like this:
[#errorCode: 0, #recipients: ["userName"], #senderID: "system.DBPlayer.setAttribute", #subject: "anySubject", #content: ["Bob": [#lastUpdateTime: "2001/08/26 12:43:33.647483"]], #timeStamp: 6461476]
The following statement sets the attribute #highScore
for the DBApplication object Basketball. The #highScore
attribute has already been declared with declareAttribute
.
errCode = gMultiuserInstance.sendNetMessage("system.DBApplication.setAttribute", "anySubject", [#application: "Basketball", #attribute: [#highScore: 1352, #lastUpdateTime: "2001/07/26 15:26:33:123456"]])
The server's response looks like this:
[#errorCode: 0, #recipients: ["userName"], #senderID: "system.DBApplication.setAttribute", #subject: "anySubject", #content: ["Basketball": [#lastUpdateTime: "2001/08/25 14:16:14.852673"]], #timeStamp: 187351603]
See also
getAttribute
, sendNetMessage()
![]() ![]() ![]() |