-
Notifications
You must be signed in to change notification settings - Fork 0
/
TWF_DASH_HELPER.js
756 lines (640 loc) · 21 KB
/
TWF_DASH_HELPER.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
//
// TWF Dash JavaScript Extensions
// Please place this file under 'C:\\Program Files (x86)\Simhub\JavascriptExtensions'
//
function changed(delay, value) {
root['time'] = timespantoseconds($prop('SystemInfoPlugin.Uptime'));
root['oldstate'] = root['oldstate'] == null ? value : root['newstate'];
root['newstate'] = value;
if (root['newstate'] != root['oldstate']) {
root['triggerTime'] = root['time'];
}
return root['triggerTime'] == null ? false : root['time'] - root['triggerTime'] <= delay / 1000;
}
function isincreasing(delay, value) {
root['time'] = timespantoseconds($prop('SystemInfoPlugin.Uptime'));
root['oldstate'] = root['oldstate'] == null ? value : root['newstate'];
root['newstate'] = value;
if (root['newstate'] > root['oldstate']) {
root['triggerTime'] = root['time'];
}
return root['triggerTime'] == null ? false : root['time'] - root['triggerTime'] <= delay / 1000;
}
function isdecreasing(delay, value) {
root['time'] = timespantoseconds($prop('SystemInfoPlugin.Uptime'));
root['oldstate'] = root['oldstate'] == null ? value : root['newstate'];
root['newstate'] = value;
if (root['newstate'] < root['oldstate']) {
root['triggerTime'] = root['time'];
}
return root['triggerTime'] == null ? false : root['time'] - root['triggerTime'] <= delay / 1000;
}
function twf_read_setting(setting, novalue) {
const settings_file = readtextfile('./JavascriptExtensions/TWF_DASH_CONFIG.json')
const config = JSON.parse(settings_file);
setting_key = setting
let setting_value = config[setting_key];
if (!config || setting_value == null) {
return novalue
} else {
return setting_value
}
}
function twf_read_setting_exists(setting, yes, no) {
const settings_file = readtextfile('./JavascriptExtensions/TWF_DASH_CONFIG.json')
const config = JSON.parse(settings_file);
setting_key_e = setting
let setting_value = config[setting_key_e];
if (!config || setting_value != null) {
return yes
} else {
return no
}
}
function twf_read_setting_equals(setting, value, yes, no) {
const settings_file = readtextfile('./JavascriptExtensions/TWF_DASH_CONFIG.json')
const config = JSON.parse(settings_file);
setting_key_eq = setting
let setting_value = config[setting_key_eq];
if (!config || !setting_value) {
return no
} else if (setting_value == value) {
return yes
} else {
return no
}
}
function twf_get_driver_name_by_position(position) {
if (drivername(position) != null) {
return twf_format_driver_name(drivername(position));
} else {
return ''
}
}
function twf_get_player_name() {
if ($prop('PlayerName') != null) {
return twf_format_driver_name($prop('PlayerName'));
} else {
return ''
}
}
function twf_format_driver_name(name) {
n = name.toUpperCase();
fn = n.split(' ');
return fn[0].substr(0, 1) + ' ' + fn[fn.length - 1]
}
function twf_get_ui_color(ui) {
ui_preference = twf_read_setting("ui_color", 1);
setting_key_color = ui;
const color_codes_1 = {
"border": "#FF233E49",
"tablebg": "#72233E49",
"rpmbg": "#FF233E49",
"spotterbg": "#FF061217",
"spottergauge": "#FFFF8C00",
"dimbg": "#FF061217",
"positionbg": "#FFFFFF",
"positionbgplayer": "#FFFFD700",
"bodytext": "#FFFFFF",
"pagination": "#FF477384",
"infobg": "#FF152B33"
}
const color_codes_2 = {
"border": "#FF222222",
"tablebg": "#6E3C3C3C",
"rpmbg": "#FF222222",
"spotterbg": "#FF111111",
"spottergauge": "#FFFF8C00",
"dimbg": "#FF111111",
"positionbg": "#FFFFFF",
"positionbgplayer": "#FFFFD700",
"bodytext": "#FFFFFF",
"pagination": "#FF222222",
"infobg": "#FF222222"
}
const color_codes_3 = {
"border": "#FF333333",
"tablebg": "#6E3C3C3C",
"rpmbg": "#FF222222",
"spotterbg": "#FF111111",
"spottergauge": "#FFFF8C00",
"dimbg": "#FF111111",
"positionbg": "#FFFFFF",
"positionbgplayer": "#FFFFD700",
"bodytext": "#FFFFFF",
"pagination": "#FF222222",
"infobg": "#FF222222"
}
const color_codes_4 = {
"border": twf_read_setting("ui_custom_color", "#FF333333"),
"tablebg": twf_read_setting("ui_custom_bgcolor", "#6E3C3C3C"),
"rpmbg": "#FF222222",
"spotterbg": "#FF111111",
"spottergauge": "#FFFF8C00",
"dimbg": "#FF111111",
"positionbg": "#FFFFFF",
"positionbgplayer": "#FFFFD700",
"bodytext": "#FFFFFF",
"pagination": "#FF222222",
"infobg": "#FF222222"
}
if (ui_preference == 1) {
return color_codes_1[setting_key_color];
}
if (ui_preference == 2) {
return color_codes_2[setting_key_color];
} if (ui_preference == 3) {
return color_codes_3[setting_key_color];
}
if (ui_preference == 4) {
return color_codes_4[setting_key_color];
}else {
return color_codes_1[setting_key_color];
}
}
function twf_get_ui_bg(ui) {
ui_preference = twf_read_setting("ui_color", 1);
setting_key_bg = ui;
const images_1 = {
"delta": "deltabg",
"deltalap": "deltalapbg",
"mfd1left": "bgmfd1left",
"mfd2left": "bgmfd2left",
"mfd1right": "bgmfd1right",
"mfd2right": "bgmfd2right",
"contextualleft": "bgmfdcontextualleft",
"contextualright": "bgmfdcontextualright",
"bg": "bgmain",
"carsettings": "bgbottom",
"dashlights": "deltabg"
}
const images_2 = {
"delta": "deltabgblack",
"deltalap": "deltalapbgblack",
"mfd1left": "bgmfd1leftblack",
"mfd2left": "bgmfd2leftblack",
"mfd1right": "bgmfd1rightblack",
"mfd2right": "bgmfd2rightblack",
"contextualleft": "bgmfdcontextualleft",
"contextualright": "bgmfdcontextualright",
"bg": "bgmainblack",
"carsettings": "bgbottomblack",
"dashlights": "deltabgblack"
}
const images_3 = {
"delta": " ",
"deltalap": " ",
"mfd1left": " ",
"mfd2left": " ",
"mfd1right": " ",
"mfd2right": " ",
"contextualleft": "bgmfdcontextualleft",
"contextualright": "bgmfdcontextualright",
"bg": " ",
"carsettings": " ",
"dashlights": " "
}
const images_4 = {
"delta": "deltabgblack",
"deltalap": "deltalapbgblack",
"mfd1left": "bgmfd1leftblack",
"mfd2left": "bgmfd2leftblack",
"mfd1right": "bgmfd1rightblack",
"mfd2right": "bgmfd2rightblack",
"contextualleft": "bgmfdcontextualleft",
"contextualright": "bgmfdcontextualright",
"bg": "bgmainblack",
"carsettings": "bgbottomblack",
"dashlights": "deltabgblack"
}
if (ui_preference == 1) {
return images_1[setting_key_bg];
}
if (ui_preference == 2) {
return images_2[setting_key_bg];
} if (ui_preference == 3) {
return images_3[setting_key_bg];
} if (ui_preference == 4) {
return images_4[setting_key_bg];
}else {
return images_1[setting_key_bg];
}
}
function twf_player_best_time_color() {
if ($prop('BestLapOpponentPosition') !== null) {
var bestlapdriverposition = $prop('BestLapOpponentPosition') + 1
if (isplayer(bestlapdriverposition)) {
return '#C500CE'
} else {
if (timespantoseconds($prop('BestLapTime')) < 1) {
return '#000000'
} else {
return '#008200'
}
}
}
}
function twf_rpm_gauge_color() {
color = twf_read_setting("ui_color", 1)
if ($prop('DataCorePlugin.GameData.CarSettings_RPMRedLineReached') == true) {
return 'red'
} else if ($prop('DRSEnabled')==1){
return 'lime'
} else {
if (color == 1) {
return "deepskyblue"
}
if (color == 2) {
return "white"
}
if (color == 3) {
return "white"
} else {
return "deepskyblue"
}
}
}
function twf_get_laps_in_stint(){
if (root["lapsinstint"] == null) {
root["lapsinstint"] = $prop('CompletedLaps')
}
if($prop('IsInPitLane')>0){
root["lapsinstint"] = $prop('CompletedLaps')
}
return $prop('CompletedLaps') - root["lapsinstint"]
}
function twf_current_lap_color() {
if (root["invalidlap"] == null) {
root["invalidlap"] = 0
}
if ($prop('DataCorePlugin.CurrentGame') == "IRacing") {
if ($prop('DataCorePlugin.GameRawData.Telemetry.PlayerTrackSurface') == 0) {
root["invalidlap"]++
}
}
if ($prop('DataCorePlugin.CurrentGame') == "Automobilista2") {
if ($prop('GameRawData.mLapInvalidated') == true) {
root["invalidlap"]++
}
}
if ($prop('DataCorePlugin.CurrentGame') == "AssettoCorsaCompetizione") {
if ($prop('DataCorePlugin.GameRawData.Graphics.isValidLap') == false) {
root["invalidlap"]++
}
}
if (timespantoseconds($prop('CurrentLapTime')) < 1) {
root["invalidlap"] = 0
}
if (root["invalidlap"] > 0) {
return '#FFFF0000'
} else {
return '#FFFFFF'
}
}
function twf_predicted_lap_color() {
var predicted = $prop('PersistantTrackerPlugin.EstimatedLapTime')
if ($prop('DataCorePlugin.CurrentGame') == 'AssettoCorsaCompetizione') {
if (timespantoseconds($prop('BestLapTime')) > 0) {
predicted = $prop('GameRawData.Graphics.EstimatedLapTime')
}
}
if ($prop('BestLapOpponentPosition') !== null) {
var overallbestlap = timespantoseconds(driverbestlap($prop('BestLapOpponentPosition') + 1))
var predictedseconds = timespantoseconds(predicted)
var sessionbest = timespantoseconds($prop('BestLapTime'))
if (predictedseconds == 0) {
return '#666666'
} else if (predictedseconds == overallbestlap) {
return '#C500CE'
} else if (predictedseconds <= sessionbest) {
return '#FF01ad01'
} else {
return '#FFFFD700'
}
}
}
function twf_get_session_best_delta(options) {
currentgame = $prop('DataCorePlugin.CurrentGame')
delta = 0
if ($prop('DataCorePlugin.CurrentGame') == 'RFactor2') {
if (timespantoseconds($prop('DataCorePlugin.GameData.BestLapTime')) == 0) {
delta = 0
} else {
delta = timespantoseconds($prop('PersistantTrackerPlugin.EstimatedLapTime')) - timespantoseconds($prop('DataCorePlugin.GameData.BestLapTime'))
}
} else {
delta = $prop('PersistantTrackerPlugin.SessionBestLiveDeltaSeconds')
}
if (options == "color") {
return delta
} else {
if(delta>0){
return "+"+delta.toFixed(2)
} else {
return delta.toFixed(2)
}
// return Math.abs(delta)
}
}
function twf_get_alltime_best_delta(options) {
currentgame = $prop('DataCorePlugin.CurrentGame')
delta = 0
if ($prop('DataCorePlugin.CurrentGame') == 'RFactor2') {
delta = "NA"
} else {
delta = $prop('PersistantTrackerPlugin.AllTimeBestLiveDeltaSeconds')
}
if (options == "color") {
return delta
} else {
if(delta>0){
return "+"+delta.toFixed(2)
} else {
return delta.toFixed(2)
}
// return Math.abs(delta)
}
}
function twf_get_lastlap_delta(options) {
delta = 0
predicted = timespantoseconds(twf_predicted_lap_time())
lastlap = timespantoseconds($prop('LastLapTime'))
if (lastlap>0 && predicted > 0) {
delta = predicted - lastlap
}
if (options == "color") {
return delta
} else {
if(delta>0){
return "+"+delta.toFixed(2)
} else {
return delta.toFixed(2)
}
//return Math.abs(delta)
}
}
function twf_get_live_delta(options){
}
function twf_predicted_lap_time() {
var predicted = $prop('PersistantTrackerPlugin.EstimatedLapTime')
if ($prop('DataCorePlugin.CurrentGame') == 'AssettoCorsaCompetizione') {
if (timespantoseconds($prop('BestLapTime')) > 0) {
predicted = secondstotimespan($prop('GameRawData.Graphics.iEstimatedLapTime') / 1000)
}
}
return predicted
}
function twf_last_lap_color(color) {
if (color != null) {
text_color = color
} else {
text_color = "#FFFFD700"
}
if ($prop('BestLapOpponentPosition') !== null) {
var overallbestlap = timespantoseconds(driverbestlap($prop('BestLapOpponentPosition') + 1))
var lastlap = timespantoseconds($prop('LastLapTime'))
var sessionbest = timespantoseconds($prop('BestLapTime'))
if (lastlap == 0) {
return text_color
} else if (lastlap == overallbestlap) {
return '#FFFF00FF'
} else if (lastlap == sessionbest) {
return '#FF01ad01'
} else {
return text_color
}
}
}
function twf_best_lap_color() {
if ($prop('BestLapOpponentPosition') !== null) {
var bestlapdriverposition = $prop('BestLapOpponentPosition') + 1
if (isplayer(bestlapdriverposition)) {
return '#FFFF00FF'
} else {
if (timespantoseconds($prop('BestLapTime')) < 1) {
return '#666666'
} else {
return '#FF01ad01'
}
}
}
}
function twf_border_radius() {
return twf_read_setting("ui_radius", 6)
}
function twf_contextual_damage() {
damage1 = 0
if ($prop('DataCorePlugin.CurrentGame') == 'Automobilista2') {
damage1 = Math.round(($prop('CarDamage1'))) + Math.round($prop('CarDamage2'))
return changed(5000, damage1)
} else
if ($prop('DataCorePlugin.CurrentGame') == 'AssettoCorsa') {
damage1 = isnull($prop('CarDamage1'), 0)
return changed(5000, damage1)
} else
if ($prop('DataCorePlugin.CurrentGame') == 'AssettoCorsaCompetizione') {
damage1 = isnull($prop('DataCorePlugin.GameData.CarDamage5'), 0)
return changed(5000, damage1)
} else {
damage1 = isnull($prop('DataCorePlugin.GameData.CarDamage5'), 0)
return changed(5000, damage1)
}
}
function twf_get_mfd(mfdlocation, mfdname) {
currentgame = $prop('DataCorePlugin.CurrentGame')
const mfd_acc = {
"tyres": 1,
"damage": 1,
"status": 0,
"timings": 1,
"timingsandgap": 1,
"gap": 1,
"relative": 1,
"class": 1,
"map": twf_read_setting("mfd_map", 1)
}
const mfd_ir = {
"tyres": 1,
"damage": 0,
"status": 1,
"timings": 1,
"timingsandgap": 1,
"gap": 1,
"relative": 1,
"class": 1,
"map": twf_read_setting("mfd_map", 1)
}
const mfd_all = {
"tyres": 1,
"damage": 1,
"status": 1,
"timings": 1,
"timingsandgap": 1,
"gap": 1,
"relative": 1,
"class": 1,
"map": twf_read_setting("mfd_map", 1)
}
const mfd_ac = {
"tyres": 1,
"damage": 1,
"status": 1,
"timings": 1,
"timingsandgap": 1,
"gap": 1,
"relative": 1,
"class": 1,
"map": 0
}
if (currentgame == "AssettoCorsaCompetizione") {
return mfd_acc[mfdname]
}
if (currentgame == "IRacing") {
return mfd_ir[mfdname]
} if (currentgame == "AssettoCorsa") {
return mfd_ac[mfdname]
}else {
return mfd_all[mfdname]
}
}
function twf_refuel(fueltype) {
fuelconsumption = (Math.ceil($prop('DataCorePlugin.Computed.Fuel_LitersPerLap') * 10) / 10).toFixed(1)
fuelremainingtime = timespantoseconds($prop('DataCorePlugin.Computed.Fuel_RemainingTime'))
fuelremaininglaps = $prop('DataCorePlugin.Computed.Fuel_RemainingLaps')
sessionremaininglaps = $prop('RemainingLaps')
sessionremainingtime = timespantoseconds($prop('SessionTimeLeft'))
fuelonboard = $prop('Fuel')
bestlaptime = timespantoseconds($prop('BestLapTime'))
avglaptime = (timespantoseconds($prop('PersistantTrackerPlugin.PreviousLap_00')) +
timespantoseconds($prop('PersistantTrackerPlugin.PreviousLap_01')) + timespantoseconds($prop('PersistantTrackerPlugin.PreviousLap_02'))) / 3
calculationtime = 0
if (timespantoseconds($prop('PersistantTrackerPlugin.PreviousLap_00')) < 1 || timespantoseconds($prop('PersistantTrackerPlugin.PreviousLap_01')) < 1 || timespantoseconds($prop('PersistantTrackerPlugin.PreviousLap_02')) < 1) {
calculationtime = bestlaptime + 0.2
} else {
calculationtime = avglaptime
}
var fueltoadd = 'NA'
var fueltoaddbylap = 0
if ($prop('CurrentLap') > 1) {
if (sessionremaininglaps > 0 && fuelremaininglaps !== null) {
fueltoadd = (((sessionremaininglaps - fuelremaininglaps) + 1) * fuelconsumption) + 1
} else {
if (fuelremainingtime !== null && fuelremainingtime > 0) {
fueltoadd = ((sessionremainingtime / calculationtime + 1) * fuelconsumption - fuelonboard) + 1
}
}
}
if (fueltype == "atfinish") {
if (fueltoadd < 0) {
return fueltoadd
} else {
return 'NA'
}
} else {
if (fueltoadd > 0) {
return fueltoadd
} else {
return 'NA'
}
}
}
function twf_laptimer_blink() {
if (twf_read_setting("laptimer_blinkonnewlap", 1) == 1) {
if (changed(5000, $prop('LastLapTime'))) {
return 1
} else {
return 0
}
}
}
function twf_opponent_has_fastest_lap() {
var bestlapdriverposition = $prop('BestLapOpponentPosition') + 1
if ($prop('BestLapOpponentPosition') !== null) {
if (isplayer(bestlapdriverposition)) {
return 0
} else {
return 1
}
} else {
return 0
}
}
function twf_class_driver_name_repeater(currentindex) {
driverposition = currentindex
if (drivername(driverposition) != null) {
return twf_format_driver_name(drivername(driverposition));
} else {
return ''
}
}
function twf_relative_driver_name_repeater(numofcars, currentindex) {
numberofcarsahead = numofcars
numofcarspositive = Math.abs(numofcars)
repindex = currentindex
driverraceposition = ''
if (repindex <= numofcarspositive) {
driverrelposition = Math.abs(numberofcarsahead + repindex)
driverraceposition = $prop('PersistantTrackerPlugin.DriverAhead_0' + driverrelposition + '_Position')
} else if (repindex == (numofcarspositive + 1)) {
driverraceposition = $prop('Position')
return twf_get_player_name()
} else if (repindex > (numofcarspositive + 1)) {
driverrelposition = Math.abs(numberofcarsahead + repindex - 2)
driverraceposition = $prop('PersistantTrackerPlugin.DriverBehind_0' + driverrelposition + '_Position')
}
return twf_get_driver_name_by_position(driverraceposition)
}
function twf_relative_driver_color_repeater(numofcars, currentindex) {
numberofcarsahead = numofcars
numofcarspositive = Math.abs(numofcars)
repindex = currentindex
driverraceposition = ''
if (repindex <= numofcarspositive) {
var driverrelposition = Math.abs(numberofcarsahead + repindex)
driverraceposition = $prop('PersistantTrackerPlugin.DriverAhead_0' + driverrelposition + '_LapsToPlayer')
} else if (repindex == (numofcarspositive + 1)) {
return '#FFFFE04C'
} else if (repindex > (numofcarspositive + 1)) {
var driverrelposition = Math.abs(numberofcarsahead + repindex - 2)
driverraceposition = $prop('PersistantTrackerPlugin.DriverBehind_0' + driverrelposition + '_LapsToPlayer')
}
if (driverraceposition < 0) {
return '#FF00BFFF'
} else if (driverraceposition > 0) {
return '#FFffa500'
} else {
return '#FFFFFFFF'
}
}
function twf_class_driver_color_repeater(currentindex) {
driverposition = currentindex
var playerposition = $prop('Position');
var driverlap = drivercurrentlap(driverposition)
var playerlap = $prop('CurrentLap')
var sessionlap = drivercurrentlap(1)
if (isplayer(driverposition)) {
return '#FFE04C'
} else {
if (sessionlap > 1) {
if (sessionlap - driverlap > 1) {
return '#00BFFF'
} else {
return '#FFFFFF'
}
} else {
return '#FFFFFF'
}
}
}
function twf_player_preferred_name() {
preferred_name = twf_read_setting(your_name, "");
return preferred_name;
}
function twf_player_preferred_number() {
preferred_name = twf_read_setting(your_number, "");
return player_number
}
function twf_player_preferred_color() {
preferred_name = twf_read_setting(your_color, "");
return player_color
}