Hallo!
Ich würde mich wirklich freuen wenn mir jemand bei meinem Problem helfen kann - ich selber habe leider nicht allzuviel Ahnung. :blush:
Es geht um das Interactive Story script: www.valeriemates.com/interactive_story.html
Und zwar erzeugt der code unter anderem eine "outline"-Seite, die die sich verästelnden Wege der Interaktiven Geschichte als verlinkte Kapitel anzeigt. Nur ab Kapitel 50 werden diese nicht mehr im "outline" angezeigt (man kann sie trotzdem noch erreichen wenn man ab Kapitel 50 die weiterführenden links zum nächsten Kapitel anklickt), und ab Kapitel 63 kann man keine neuen Kapitel mehr veröffentlichen. Das script sagt dann "Invalid chapter name".
Hier ist jetzt der Teil des codes wo sich das Problem befinden muss - ich nehme mal laienhaft an, dass es etwas damit zu tun hat, wie sich das script die Kapitelnummern berechnet. Im script selbst steht ja auch "Do some fancy formatting on the chapter numbers, so that they don't print out in scientific notation", aber ich werde daraus einfach nicht schlau. :(
Es wäre echt super falls mir jemand helfen kann!
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
# The next page of the story exists (and hasn't snuck in
# while we were writing a different new page).
# Read it in and display it.
if (!(open(STORY, "<$nextfile"))) {
print "Could not open file $nextfile to read it!<br>\n";
} else {
# Read data from story file:
$author_name = <STORY>;
$author_email = <STORY>;
$chapter_title = <STORY>;
$next_text_1 = <STORY>;
$next_text_2 = <STORY>;
chomp($author_name);
chomp($author_email);
chomp($chapter_title);
chomp($next_text_1);
chomp($next_text_2);
$chapter = 1 + $in{'chapter'};
print "<b><font size=+2>Chapter $chapter: $chapter_title</font></b><p>\n";
if (($author_name ne "") || ($author_email ne "")) {
$author = "$author_name
<a href=\"mailto:$author_email\">$author_email</a>";
} else {
$author= "an anonymous author";
}
print "<center><i>this page added by $author</i></center><p>\n";
while (<STORY>) {
print $_;
}
$next_num_1 = 2 * $in{'next'};
$next_num_2 = $next_num_1 + 1;
# Do some fancy formatting on the chapter numbers, so that they
# don't print out in scientific notation. This only becomes
# important when users enter chapters more than 50 levels deep. !!!
$next_num_1 = format_chapter_number($next_num_1);
$next_num_2 = format_chapter_number($next_num_2);
print <<EOF;
<p>
<hr>
<p>
What do you do now?
<p>
<table>
<tr>
<td valign=bottom>
<a href="story.pl?next=$next_num_1&chapter=$chapter"><img
src="$image_url/pink_story_arrow.gif" width="15" height="16" alt=""
border=0></a>
</td>
<td valign=top>
<a href="story.pl?next=$next_num_1&chapter=$chapter">$next_text_1</a>
</td>
</tr>
<tr>
<td valign=bottom>
<a href="story.pl?next=$next_num_2&chapter=$chapter"><img
src="$image_url/green_story_arrow.gif" width="15" height="16" alt=""
border=0></a>
</td>
<td valign=top>
<a href="story.pl?next=$next_num_2&chapter=$chapter">$next_text_2</a>
</td>
</tr>
</table>
<p>
EOF
}
} elsif ($in{'submit'} eq "") {
# The next page of the story doesn't exist.
# Ask the user to enter it.
print <<EOF;
<h1>Your Turn</h1>
You have reached the end of the story action.
<p>Now it's your turn to enter what happens next in the story.
<blockquote>
<form action="story.pl" method="post">
<b>Your name: </b> (optional) <br>
<input type="text" name="author_name" size=50 maxlength=50> <br>
<b>Your email address: </b> (optional) <br>
<input type="text" name="author_email" size=50 maxlength=50> <br>
<br><b>The next part of the story:</b> <br>
<textarea rows=10 cols=60 name="story_text" wrap="physical"></textarea> <br>
<br>
<b>The two things the reader can do next: </b><br>
Option One: <input type="text" name="next_text_1" size=60 maxlength=100> <br>
Option Two: <input type="text" name="next_text_2" size=60 maxlength=100> <br>
<br>
<b>A title for your chapter:</b> <br>
<input type="text" name="chapter_title" size=60 maxlength=80> <br>
<input type="hidden" name="next" value="$in{'next'}">
<input type="hidden" name="chapter" value="$in{'chapter'}">
<br>
<input type="submit" name="submit" value="Enter it!">
</input>
</form>
</blockquote>
EOF
} else {
# The user has entered a next page.
# See if it's okay. If it is, save it.
# Convert newlines to <br> html in the story:
$in{story_text} =~ s/\n/<br>\n/gio;
# Don't let people create any old file:
$prev_page_num = format_chapter_number(int($in{'next'} / 2));
if (($in{'next'} ne "1") && (! -e "$story_dir/$prev_page_num.txt")) {
print "<b>Invalid chapter name!</b><br>";
# Check for any missing text:
} elsif ($in{story_text} eq "") {
print "<b>Please write the description of what happens now.</b><br>";
print "Press your browser's 'Back' button to add it.";
} elsif (($in{next_text_1} eq "") || ($in{next_text_2} eq "")) {
print "<b>Please enter two options for what the user can do next.</b><br>";
print "Press your browser's 'Back' button to add this.";
} elsif ($in{chapter_title} eq "") {
print "<b>Please enter a title for your chapter.</b><br>";
print "Press your browser's 'Back' button to add it.";
} else {
# Make sure file is still available.
if (-e $nextfile) {
print <<EOF;
<p><b>Ooops! Someone else entered this section of the story
while you were typing. I can't enter your section</b>.
<p><center>
<a href="story.pl?next=$in{'next'}&chapter=$in{'chapter'}&reload=$bignum">See it</a>
</center>
<p><b><blockquote><blockquote><blockquote><blockquote>After you select the
"See it" link, you may need to press the 'Reload' button on your browser
to see what the other person
entered.</blockquote></blockquote></blockquote></blockquote></b><br>
EOF
} else {
# Save it!
if (!open(STORY, ">$nextfile")) {
print "Oh oh. I couldn't open the file '$nextfile' to save your
section. (Error: $!) So I didn't save it.\n";
} else {
print STORY "$in{author_name}\n";
print STORY "$in{author_email}\n";
print STORY "$in{chapter_title}\n";
print STORY "$in{next_text_1}\n";
print STORY "$in{next_text_2}\n";
print STORY "$in{story_text}\n";
close(STORY);
print <<EOF;
Your addition to the story has been saved.