How do I properly use the create exit command?

lightwriter
07 Oct 2015, 21:39

if (direction = "north") {
x = currentroom.x
y = currentroom.y + 1
z = currentroom.z
}
else if (direction = "east") {
x = currentroom.x + 1
y = currentroom.y
z = currentroom.z
}
else if (direction = "south") {
x = currentroom.x
y = currentroom.y - 1
z = currentroom.z
}
else if (direction = "west") {
x = currentroom.x - 1
y = currentroom.y
z = currentroom.z
}
create ("a" + x + "_" + y + "_" + z, "gen_" + direction)
create exit (direction + currentroom.name, direction, currentroom.name, "a" + x + "_" + y + "_" + z, direction + "direction")
MoveObject (player, "a" + x + "_" + y + "_" + z)

I get an error:
Error running script: Error compiling expression 'currentroom.name': RootExpressionElement: Cannot convert type 'String' to expression result of 'Element'

lightwriter
07 Oct 2015, 23:47
Here is my current game code (all of it) so you can see for yourself what I mean:
<!--Saved by Quest 5.6.5621.18142-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Mazecraft">
<gameid>0b09d9d0-9005-467a-b255-0ebb4cf2929a</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
</game>
<object name="a0_0_0">
<inherit name="editor_room" />
<beforefirstenter type="script">
msg ("4")
</beforefirstenter>
<beforeenter type="script">
msg ("1")
</beforeenter>
<enter type="script">
msg ("2")
</enter>
<onexit type="script">
msg ("3")
</onexit>
<firstenter type="script">
msg ("5")
</firstenter>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<exit alias="north" to="player">
<inherit name="northdirection" />
<runscript />
<script type="script">
going (this.alias, game.pov.parent)
</script>
</exit>
</object>
<type name="editor_room">
<x type="int">0</x>
<y type="int">0</y>
<z type="int">0</z>
<beforefirstenter type="script">
</beforefirstenter>
<firstenter type="script">
</firstenter>
<enter type="script">
</enter>
<onexit type="script">
</onexit>
<beforeenter type="script">
</beforeenter>
<changedparent type="script">
if (game.pov = this) {
if (IsDefined("oldvalue")) {
OnEnterRoom ("oldvalue")
}
else {
OnEnterRoom (null)
}
if (game.gridmap) {
MergePOVCoordinates
}
}
</changedparent>
<visited type="boolean">false</visited>
</type>
<type name="gen_north">
<inherit name="editor_room" />
</type>
<type name="gen_east">
<inherit name="editor_room" />
</type>
<type name="gen_south">
<inherit name="editor_room" />
</type>
<type name="gen_west">
<inherit name="editor_room" />
</type>
<function name="going" parameters="direction, currentroom">
if (direction = "north") {
x = currentroom.x
y = currentroom.y + 1
z = currentroom.z
direction2 = "south"
}
else if (direction = "east") {
x = currentroom.x + 1
y = currentroom.y
z = currentroom.z
direction2 = "west"
}
else if (direction = "south") {
x = currentroom.x
y = currentroom.y - 1
z = currentroom.z
direction2 = "north"
}
else if (direction = "west") {
x = currentroom.x - 1
y = currentroom.y
z = currentroom.z
direction2 = "east"
}
nextroom = ("a" + x + "_" + y + "_" + z)
already_exist = GetObject(nextroom)
if (already_exist = null) {
create (nextroom, direction + "direction")
}
else {
MoveObject (player, nextroom)
}
</function>
</asl>