-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathPlay Counter.i7x
55 lines (42 loc) · 1.71 KB
/
Play Counter.i7x
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
Play Counter (for Glulx only) by Daniel Stelzer begins here.
"Allows an author to check how many times their story has been played."
Table of Play Count
count
0 [play count]
0 [ending count]
0 [final ending count]
To decide which number is the play count:
select row 1 in the Table of Play Count;
decide on the count entry.
To decide which number is the ending count:
select row 2 in the Table of Play Count;
decide on the count entry.
To decide which number is the final ending count:
select row 3 in the Table of Play Count;
decide on the count entry.
To read count data:
read the File of Play Count into the Table of Play Count.
To write count data:
write the File of Play Count from the Table of Play Count.
When play begins:
read count data.
The first-turn flag is initially true.
After doing anything:
now the first-turn flag is false;
select row 1 in the Table of Play Count;
increment the count entry;
write count data;
continue the action.
When play ends:
select row 2 in the Table of Play Count;
increment the count entry;
if the story has ended finally:
select row 3 in the Table of Play Count;
increment the count entry;
write count data.
Play Counter ends here.
---- DOCUMENTATION ----
To use this extension, you must add a line to your story defining the filename to use.
The File of Play Count is called "YOURSTORYTITLEplaycount".
(Replace YOURSTORYTITLE with your title.)
Then you can check how many times the story has been played by referring to "the play count" (which is incremented whenever the story is started and goes past the first move), "the ending count" (which is incremented whenever the story ends), and "the final ending count" (which is incremented whenever the story ends finally).