<script>
function room1() {
var command = document.former.command.value;
var gotkey = document.hide.A1.value;
var dooropen = document.hide.A2.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.stats.value="You are in a room. A key is to your left and a door infront."}
{document.hide.A1.value="0"}
{document.hide.A2.value="0"}
if (command == "get key" && gotkey == "0") {document.former.info.value=x +"\n You got the key."} {document.former.inv.value=y +"\n key"} {document.hide.A1.value="1"} {document.former.stats.value="You are in a room. A door is infront of you"}
else if (command == "get key" && gotkey == "1") {document.former.info.value=x +"\n There is no key anywhere in the area"}
else if (command == "open door" && gotkey == "0") {document.former.info.value=x +"\n The door is locked"}
else if (command == "open door" && gotkey == "1" && dooropen == "0") {document.former.info.value=x +"\n You opened the door!"} {document.hide.A2.value="1"}
else if (command == "open door" && dooropen == "1") {document.former.info.value=x +"\n The door is already opened!"}
else if (command == "go door" && dooropen == "1") {document.former.info.value=x +"\n You walk into the next room."}
else if (command == "go door" && dooropen == "1") {document.former.info.value=x +"\n The door is locked."}
</script>
<script>
function room1() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.hide.aa.value="0"}
{document.hide.bb.value="0"}
if ((command == "get key") && (gotkey == "0")) {room1A()}
else if ((command == "get key") && (gotkey == "1")) {room1B()}
else if ((command == "open door") && (gotkey == "0")) {room1C()}
else if ((command == "open door") && (gotkey == "1") && (dooropen == "0")) {room1D()}
else if ((command == "open door") && (dooropen == "1")) {room1E()}
else if ((command == "go door") && (dooropen == "1")) {room1F()}
else if ((command == "go door") && (dooropen == "1")) {room1G()}
else {
room1H()
}
}
function room1A() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.info.value=x +"\n You got the key"}
{document.former.inv.value=y +"\n key}
{document.hide.aa.value="1"}
{document.former.stats.value="You are in a room. A door is infront of you"}
}
function room1B() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.info.value=x +"\n There is no key anywhere in the area"}
}
function room1C() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.info.value=x +"\n The door is locked"}
}
function room1D() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.info.value=x +"\n You opened the door!"}
{document.hide.bb.value="1"}
}
function room1E() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.info.value=x +"\n The door is already opened!"}
}
function room1F() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.info.value=x +"\n You walk into the next room."}
}
function room1G() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.info.value=x +"\n The door is locked."}
}
function room1H() {
var command = document.former.command.value;
var gotkey = document.hide.aa.value;
var dooropen = document.hide.bb.value;
var x = document.former.info.value;
var y = document.former.inv.value;
{document.former.info.value=x +"\n Invalid Command"}
}
</script>
<form name="former">
<input type="textarea" name="stats" value="You are in a room. A key is to your left and a door infront." size="84" onFocus="this.blur()">
<p>
<textarea rows="12" name="info" cols="52" onFocus="this.blur()"></textarea>
</p>
<p>
<input type="text" name="command" size="20">
</p>
<p>
<input type="button" value="Submit" onClick="room1()" name="submit">
<p><font color="#FF0000" size="4">Inventory</font>
<p>
<textarea rows="4" name="inv" value="Shoes" cols="29" onFocus="this.blur()"></textarea></form>
</form>
<form name="hide">
<input type="hidden" name="aa" value="0">
<input type="hidden" name="bb" value="0">
Instead of just saying that you need help say what your problem is, which line it's occuring on, and any other helpful information.
Anyway, the way you've designed the script is not a good. Instead of using variables and individual functions you should be using objects with arrays. This is a fairly complex script; it would probably be better if you worked on smaller scripts until you get better at javascript.
1. Line 27 Unterminated String Constant
2. I don't know arrays
3. I did start from easier scripts (password scripts, to scripts which close window/open on command, to another game similar to this, and then this harder game)
Anyway, I think I have gotten rid of all of the bugs. I now ask you to please try to locate any bugs, and post here if you find any. http://skullkillers.tripod.com/gametest.html
Bookmarks