Skip to content

Commit 034a2af

Browse files
Update README.md
Supporting DnD Shells
1 parent 24a8068 commit 034a2af

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Here are some of the things that you can do with the GoDice JavaScript API:
1010
* Ask for the die Color (dots color)
1111
* Ask for the die battery level
1212
* Get differernt notifications reagrding the die state (Rolling or Stable and get the outcome number)
13+
* Use and configure different shells
1314

1415
To run the demo (that use the API) just open the index.html file in Chrome or Microsoft Edge browser
1516

@@ -79,7 +80,17 @@ Requests:
7980
* from the GoDice class (instance).
8081
*/
8182
getBatteryLevel()
82-
```
83+
```
84+
85+
```javascript
86+
/**
87+
* Sets the die type for the die value calculations, Use GoDice.diceTypes.X for die type.
88+
* Supported dice types (Shells): D6, D20, D10, D10X, D4, D8, D12
89+
* Default die type is D6 (when not calling this function)
90+
* @param {ENUM} GoDice.diceTypes - the die type
91+
*/
92+
setDieType(GoDice.diceTypes)
93+
```
8394
8495
8596
Responses:
@@ -150,7 +161,7 @@ Events:
150161
/**
151162
* When the die is stable after a legit roll the function "onStable" will be called from the GoDice class with the following parameter:
152163
* @param {string} diceId - the die unique identifier
153-
* @param {string} value - the D6 outcome value (1-6)
164+
* @param {string} value - the die outcome value, depends on the die type, default is D6
154165
* @param {array} xyzAccRaw [x, y, z] - the acc raw data x, y, z
155166
*/
156167

@@ -160,7 +171,7 @@ Events:
160171
// die unique identifier
161172
let dieIdentifier = diceID;
162173

163-
// the D6 outcome value (1-6)
174+
// the die outcome value
164175
let dieValue = value;
165176

166177
// the acc raw values x,y,z
@@ -176,13 +187,17 @@ Events:
176187
* When the die is stable (but not flat) after a legit roll the function "onTiltStable" will be called from the GoDice class with the following parameter:
177188
* @param {string} diceId - the die unique identifier
178189
* @param {array} xyzAccRaw [x, y, z] - the acc raw data x, y, z
190+
* @param {string} value - the die outcome value, depends on the die type, default is D6
179191
*/
180192

181193
// example:
182194

183-
GoDice.prototype.onTiltStable = (diceId, xyzAccRaw) => {
195+
GoDice.prototype.onTiltStable = (diceId, xyzAccRaw, value) => {
184196
// die unique identifier
185197
let dieIdentifier = diceID;
198+
199+
// the die outcome value
200+
let dieValue = value;
186201

187202
// the acc raw values x,y,z
188203
let accX = xyzAccRaw[0];
@@ -196,7 +211,7 @@ Events:
196211
/**
197212
* When the die is stable after a "fake" roll the function "onFakeStable" will be called from the GoDice class with the following parameter:
198213
* @param {string} diceId - the die unique identifier
199-
* @param {string} value - the D6 outcome value (1-6)
214+
* @param {string} value - the die outcome value, depends on the die type, default is D6
200215
* @param {array} xyzAccRaw [x, y, z] - the acc raw data x, y, z
201216
*/
202217

@@ -206,7 +221,7 @@ Events:
206221
// die unique identifier
207222
let dieIdentifier = diceID;
208223

209-
// the D6 outcome value (1-6)
224+
// the die outcome value
210225
let dieValue = value;
211226

212227
// the acc raw values x,y,z
@@ -221,7 +236,7 @@ Events:
221236
/**
222237
* When the die is stable after a small movement (rotating from one face to different face) the function "onMoveStable" will be called from the GoDice class with the * following parameter:
223238
* @param {string} diceId - the die unique identifier
224-
* @param {string} value - the D6 outcome value (1-6)
239+
* @param {string} value - the die outcome value, depends on the die type, default is D6
225240
* @param {array} xyzAccRaw [x, y, z] - the acc raw data x, y, z
226241
*/
227242

@@ -231,7 +246,7 @@ Events:
231246
// die unique identifier
232247
let dieIdentifier = diceID;
233248

234-
// the D6 outcome value (1-6)
249+
// the die outcome value
235250
let dieValue = value;
236251

237252
// the acc raw values x,y,z
@@ -254,4 +269,4 @@ Events:
254269
// die unique identifier
255270
let dieIdentifier = diceID;
256271
};
257-
```
272+
```

0 commit comments

Comments
 (0)