Diarkis Room - How To Increment/Decrement Numeric Properties With Mutex Lock
How To Increment and/or Decrement A Numeric Room Property
Room module has an API to increment and/or decrement a numeric room property. This is useful when you have to update a numeric room property without race conditions.
// If the property called HP does not exist, it will create it
created := room.IncrProperty(roomID, "HP", 1000)
// Decrement the property called HP by -200
decremented := room.IncrProperty(roomID, "HP", -200)
// Increment the property called HP by 100
incremented := room.IncrProperty(roomID, "HP", 100)