Thanks HK

I don't see a function or scriptcommand that helps in this situation. Would you know what the type for non-directional is called? eg "northdirection". I know it's not called "nodirection" and "nondirectional".
I'm trying to adapt Jay's ASL code to the Web Version but the Web Version is uncooperative. After a few hours of tinkering, this is what I came up with:
1) The Web Version's compass won't allow me to use hyphens in the name (so exit0-10 is out of the question).
2) create exit() works great for 10 directions N, NW, W, SW, S, SE, E, NE, U, D. I can set the ID and Jay's code works. Makes me think that ID is the "name" and the Name is the "alias"...
3) create exit() won't allow me to designate an ID unless I specify a type. So the "up to the north" and "down to the north" are not working. When it tries to clone, eg newexit = clone(GetObject(exitname)), clone is passed a null as a parameter.
LOL oh... so much typing... now I wish I had fewer than 26 directions XD
I still have a few scenarios left to try. Until I get the type for "non-directional" direction, I am probably going to stick in "northdirection" and see what happens, because then I can set an ID.
I added the stuff below in case you'd like to see how I'm going about it.
Jay's code:
http://forum.textadventures.co.uk/viewtopic.php?f=10&t=3832&start=15#p25752This is the section that I'm trying to adapt to the Web Version:
<exit name="exit0-10" alias="north">
<inherit name="northdirection" />
</exit>
<exit name="exit-1-10" alias="northwest">
<inherit name="northwestdirection" />
</exit>
<exit name="exit-100" alias="west">
<inherit name="westdirection" />
</exit>
<exit name="exit-110" alias="southwest">
<inherit name="southwestdirection" />
</exit>
<exit name="exit010" alias="south">
<inherit name="southdirection" />
</exit>
<exit name="exit110" alias="southeast">
<inherit name="southeastdirection" />
</exit>
<exit name="exit100" alias="east">
<inherit name="eastdirection" />
</exit>
<exit name="exit1-10" alias="northeast">
<inherit name="northeastdirection" />
</exit>
<exit name="exit00-1" alias="up">
<inherit name="updirection" />
</exit>
<exit name="exit0-1-1" alias="up to the north" />
<exit name="exit-1-1-1" alias="up to the northwest" />
<exit name="exit-10-1" alias="up to the west" />
<exit name="exit-11-1" alias="up to the southwest" />
<exit name="exit01-1" alias="up to the south" />
<exit name="exit11-1" alias="up to the southeast" />
<exit name="exit10-1" alias="up to the east" />
<exit name="exit1-1-1" alias="up to the northeast" />
<exit name="exit001" alias="down">
<inherit name="downdirection" />
</exit>
<exit name="exit0-11" alias="down to the north" />
<exit name="exit-1-11" alias="down to the northwest" />
<exit name="exit-101" alias="down to the west" />
<exit name="exit-111" alias="down to the southwest" />
<exit name="exit011" alias="down to the south" />
<exit name="exit111" alias="down to the southeast" />
<exit name="exit101" alias="down to the east" />
<exit name="exit1-11" alias="down to the northeast" />
This is my adaptation of that section:
// Create Exits Templates
grTemp = GetObject("gameroom")
// north/northdirection
// create exit ("exit0-10", grTemp, grTemp, "northdirection")
create exit ("exit0-10", "exit0-10", grTemp, grTemp, "northdirection")
// northwest/northwestdirection
// create exit ("exit-1-10", grTemp, grTemp, "northwestdirection")
create exit ("exit-1-10", "exit-1-10", grTemp, grTemp, "northwestdirection")
// west/westdirection
// create exit ("exit-100", grTemp, grTemp, "westdirection")
create exit ("exit-100", "exit-100", grTemp, grTemp, "westdirection")
// southwest/southwestdirection
// create exit ("exit-110", grTemp, grTemp, "southwestdirection")
create exit ("exit-110", "exit-110", grTemp, grTemp, "southwestdirection")
// south/southdirection
// create exit ("exit010", grTemp, grTemp, "southdirection")
create exit ("exit010", "exit010", grTemp, grTemp, "southdirection")
// southeast/southeastdirection
// create exit ("exit110", grTemp, grTemp, "southeastdirection")
create exit ("exit110", "exit110", grTemp, grTemp, "southeastdirection")
// east/eastdirection
// create exit ("exit100", grTemp, grTemp, "eastdirection")
create exit ("exit100", "exit100", grTemp, grTemp, "eastdirection")
// northeast/northeastdirection
// create exit ("exit1-10", grTemp, grTemp, "northeastdirection")
create exit ("exit1-10", "exit1-10", grTemp, grTemp, "northeastdirection")
// up/updirection
// create exit ("exit00-1", grTemp, grTemp, "updirection")
create exit ("exit00-1", "exit00-1", grTemp, grTemp, "updirection")
// up to the north
// create exit ("exit0-1-1", grTemp, grTemp)
create exit ("exit0-1-1", grTemp, grTemp)
// up to the northwest
// create exit ("exit-1-1-1", grTemp, grTemp)
create exit ("exit-1-1-1", grTemp, grTemp)
// up to the west
// create exit ("exit-10-1", grTemp, grTemp)
create exit ("exit-10-1", grTemp, grTemp)
// up to the southwest
// create exit ("exit-11-1", grTemp, grTemp)
create exit ("exit-11-1", grTemp, grTemp)
// up to the south
// create exit ("exit01-1", grTemp, grTemp)
create exit ("exit01-1", grTemp, grTemp)
// up to the southeast
// create exit ("exit11-1", grTemp, grTemp)
create exit ("exit11-1", grTemp, grTemp)
// up to the east
// create exit ("exit10-1", grTemp, grTemp)
create exit ("exit10-1", grTemp, grTemp)
// up to the northeast
// create exit ("exit1-1-1", grTemp, grTemp)
create exit ("exit1-1-1", grTemp, grTemp)
// down/downdirection
// create exit ("exit001", grTemp, grTemp, "downdirection")
create exit ("exit001", "exit001", grTemp, grTemp, "downdirection")
// down to the north
// create exit ("exit0-11", grTemp, grTemp)
create exit ("exit0-11", grTemp, grTemp)
// down to the northwest
// create exit ("exit-1-11", grTemp, grTemp)
create exit ("exit-1-11", grTemp, grTemp)
// down to the west
// create exit ("exit-101", grTemp, grTemp)
create exit ("exit-101", grTemp, grTemp)
// down to the southwest
// create exit ("exit-111", grTemp, grTemp)
create exit ("exit-111", grTemp, grTemp)
// down to the south
// create exit ("exit011", grTemp, grTemp)
create exit ("exit011", grTemp, grTemp)
// down to the southeast
// create exit ("exit111", grTemp, grTemp)
create exit ("exit111", grTemp, grTemp)
// down to the east
// create exit ("exit101", grTemp, grTemp)
create exit ("exit101", grTemp, grTemp)
// down to the northeast
// create exit ("exit1-11", grTemp, grTemp)
create exit ("exit1-11", grTemp, grTemp)
My program so far:
<!--Saved by Quest 5.4.4896.9778-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Jaynabonne's Example">
<gameid>f0627466-3ac2-4df3-bff2-58e0dc837b22</gameid>
<version>3.0</version>
<firstpublished>2013</firstpublished>
<menufont>Georgia, serif</menufont>
<description></description>
</game>
<object name="gameroom">
<inherit name="editor_room" />
<beforeenter type="script">
SetObjAtt_gameroom_dims
SetObjAtt_gameroom_rooms
LayoutRooms
</beforeenter>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="room1">
<inherit name="editor_room" />
</object>
<object name="room2">
<inherit name="editor_room" />
</object>
<object name="room3">
<inherit name="editor_room" />
</object>
<object name="room4">
<inherit name="editor_room" />
</object>
<object name="room5">
<inherit name="editor_room" />
</object>
<object name="room6">
<inherit name="editor_room" />
</object>
<object name="room7">
<inherit name="editor_room" />
</object>
<object name="room8">
<inherit name="editor_room" />
</object>
<object name="room9">
<inherit name="editor_room" />
</object>
<object name="room10">
<inherit name="editor_room" />
</object>
<function name="SetObjAtt_gameroom_rooms">
ObjTemp = GetObject("gameroom")
set (ObjTemp, "rooms", NewStringList())
list add (ObjTemp.rooms, "room1")
list add (ObjTemp.rooms, "room2")
list add (ObjTemp.rooms, "room3")
list add (ObjTemp.rooms, "room4")
list add (ObjTemp.rooms, "room5")
list add (ObjTemp.rooms, "room6")
list add (ObjTemp.rooms, "room7")
list add (ObjTemp.rooms, "room8")
list add (ObjTemp.rooms, "room9")
list add (ObjTemp.rooms, "room10")
</function>
<function name="PrintObjAtt_gameroom_rooms">
msg ("Function:PrintObjAtt_room_dims")
ObjTemp = GetObject("gameroom")
msg (StringListItem(ObjTemp.rooms, 0))
msg (StringListItem(ObjTemp.rooms, 1))
msg (StringListItem(ObjTemp.rooms, 2))
msg (StringListItem(ObjTemp.rooms, 3))
msg (StringListItem(ObjTemp.rooms, 4))
msg (StringListItem(ObjTemp.rooms, 5))
msg (StringListItem(ObjTemp.rooms, 6))
msg (StringListItem(ObjTemp.rooms, 7))
msg (StringListItem(ObjTemp.rooms, 8))
msg (StringListItem(ObjTemp.rooms, 9))
</function>
<function name="SetObjAtt_gameroom_dims">
ObjTemp = GetObject("gameroom")
set (ObjTemp, "dimsx", 5)
set (ObjTemp, "dimsy", 1)
set (ObjTemp, "dimsz", 1)
</function>
<function name="PrintObjAtt_gameroom_dims">
msg ("Function:PrintObjAtt_room_dims")
ObjTemp = GetObject("gameroom")
msg (ObjTemp.dimsx)
msg (ObjTemp.dimsy)
msg (ObjTemp.dimsz)
</function>
<function name="LayoutRooms"><![CDATA[
// Create Exits Templates
grTemp = GetObject("gameroom")
// north/northdirection
// create exit ("exit0-10", grTemp, grTemp, "northdirection")
create exit ("exit0-10", "exit0-10", grTemp, grTemp, "northdirection")
// northwest/northwestdirection
// create exit ("exit-1-10", grTemp, grTemp, "northwestdirection")
create exit ("exit-1-10", "exit-1-10", grTemp, grTemp, "northwestdirection")
// west/westdirection
// create exit ("exit-100", grTemp, grTemp, "westdirection")
create exit ("exit-100", "exit-100", grTemp, grTemp, "westdirection")
// southwest/southwestdirection
// create exit ("exit-110", grTemp, grTemp, "southwestdirection")
create exit ("exit-110", "exit-110", grTemp, grTemp, "southwestdirection")
// south/southdirection
// create exit ("exit010", grTemp, grTemp, "southdirection")
create exit ("exit010", "exit010", grTemp, grTemp, "southdirection")
// southeast/southeastdirection
// create exit ("exit110", grTemp, grTemp, "southeastdirection")
create exit ("exit110", "exit110", grTemp, grTemp, "southeastdirection")
// east/eastdirection
// create exit ("exit100", grTemp, grTemp, "eastdirection")
create exit ("exit100", "exit100", grTemp, grTemp, "eastdirection")
// northeast/northeastdirection
// create exit ("exit1-10", grTemp, grTemp, "northeastdirection")
create exit ("exit1-10", "exit1-10", grTemp, grTemp, "northeastdirection")
// up/updirection
// create exit ("exit00-1", grTemp, grTemp, "updirection")
create exit ("exit00-1", "exit00-1", grTemp, grTemp, "updirection")
// up to the north
// create exit ("exit0-1-1", grTemp, grTemp)
create exit ("exit0-1-1", grTemp, grTemp)
// up to the northwest
// create exit ("exit-1-1-1", grTemp, grTemp)
create exit ("exit-1-1-1", grTemp, grTemp)
// up to the west
// create exit ("exit-10-1", grTemp, grTemp)
create exit ("exit-10-1", grTemp, grTemp)
// up to the southwest
// create exit ("exit-11-1", grTemp, grTemp)
create exit ("exit-11-1", grTemp, grTemp)
// up to the south
// create exit ("exit01-1", grTemp, grTemp)
create exit ("exit01-1", grTemp, grTemp)
// up to the southeast
// create exit ("exit11-1", grTemp, grTemp)
create exit ("exit11-1", grTemp, grTemp)
// up to the east
// create exit ("exit10-1", grTemp, grTemp)
create exit ("exit10-1", grTemp, grTemp)
// up to the northeast
// create exit ("exit1-1-1", grTemp, grTemp)
create exit ("exit1-1-1", grTemp, grTemp)
// down/downdirection
// create exit ("exit001", grTemp, grTemp, "downdirection")
create exit ("exit001", "exit001", grTemp, grTemp, "downdirection")
// down to the north
// create exit ("exit0-11", grTemp, grTemp)
create exit ("exit0-11", grTemp, grTemp)
// down to the northwest
// create exit ("exit-1-11", grTemp, grTemp)
create exit ("exit-1-11", grTemp, grTemp)
// down to the west
// create exit ("exit-101", grTemp, grTemp)
create exit ("exit-101", grTemp, grTemp)
// down to the southwest
// create exit ("exit-111", grTemp, grTemp)
create exit ("exit-111", grTemp, grTemp)
// down to the south
// create exit ("exit011", grTemp, grTemp)
create exit ("exit011", grTemp, grTemp)
// down to the southeast
// create exit ("exit111", grTemp, grTemp)
create exit ("exit111", grTemp, grTemp)
// down to the east
// create exit ("exit101", grTemp, grTemp)
create exit ("exit101", grTemp, grTemp)
// down to the northeast
// create exit ("exit1-11", grTemp, grTemp)
create exit ("exit1-11", grTemp, grTemp)
// Create a list to hold the assigned room indices.
assigned = NewList()
// Layout the first room.
room = gameroom.rooms[0]
currentroom = GetObject(room)
set (currentroom, "x", (GetRandomInt(0, gameroom.dimsx-1)))
set (currentroom, "y", (GetRandomInt(0, gameroom.dimsy-1)))
set (currentroom, "z", (GetRandomInt(0, gameroom.dimsz-1)))
// Mark this room's slot.
list add (assigned, CoordsToIndex(currentroom.x, currentroom.y, currentroom.z))
// Layout the remaining rooms from here.
LCTemp = ListCount(gameroom.rooms)-1
for (i, 1, LCTemp) {
room = gameroom.rooms[i]
newroom = GetObject(room)
positioned = false
while (not positioned) {
// Select a random room top start from.
room = gameroom.rooms[GetRandomInt(0, i-1)]
sourceroom = GetObject(room)
// Select a random direction from this room.
dirgood = false
while (not dirgood) {
dirx = GetRandomInt(0,2)-1
diry = GetRandomInt(0,2)-1
dirz = GetRandomInt(0,2)-1
dirgood = dirx <> 0 or diry <> 0 or dirz <> 0
}
// msg ("dir: " + dirx + ", " + diry + ", " + dirz)
// See if we can position the room here.
newroom.x = (sourceroom.x + dirx + gameroom.dimsx) % gameroom.dimsx
newroom.y = (sourceroom.y + diry + gameroom.dimsy) % gameroom.dimsy
newroom.z = (sourceroom.z + dirz + gameroom.dimsz) % gameroom.dimsz
index = CoordsToIndex(newroom.x, newroom.y, newroom.z)
positioned = not index in assigned
}
// Remember this position is used.
list add (assigned, index)
// Create and assign the exits.
exitname = "exit" + dirx + diry + dirz
oppname = "exit" + -dirx + -diry + -dirz
// msg("exitname = " + exitname + ", oppname = " + oppname)
ObjTemp = GetObject(exitname)
newexit = clone(ObjTemp)
ObjTemp = GetObject(oppname)
oppexit = clone(ObjTemp)
newexit.parent = sourceroom
newexit.to = newroom
oppexit.parent = newroom
oppexit.to = sourceroom
// msg ("pos: " + newroom.x + ", " + newroom.y + ", " + newroom.z)
currentroom = newroom
}
]]></function>
<function name="CoordsToIndex" parameters="x, y, z" type="int">
return (x + gameroom.dimsx*(y + gameroom.dimsy*z))
</function>
</asl>