EagleWing wrote:This question is probably for Al (but no objections to others answering, of course).
I have a vending machine, which I have typed as container...
...I've read and re-read the documentation for q3ext but haven't found the solution.
19-Sep-2002:
Beta version. TLTcontainable type modified to call an action
when a TLTcontainable becomes 'contained' (i.e. when object is
put into a container or given to a TLTactor). The action is
named 'contained' and the default is to simply print a message
saying 'O.K.'. This allows authors an easy way to extend the
functionality by replacing the 'contained' action with one of
their own.
This change was prompted by S.A. George, who pointed out that
although the library handled (say) putting a lit torch into a
barrel of black powder perfectly well up to the point of the
torch being moved and then reported as being in the barrel etc.
it required convoluted coding to make anything further happen
(an explosion in this case) as a result.
Following on the example above, adding a replacement 'contained'
action to the torch that checks its location and triggers an
explosion if it has been put into the barrel is now very simple.
My thanks to Ali (S.A. George) for the useful feedback.
' "Chocolate Machine Demo"
' Created with QDK 3.52
!include <Typelib.qlb>
define game <Chocolate Machine Demo>
asl-version <350>
gametype singleplayer
start <Cafeteria>
game author <MaDbRiT >
game version <.001>
game copyright <© 2004>
game info <Created with QDK 3.52.>
end define
define synonyms
end define
define room <Cafeteria>
prefix <the>
define object <machine>
alias <chocolate machine>
alt <vending machine; chocolate machine; machine>
look <it's a Nestle chocolate machine - your favourite brand.>
type <TLTobject>
type <TLTcontainer>
properties <not takeable; noTake=No chance - It probably weighs 400kilos - and it is bolted to the wall!; listHeader=the dispensing tray at the bottom contains >
end define
define object <coin>
alt <money>
look <its a 50 pence piece - just enough to buy a bar of chocolate.>
type <TLTobject>
type <TLTcontainable>
action <contained> {
hide <coin>
show <chocolate>
msg <The vending machine gives a 'kerchunk' and dispenses a bar of chocolate...>
}
end define
define object <chocolate>
look <Nestle Nutty-Fruit, your favourite!>
prefix <a bar of>
hidden
type <TLTobject>
type <TLTcontainable>
properties <isIn=machine>
end define
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end define
' "The Tower"
' Created with QDK 3.52 - UNREGISTERED VERSION
!include <TypeLib.QLB>
define game <The Tower>
asl-version <350>
gametype singleplayer
start <Outside the Tower>
game author <Frank Lane>
game version <0.001>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
default fontname <Comic Sans MS>
default fontsize <10>
startscript flag off <rats_fed>
command <eat #@foodthing#> if ( #@foodthing# = Bar of Cadbury's Chocolate ) and got <Bar of Cadbury's Chocolate> then {
msg <You eat the chocolate, despite its rather nasty appearance.|n The next moment you feel violently sick and throw up all over the floor.>
hide <Bar of Cadbury's Chocolate>
create object <sick; #quest.currentroom#>
}
else msg <I'm not sure what you want me to eat.>
end define
define object <Coin>
alt <cash; money; dosh; dough; two bob>
look <It is an old coin from before decimalisation. It was a silver coin but is badly tarnished now.>
take
speak <I'd get seriously worried if I found myself talking to money.>
examine <It is worth two shillings. You vaguely remember that two shillings was the equivalent of 10p.>
prefix <the>
article <it>
gender <it>
hidden
invisible
type <TLTobject>
type <TLTcontainable>
action <contained> {
move <Bar of Cadbury's Chocolate; Cafeteria>
msg <There is a clunk and the bar of chocolate falls into the cup of the vending machine, bounces out and lands on the floor.>
show <Bar of Cadbury's Chocolate>
reveal <Bar of Cadbury's Chocolate>
}
end define