Error running script - help please

SarahJay
Alright, I made a variety of changes, and now my game has an error every time it starts. I don't know what I changed, but when you click "go east" the first time, the error code pops up. However, the second time you do it it works.

Help?
-----

You are in a Ship.
You can see a box.
You can go east.

> east
Error running script: Index and length must refer to a location within the string. Parameter name: length

> east
You are in a Main Lobby.
You can see a Couch, a Trash Can, a Vending Machine and a Television.
You can go west or south.
This is a nice lobby where residents and guests to the base may relax and have a snack.

sgreig
As I mentioned in your previous post where you posted the example file, what are you trying to do with all of those scripts and timers placed on the exits? If you could explain what gameplay behavior you're trying to accomplish, we would be in a better position to help you figure it out.

SarahJay
Well, i'm not sure what caused this one to occur. But I have the code on this message (it wouldn't let me add it as an attachment for some reason). I think I found a way to use the vending machine for now too, but it's a very simple solution.

<asl version="500">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Adventures in Space">
<defaultbackground>Black</defaultbackground>
<defaultforeground>White</defaultforeground>
<defaultlinkforeground>Red</defaultlinkforeground>
</game>
<object name="Landing Bay 1">
<inherit name="editor_room" />
<description>This is the main landing bay for personal transportation to and from the moon base.</description>
<alias type="string"></alias>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<object name="Ship">
<inherit name="editor_room" />
<description type="string"></description>
<descprefix>You are in</descprefix>
<object name="player">
<inherit name="defaultplayer" />
<gender>male</gender>
<scenery />
</object>
<object name="Magical Box">
<alias>Pandora's box</alias>
<alt>box; the box; damn box; magical box</alt>
<dropmsg>Ouch! It hit your foot. Damn box...</dropmsg>
<take />
<takemsg>You pick up the box and begin to feel dizzy. Damn box.</takemsg>
<Take>You pick up the box and begin to feel dizzy. Damn box.</Take>
<Lookat>You look at the box and get a headache. Damn box.</Lookat>
<shake>You shake the box and accidentally hit yourself in the head. Damn box.</shake>
<Kick>You try to kick the box and you fall on your face instead. Damn box.</Kick>
<displayverbs>Look at; Take</displayverbs>
<Shake>You shake the box and accidentally hit yourself in the head. Damn box.</Shake>
<usedefaultprefix type="boolean">false</usedefaultprefix>
</object>
<exit alias="east" to="Landing Bay 1">
<inherit name="eastdirection" />
</exit>
</object>
<exit alias="west" to="Ship">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="Lobby 1">
<inherit name="eastdirection" />
</exit>
</object>
<object name="Communication Area">
<inherit name="editor_room" />
<description>This is the main communication from the base to Earth. There are many computers and conference areas throughout the room.</description>
<exit alias="north" to="Lobby 1">
<inherit name="northdirection" />
</exit>
<exit alias="west" to="Computer Lab">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="Recreational Area">
<inherit name="eastdirection" />
<locked />
<lockmessage>Looks like the recreational area was destroied in a terrible accident. </lockmessage>
<lookonly />
<look>The recreational area must have been destroyed in a terrible accident. </look>
</exit>
<exit alias="south" to="Lobby 2">
<inherit name="southdirection" />
</exit>
<object name="Nice chair" />
<object name="Nice lounge" />
<object name="Nice communication terminals" />
</object>
<object name="Housing">
<inherit name="editor_room" />
<description>This is where the residents sleep at night. The rooms are very small.</description>
<exit alias="west" to="Lobby 1">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="Dining">
<inherit name="eastdirection" />
</exit>
<object name="Bed">
<Sit type="string"></Sit>
<Sleep>You lay down to rest for a few minutes.</Sleep>
</object>
<object name="Dresser">
<search>You search the dresser carefully - there are certain things you don't want to touch in another man's dresser.</search>
<Lookat>This is a modern dresser with chrome handles. Pft... Chrome...</Lookat>
</object>
<object name="Book shelf">
<Lookat>There are dozens of books on various subjects here.</Lookat>
<search>You search the bookcase and find a secret passage!!! Jk, it's just a bookshelf.</search>
</object>
</object>
<object name="Biodome">
<inherit name="editor_room" />
<description>Hundreds of species of plantlife grow in here to supply all the food for the residents of the moon base.</description>
<exit alias="south" to="Lobby 1">
<inherit name="southdirection" />
</exit>
<object name="Trees">
<look type="string"></look>
</object>
<object name="Plants" />
<object name="Garden" />
</object>
<object name="Ruins">
<inherit name="editor_room" />
<description>You should finish exploring the base - the ruins are very dangerous.</description>
<exit alias="north" to="Main Lab">
<inherit name="northdirection" />
</exit>
<object name="Ruin stuff">
<look>There is something ominous here...</look>
<Lookat type="string"></Lookat>
</object>
</object>
<object name="Lobby 1">
<inherit name="editor_room" />
<description>This is a nice lobby where residents and guests to the base may relax and have a snack. </description>
<alias>Main Lobby</alias>
<exit alias="west" to="Landing Bay 1">
<inherit name="westdirection" />
</exit>
<exit alias="north" to="Biodome">
<inherit name="northdirection" />
<lookonly />
<look>The biodome was destroyed in a terrible accident.</look>
</exit>
<exit alias="east" to="Housing">
<inherit name="eastdirection" />
<lookonly />
<look>The housing area must have been destroyed in a terrible accident</look>
</exit>
<exit alias="south" to="Communication Area">
<inherit name="southdirection" />
</exit>
<object name="Couch">
<inherit name="container_closed" />
<displayverbs>Look at; Search</displayverbs>
<Lookat>The couch looks well used. Who knows what could be burried under the cushions...</Lookat>
<sit>You sit down for a few moments and feel refreshed.</sit>
<listchildren />
<search type="script">
msg ("You search the couch and find a shiny new coin. What luck!")
MoveObject (Coin, player)
</search>
<object name="Coin">
<Take>You pick up the coin. You're rich!</Take>
<look>I bet it has some money left on it. This would be good to hold onto.</look>
<take />
<takemsg>You pick up the shiny coin. You're rich!</takemsg>
<alias>Money card</alias>
</object>
</object>
<object name="Trash Can">
<inherit name="container_closed" />
<hidechildren />
<listchildren />
<Lookat>It's filled with garbage. </Lookat>
<displayverbs>Look at; Open; Close</displayverbs>
<alt>can</alt>
<onopen type="script">
if (Contains (Trash Can,Garbage)) {
msg ("It smells terrible... When did you become an outer space janitor?")
}
else {
msg ("When did you become an outer space janitor?")
}
</onopen>
<object name="Garbage">
<inherit name="editor_object" />
<take />
<ontake type="script">
MoveObject (Garbage, player)
</ontake>
<takemsg>Eww, it stinks.</takemsg>
<Take type="script">
MoveObject (Garbage, player)
msg ("For some reason, you decide to pick up the garbage and put it in your bag. ")
</Take>
</object>
</object>
<object name="Vending Machine">
<inherit name="container_lockable" />
<inherit name="container_closed" />
<listchildren />
<isopen type="boolean">false</isopen>
<autounlock />
<nokeymessage>The screen says "insert one coin". Perhaps you should search for a coin to use...</nokeymessage>
<unlockmessage>Wow, I can take up to three snacks for just this one coin! What luck!</unlockmessage>
<lockmessage>You push the buttons but nothing happens.</lockmessage>
<canlockopen type="boolean">false</canlockopen>
<Lookat>You see some snacks inside. Well, you are a little hungry...</Lookat>
<shake>You shake the machine as hard as you can, but the bar is still there. Perhaps there is another way to obtain it...</shake>
<displayverbs>Look at; Open; Close</displayverbs>
<description>A poorly stocked vending machine sits in the lobby.</description>
<autoopen />
<key type="object">Coin</key>
<useon type="scriptdictionary">
<item key="Coin">
msg ("coin script")
</item>
</useon>
<object name="Marsbar">
<inherit name="container_closed" />
<alt>Candy; Candy Bar</alt>
<displayverbs>Look at; Take; Eat</displayverbs>
<eat type="script">
msg ("Om nom nom")
msg ("Ouch! There's something hard inside...... ")
msg ("Who would put a keycard in there?")
MoveObject (Key card, player)
MoveObject (Marsbar, Vending Machine)
</eat>
<Lookat>Well, since i'm in space, I may as well have an authentic dining experience.</Lookat>
<listchildren />
<hidechildren type="boolean">false</hidechildren>
<itemnumber type="int">101</itemnumber>
<alias>Mars Bar</alias>
<take type="script">
MoveObject (Marsbar, player)
</take>
<openmsg>There is something inside besides the candy...</openmsg>
<isopen type="boolean">false</isopen>
<look type="script">
msg ("A Mars Bar, item number " + marsbar.itemnumber + " on the vending machine.")
</look>
<onopen type="script">
CloneObjectAndMove (Key card, player)
</onopen>
<use type="script">
msg ("Om nom *CRUNCH* Ouch! How did a keycard get in here?")
MoveObject (Key card, player)
MoveObject (Marsbar, Vending Machine)
</use>
<useon type="scriptdictionary" />
<Take type="script">
MoveObject (Marsbar, player)
</Take>
<object name="Key card">
<inherit name="editor_object" />
<alt>card; key</alt>
<Lookat type="string"></Lookat>
<take />
</object>
</object>
<object name="Moonpie">
<inherit name="editor_object" />
<alt>good candy; om nom</alt>
<eat>om nom nom</eat>
<itemnumber type="int">102</itemnumber>
<alias>Moon Pie</alias>
<take type="script">
MoveObject (Moonpie, player)
</take>
<look type="script">
msg ("A Moon Pie, item number " + moonpie.itemnumber + " on the vending machine.")
</look>
<use type="script">
msg ("Om nom nom")
MoveObject (Moonpie, Vending Machine)
</use>
<Take type="script">
MoveObject (Moonpie, player)
</Take>
</object>
<object name="Sunchips">
<inherit name="editor_object" />
<alt>chips</alt>
<eat>om nom nom</eat>
<itemnumber type="int">103</itemnumber>
<alias>Sun Chips</alias>
<take type="script">
MoveObject (Sunchips, player)
</take>
<look type="script">
msg ("A bag of Sun Chips, item number " + sunchips.itemnumber + " on the vending machine.")
</look>
<use type="script">
msg ("Om nom nom")
MoveObject (Sunchips, Vending Machine)
</use>
<Take type="script">
MoveObject (Sunchips, player)
</Take>
</object>
</object>
<object name="Television 1">
<inherit name="editor_object" />
<inherit name="switchable" />
<alias>Television</alias>
<alt>TV</alt>
<switchonmsg>*click*</switchonmsg>
<switchoffmsg>*click*</switchoffmsg>
<switchedondesc>Star Trek is on. Can't these people think of anything besides space junk?</switchedondesc>
<switchedoffdesc>It is currently switched off.</switchedoffdesc>
<Lookat>Even in space, people have to have their television.</Lookat>
<displayverbs>Look at; Take; Switch on; Switch off</displayverbs>
<Watch type="script">
if (IsSwitchedOn(Television 1)) {
msg ("You watch for a few minutes. You quickly become bored with the science program.")
}
else {
msg ("You stare at the blank screen and realize nothing will happen while it is switched off.")
}
</Watch>
</object>
</object>
<object name="Lobby 2">
<inherit name="editor_room" />
<description>This room contains lounges facing a large windoe with a view of the Earth.</description>
<exit alias="north" to="Communication Area">
<inherit name="northdirection" />
</exit>
<exit alias="west" to="Equipment Area">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="Main Lab">
<inherit name="eastdirection" />
</exit>
<object name="Lounge chair" />
<object name="Map">
<Lookat type="script">
picture ("AIS map.jpg")
</Lookat>
</object>
<object name="Window">
<Lookat type="string"></Lookat>
<scenery />
<look>Space. The final frontier. </look>
</object>
</object>
<object name="Computer Lab">
<inherit name="editor_room" />
<description>This is the main work station for most of the residents on the base. There are four computer terminals stationed here.</description>
<exit alias="east" to="Communication Area">
<inherit name="eastdirection" />
</exit>
<exit alias="south" to="Security Office">
<inherit name="southdirection" />
</exit>
<object name="Computer 1">
<alias>Computer 1</alias>
<look><![CDATA[To: &lt;undisclosed recipients&gt;<br/><br/>Subject: Status report 5.21.87 <br/><br/>Status report 5/21/2387. <br/><br/>The base has been experiencing a spike intechnical dificulties since 5/18/2387, when we explored the deepest chamber of the ruins to date (codenamed, "The Yeti Room"). Once we returned to the lab with our specimines, we discovered the housing bay was destroied in some terrible accident. Half of our crew was lost in that accident, but our computers left no information other than "Error code 99: oxygen leak detected". <br/><br/>The deceased names are attached to this file. May they rest peacefully now.]]></look>
<alt>PC; computer</alt>
</object>
<object name="Computer 2">
<alt>PC</alt>
</object>
<object name="Computer 3">
<alt>PC</alt>
<object name="Flash drive">
<inherit name="editor_object" />
<look>Security code: 390</look>
</object>
</object>
<object name="Computer 4">
<alt>PC</alt>
</object>
</object>
<object name="Security Office">
<inherit name="editor_room" />
<description>This is the security office that monitors the base. There are numerous computers with surveillance throughout the base. Some of the screens are black.</description>
<exit alias="north" to="Computer Lab">
<inherit name="northdirection" />
</exit>
<object name="Desk">
<inherit name="surface" />
<object name="Computer">
<look>This is the computer terminal for the security office.</look>
</object>
<object name="Security monitors">
<look>You can see most of the base here. The housing units, dining hall, biodome, and recreational screens are all blank.</look>
</object>
<object name="Phone">
<Use type="string"></Use>
<look>The line is dead.</look>
</object>
</object>
</object>
<object name="Landing Bay 2">
<inherit name="editor_room" />
<description>There are many ships here filled with eqiupment and crates to be moved to the Equipment Area. The gate is locked so you cannot explore the area. What a shame.</description>
<exit alias="east" to="Equipment Area">
<inherit name="eastdirection" />
</exit>
<object name="Locked gate">
<look>There is no way to open it. Best move along then.</look>
</object>
</object>
<object name="Equipment Area">
<inherit name="editor_room" />
<description>There are dozens of crates and boxes throughout the room. There is a forklift parked along the wall.</description>
<exit alias="east" to="Lobby 2">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="Landing Bay 2">
<inherit name="westdirection" />
</exit>
<object name="Crates">
<inherit name="openable" />
<Open type="string"></Open>
<Close type="string"></Close>
<Kick>Ouch! Why would you kick it?</Kick>
</object>
<object name="Forklift">
<inherit name="switchable" />
<look>It appears to be fully charged.</look>
<Use type="string"></Use>
<switchonmsg>You turn the key and the engine roars to life. You'd think newer technology like this would be quieter...</switchonmsg>
<switchoffmsg>You turn the key and the engine goes silent.</switchoffmsg>
<Lookat>There is a large screen on the device. Perhaps it provides user instructions when turned on.</Lookat>
</object>
</object>
<object name="Recreational Area">
<inherit name="editor_room" />
<description>This is the main recreational area for the base. There are various game tables, televisions,and exercise stations throughout the room.</description>
<exit alias="west" to="Communication Area">
<inherit name="westdirection" />
</exit>
<object name="TV">
<inherit name="switchable" />
<scenery type="boolean">false</scenery>
<switchedon />
<switchedoffdesc>You turn off the TV and the world seems brighter.</switchedoffdesc>
<switchedondesc>An old western is on. Joy. </switchedondesc>
<look>This is a large TV, great for video games.</look>
<Watch type="script">
if (IsSwitchedOn(TV)) {
msg ("There is a racing game on pause. ")
}
else {
msg ("The screen is blank. ")
}
</Watch>
</object>
<object name="Eliptical">
<inherit name="switchable" />
<scenery type="boolean">false</scenery>
<look type="string"></look>
<switchonmsg>You press the "Quick Start" button and the machine blinks to life.</switchonmsg>
<switchoffmsg>With no user activity, the machine manually shuts off in a moment.</switchoffmsg>
<Exercise type="script">
if (IsSwitchedOn(Eliptical)) {
msg ("You jump on and workout for a few minutes. It's not much of a workout.")
}
else {
msg ("The machine sits silently with anticipation.")
}
</Exercise>
</object>
<object name="Treadmill">
<inherit name="switchable" />
<scenery type="boolean">false</scenery>
<switchoffmsg>With no user activity, the machine manually shuts off in a moment.</switchoffmsg>
<switchonmsg>You press the "Quick Start" button and the machine blinks to life.</switchonmsg>
<Exercise type="script">
if (IsSwitchedOn(Treadmill)) {
msg ("You jump on and workout for a few minutes. It's not much of a workout.")
}
else {
msg ("The machine sits silently with anticipation.")
}
</Exercise>
</object>
<object name="Stationary Bike">
<inherit name="switchable" />
<scenery type="boolean">false</scenery>
<switchoffmsg>With no user activity, the machine manually shuts off in a moment.</switchoffmsg>
<switchonmsg>You press the "Quick Start" button and the machine blinks to life.</switchonmsg>
<Exercise type="script">
if (IsSwitchedOn(Stationary Bike)) {
msg ("You jump on and workout for a few minutes. It's not much of a workout.")
}
else {
msg ("The machine sits silently with anticipation.")
}
</Exercise>
</object>
<object name="Pingpong table">
<scenery type="boolean">false</scenery>
<play type="string"></play>
</object>
<object name="Game consols">
<inherit name="switchable" />
<scenery type="boolean">false</scenery>
<switchedondesc>The game system powers up and a menu screen apears. It looks like a lot of games are uploaded to the system.</switchedondesc>
<switchedoffdesc>The system goes into sleep mode. </switchedoffdesc>
<play type="script">
if (IsSwitchedOn(Game consols)) {
msg ("You turn on the game and race around the track. After a few minutes, you put it on pause.")
}
else {
msg ("At least you don't die as often when the consol is turned off.")
}
</play>
</object>
</object>
<object name="Main Lab">
<inherit name="editor_room" />
<description>This is the main lab. There are various experiments going on all around the room.</description>
<exit alias="west" to="Lobby 2">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="Dress Room">
<inherit name="eastdirection" />
</exit>
<exit alias="south" to="Ruins">
<inherit name="southdirection" />
</exit>
<object name="Tables">
<inherit name="surface" />
<look>A large table with a lot of stuff to look at on top.</look>
<Lookat type="string"></Lookat>
<object name="Beakers">
<scenery type="boolean">false</scenery>
</object>
<object name="Experiments">
<scenery type="boolean">false</scenery>
</object>
<object name="Computer 5">
<inherit name="editor_object" />
<look>The computer appears to be damaged. The wires have been pulled out and cut. If only you could repair it...</look>
<alt>pc; computer</alt>
<repair>It will take more work than typing the word "repair". Gosh.</repair>
</object>
</object>
</object>
<object name="Dress Room">
<inherit name="editor_room" />
<description>This is a small room with a few housing suits required to enter the clean lab.</description>
<exit alias="west" to="Main Lab">
<inherit name="westdirection" />
</exit>
<exit alias="east" to="Clean Room">
<inherit name="eastdirection" />
</exit>
<object name="Hasmat Suits" />
</object>
<object name="Clean Room">
<inherit name="editor_room" />
<description>This room is used to sanitize the residents who wish to use the clean lab.</description>
<exit alias="west" to="Dress Room">
<inherit name="westdirection" />
</exit>
<exit alias="south" to="Clean Lab">
<inherit name="southdirection" />
</exit>
<object name="Powerful hoses" />
</object>
<object name="Clean Lab">
<inherit name="editor_room" />
<description>This lab is kept to strick standards. Hasmat suits must be worn at all times, and there is a time lock on the door when it must be sanitized.</description>
<exit alias="north" to="Clean Room">
<inherit name="northdirection" />
</exit>
<object name="Clean table">
<inherit name="surface" />
<object name="Clean beakers" />
</object>
</object>
<object name="Dining">
<inherit name="editor_room" />
<description>This is the main dining area for the residents and guests. There is a kitchen area in the back that receives food from the biodome and shipments from the equipment bay.</description>
<exit alias="west" to="Housing">
<inherit name="westdirection" />
</exit>
<object name="Table">
<inherit name="surface" />
<object name="chair" />
<object name="Foods">
<inherit name="editor_object" />
</object>
</object>
</object>
<verb>
<property>Kick</property>
<pattern>Kick</pattern>
<defaultexpression>"You can't Kick " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Lookat</property>
<pattern>Look at</pattern>
<defaultexpression>"You can't Look at " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Take</property>
<pattern>Take</pattern>
<defaultexpression>"You can't Take " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Use</property>
<pattern>Use</pattern>
<defaultexpression>"You can't Use " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Watch</property>
<pattern>Watch</pattern>
<defaultexpression>"You can't Watch " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Shake</property>
<pattern>Shake</pattern>
<defaultexpression>"You can't shake " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Repair</property>
<pattern>Repair</pattern>
<defaultexpression>"You can't repair " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Sleep</property>
<pattern>Sleep</pattern>
<defaultexpression>"You can't Sleep " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>look</property>
<pattern>look </pattern>
<defaultexpression>"You can't look " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Poke</property>
<pattern>Poke</pattern>
<defaultexpression>"You can't Poke " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Feed</property>
<pattern>Feed </pattern>
<defaultexpression>"You can't Feed " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>Exercise</property>
<pattern>Exercise</pattern>
<defaultexpression>"You can't Exercise " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>play</property>
<pattern>play</pattern>
<defaultexpression>"You can't play " + object.article + "."</defaultexpression>
</verb>
</asl>

sgreig
I think the problem is stemming from how you have the rooms arranged. The player and box are in a room called ship, inside a room called Landing Bay 1. While I think I see why you arranged them like that, I think that's what's screwing up the exits. To set it up that way, the ship would have to be set as an enterable container instead. It would be easier to move the ship room so it's not a child of the landing bay room. Then it will probably work.

EDIT: Nevermind, it's still giving the error. I'm not really sure what the issue is. Alex might need to weigh in on this one since he's better at figuring out what's causing the error messages than I am (a fact to which I'm sure he'll attest.)

SarahJay
Thank you for your input on it anyway. I was able to go through the exits without any problem until I started experimenting with scripts, and then the error occurred. I have been going through each object trying to find out where it is, with no luck as of yet...

By the by, you've been very helpful so far, and I really do appreciate it.

Pertex
In your room "Landing Bay 1" you have the line

<alias type="string"></alias>


If you use this line you must specify an alias or just delete the complete line.

SarahJay
Ahh, you found it!!! Thank you!

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums