posted 08-02-2003 02:49 GMT
Hi,Here is a very basic working example of an openable door that creates an exit when opened. In this case trying to open the door a second or third time tells you "it is already open"
quote:
' Quest 3.11 ASL define game <demo>
asl-version <311>
game version <1.0>
game author <MaDbRiT>
game copyright <© 2003 AGB>
game info <Extra Info>
start <office>
command <open #@object#> {
if action <#object#; open> then {
doaction <#object#;open>
}
else msg <You cannot open the #object#.>
}
end define
define room <office>
look <Your office is scruffy and in dire need of a tidy up! There is _
a door in the west wall.>
prefix <your>
define object <door>
type <door>
look <a stout wooden door.>
invisible
properties <closed>
action <open> {
if property <$thisobject$; closed> then {
property <$thisobject$; not closed>
msg <It swings open.>
create exit west <office;hallway>
}
else msg <It's already open>
}
end define
end define
define room <hallway>
look <a long dilapidated hall.>
prefix <the>
east <office>
end define
define text <intro>
This demo shows a closed door, coded so that it may be opened to reveal an exit.
end define
define text <win>
Enter win text here
end define
define text <lose>
Enter lose text here
end define
This is ONE way to do it, and relatively simple, but it is not the best. Ideally you should create an openable type and have open / close actions with traps for repeated use, messages when things are opened and closed, varying descriptions etc..
All the above features are included in the 'openable' type that is part of my Q3EXT library, which might be worth looking at to see how it works even if you don't use it.
Al
p.s. a MUCH better version of my library is almost ready for release now, after having a major re-write over Xmas.