TYPELIB - Objects Containers Hidden
steve the gaming guy
06 Oct 2004, 15:58I'm working on more than one project right now. This particular one, you start on a beach where you are supposed to see a ring and a plank first. You can take the ring but can only move the plank. Once the plank is moved, it should reveal the box. The box, of course, is a container that holds a coin.
The problem is, Quest shows 'There is a ring, a plank and a box here'. I don't want the box to be seen yet but it still shows it even though I have checked the 'make unavailable' box.
In this situation, if you say 'look at box' it says 'I can't see that anywhere' even though it's in the description of the room. It does, however, hide it from the display box on the right.
Lastly, I marked the plank to run a script to show a message saying the plank has been moved and then make the unaccessable box accessable. What happens instead is if you type get plank, quest ignores the script and lets you take it.
Here is the code that I snagged out of the .asl file in notepad:
define room <Beach>
look <You find yourself on a beach. Along the shore are parts of the royal ship torn apart by the angry sea. A small sandy path leads to the north through the tall grass. >
north <Path>
define object <ring>
look <Prince Alexander's royal insignia ring.>
take
speak <This ring cannot speak.>
examine <Prince Alexander's royal insignia ring.>
prefix <the>
article <it>
gender <it>
type <TLTobject>
type <TLTreadable>
properties <readMessage=Royal Family of Daventry>
end define
define object <plank>
look <This large plank seems to be from Alexander's ship. It does not look too heavy.>
take {
msg <You move the plank to the side revealing a small box.>
show <box>
}
speak <It's made of wood and cannot speak.>
prefix <the>
article <it>
gender <it>
type <TLTobject>
end define
define object <box>
look <This small box is made of a dark sturdy wood.>
take {
msg <You can't take the box with you, but you decide to open it. It reveals a small coin.>
show <coin>
}
speak <It's just a box.>
prefix <the>
article <it>
gender <it>
hidden
type <TLTcontainer>
type <TLTcontainer>
type <TLTclosable>
end define
define object <coin>
look <This is a coin straight from Daventry.>
speak <Coins don't talk.>
examine <This is a coin straight from Daventry. There's a small inscription on it.>
type <TLTcontainable>
properties <isIn=box>
end define
end defineAny problems that seem to jump out at the more experienced coders here?
Thanks,
Steve the gaming guy
Anonymous
06 Oct 2004, 19:59Any problems that seem to jump out at the more experienced coders here?
Yeah - I'm not at my home PC right now, but pretty sure that it's a bug I've seen before in typelib
I've fixed this once, along with the spurious space in location prefixes but it would seem I've accidentally reverted to a pre-fixed version of my code on that - Grrr!
I'll sort this out as soon as I get home.
Al (MaDbRiT)
Anonymous
06 Oct 2004, 20:48I think I may be doing myself a dis-service. I do believe that there is a 'bug' in the testing of hidden and invisible properties with Quest itself which prevents typelib from working properly.
I've reported this to Alex by e-mail. In the meantime you could create your box object in another (dummy) room and move it to the right room when the plank is moved - which will of course make it unavailable until required.
Just a work around for now -
Al (MaDbRiT)
Alex
06 Oct 2004, 21:39007bond
06 Oct 2004, 21:46steve the gaming guy
07 Oct 2004, 13:31Now I faced a new problem because this time, I am adding a scoring system. With the same idea as above, you get a point for getting the ring, a point for moving the plank, a point for opening the box and a point for taking the coin inside. The problem I faced is that once the plank was moved and the box opened (and coin taken), if you decided to open the box again despite it already being opened, you would get another unearned point and the description would say that you’ve opened the box. And of course, you will get a point for the amount of times that the player is patient enough to type the command.
That problem is with the typelib library taken out. I know there is a work around for it that I will probably discover if I had a block of time to work on it myself.
For the sake of helping others reading this string, here’s the code that I currently have now without the typelib library and creating the unearned points…
define room <Beach>
alias <beach>
prefix <the>
look <You find yourself on a beach. Along the shore are parts of the royal ship torn apart by the angry sea. A small sandy path leads to the north through the tall grass. >
north <Path>
define object <ring>
look <Prince Alexander's royal insignia ring.>
take {
msg <You take the royal insignia ring.>
give <ring>
inc <Score; 1>
}
speak <This ring cannot speak.>
examine <Prince Alexander's royal insignia ring.>
prefix <the>
article <it>
gender <it>
type <TLTobject>
type <TLTreadable>
properties <readMessage=Royal Family of Daventry>
end define
define object <plank>
look <This large plank seems to be from Alexander's ship. It does not look too heavy.>
take {
msg <You move the plank to the side revealing a small box.>
show <box>
hide <plank>
inc <Score; 1>
}
speak <It's made of wood and cannot speak.>
prefix <the>
article <it>
gender <it>
properties <not takeable; noTake=You move the plank to the side revealing a small box...>
end define
define object <box>
look <This is a small sturdy box.>
take {
msg <You decide to not take the box and simply open it. It reveals a shiny coin inside.>
show <coin>
inc <Score; 1>
hide <box>
}
speak <It's just a box.>
prefix <the>
article <it>
gender <it>
hidden
end define
define object <coin>
look <A coin from Daventry.>
take {
give <coin>
inc <Score; 1>
msg <You take the Daventry coin.>
}
speak <Coins can't talk.>
prefix <the>
article <it>
gender <it>
hidden
end define
end defineFor those who don't recognize this, this would be the first screen of King's Quest VI by Sierra. The second project of putting a graphic game to text. (my first is also in the works which is King's Quest V)
steve the gaming guy
steve the gaming guy
07 Oct 2004, 16:59The unearned point scenario can be solved by setting a flag when the plank is moved. 'If plank moved flag is on, then say "The plank has already been moved", else "You move the plank revealing a box", increment one point to 'score', make box accessible.'
I'm still working with the other situation which will be temporarily solved by Al's suggestion of moving the box in from an inventory room when the plank is moved.
Right now it shows... 'You can see the ring, the plank, the box and the coin here.'
Anyway, that's all for now. Thanks guys!
steve the gaming guy 8)
Anonymous
07 Oct 2004, 18:47If you leave out typelib, the 'properties' lines in your code as given are completely pointless as are the 'type' lines
All you need to do to use the typelib and still have your hidden box is to define the box and coin in a dummy room, (it doesn't need to be hidden or invisible) then as part of the script that 'takes' the plank, move the box to the beach - end of problem
Al (MaDbRiT)
Anonymous
07 Oct 2004, 20:35steve the gaming guy wrote:I'm still working with the other situation which will be temporarily solved by Al's suggestion of moving the box in from an inventory room when the plank is moved.:
That's why I said I would just resort to your way!
I'm sure it works. I haven't done it yet.
Right now, I'm dealing with a flag issue that I'll talk about later when I have some more time to describe the issue. I’ll probably talk about it in a new post.
Thanks again
steve the gaming guy 8)
steve the gaming guy
08 Oct 2004, 16:23Al, I've changed to your way which did work fine initially. The ring and the plank start in the same room. You move the plank and the box zooms in from the inventory room. Then when the box is opened, the coin zoomed in from the inventory room. Everything worked smoothly EXCEPT that Quest decided it didn't want to look at the Score script anymore and it gave one point to move the plank and open the box but no longer would it reward you for picking up the ring or taking the coin.
That's where the trouble began. I started screwing around with the code (within QDK). I ended up deleting the ring and re-making it which, to my surprise, worked! Unfortunately, other things stopped working after more screwing around. I changed the box into a container (that's a mistake, apparently) and now the moving the plank will not bring the box in any longer. What I'm seeing is that now Quest is reading the Basic tab (typelib) and totally ignoring the Take tab which is where my script is to bring the box into the room.
Here is the code as it sits now and chunks of my hair lay on my desk:
define synonyms
get = take
end define
define room <Beach>
alias <beach>
prefix <the>
look <You find yourself on a beach. Along the shore are parts of the royal ship torn apart by the angry sea. A small sandy path leads to the north through the tall grass. >
north <Path>
define object <ring>
look <Prince Alexander's royal insignia ring.>
take {
msg <You take the royal insignia ring.>
give <ring>
inc <Score; 1>
}
speak <This ring cannot speak.>
examine <Prince Alexander's royal insignia ring.>
prefix <the>
article <it>
gender <it>
end define
define object <plank>
look <This large plank seems to be from Alexander's ship. It does not look too heavy.>
take if not flag <plank moved> then {
msg <You move the plank aside revealing a small box.>
move <box; Beach>
inc <Score; 1>
}
else msg <The plank has already been moved.>
speak <It's made of wood and cannot speak.>
prefix <the>
article <it>
gender <it>
{
flag on <plank moved>
move <box; Beach>
inc <Score; 1>
}
end define
end defineAnd the code for the inventory room:
define room <inventory room>
define object <coin>
look <A coin from Daventry.>
take {
msg <You take the Daventry coin.>
inc <Score; 1>
give <coin>
}
speak <Coins can't talk.>
prefix <the>
article <it>
gender <it>
type <TLTobject>
type <TLTcontainable>
properties <isIn=box>
end define
define object <box>
look <This is a small sturdy box.>
speak <It's just a box.>
prefix <the>
article <it>
gender <it>
type <TLTcontainer>
type <TLTcontainer>
type <TLTclosable>
properties <not takeable; listHeader=Small box; listHeader=Small box; isClosedDesc=This box is closed.; closingDesc=You close the box.; isOpenDesc=This box is open.; openingDesc=You open the box.>
action <opened> if not flag <box opened> then {
inc <Score; 1>
flag on <box opened>
}
end define
end defineI'm dying here.
steve the gaming guy
Anonymous
08 Oct 2004, 18:54Here's a working beach, box and coin demo.
Notice how you can define the coin where you like - it will be moved into the box (because you specified that in should start in the box in typelib) when the game starts. The box I defined in a limbo room just to keep it out of the way and the coin is effectively 'inside' it and will move with it.
I've also used typelib 'types' for all the objects - it makes the code more consistent - and note that you have to use a take ACTION in typelib, not the regular QDK take to make this work.
' "beach"
' Created with QDK Pro 3.52
!include <Typelib.qlb>
define game <beach>
asl-version <350>
gametype singleplayer
start <beach>
game author <Steve - hacked by MaDbRiT>
game info <Created with QDK Pro 3.52>
define variable <Score>
type numeric
value <0>
display <! Points scored>
end define
QuestNet
end define
define synonyms
get=take
end define
define room <Beach>
alias <beach>
prefix <the>
look <You find yourself on a beach. Along the shore are parts of the royal ship torn apart by the angry sea. A small sandy path leads to the north through the tall grass. >
north <Path>
define object <ring>
look <Prince Alexander's royal insignia ring.>
take {
msg <You take the royal insignia ring.>
give <ring>
inc <Score; 1>
}
speak <This ring cannot speak.>
examine <Prince Alexander's royal insignia ring.>
prefix <the>
article <it>
gender <it>
end define
define object <plank>
look <This large plank seems to be from Alexander's ship. It does not look too heavy.>
speak <It's made of wood and cannot speak.>
prefix <the>
article <it>
gender <it>
type <TLTobject>
action <take> {
if not flag <plank moved> then {
msg <You move the plank aside revealing a small box.>
move <box; Beach>
inc <Score; 1>
flag on <plank moved>
}
else msg <The plank has already been moved.>
}
end define
define object <coin>
look <A coin from Daventry.>
action <take> {
msg <You take the Daventry coin.>
inc <Score; 1>
give <coin>
}
speak <Coins can't talk.>
prefix <a>
article <it>
gender <it>
type <TLTobject>
type <TLTcontainable>
properties <isIn=box>
end define
end define
define room <limbo>
define object <box>
look <This is a small sturdy box.>
speak <It's just a box.>
prefix <the>
article <it>
gender <it>
type <TLTcontainer>
type <TLTclosable>
properties <not takeable; listHeader=The small box contains; isClosedDesc=This box is closed.; closingDesc=You close the box.; isOpenDesc=This box is open.; openingDesc=You open the box.>
action <opened> {
if not flag <box opened> then {
inc <Score; 1>
flag on <box opened>
msg <#(TLSthisObj):openingDesc#>
}
else msg <#(TLSthisObj):openingDesc#>
}
end define
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end defineIf there's anything you don't understand here, ask and I'll try to explain.
Al (MaDbRiT)
Anonymous
08 Oct 2004, 19:01' "beach"
' Created with QDK Pro 3.52
!include <Typelib.qlb>
define game <beach>
asl-version <350>
gametype singleplayer
start <beach>
game author <Steve - hacked by MaDbRiT>
game info <Created with QDK Pro 3.52>
define variable <Score>
type numeric
value <0>
display <! Points scored>
end define
QuestNet
end define
define synonyms
get=take
end define
define room <Beach>
alias <beach>
prefix <the>
look <You find yourself on a beach. Along the shore are parts of the royal ship torn apart by the angry sea. A small sandy path leads to the north through the tall grass. >
north <Path>
define object <ring>
look <Prince Alexander's royal insignia ring.>
take {
msg <You take the royal insignia ring.>
give <ring>
inc <Score; 1>
}
speak <This ring cannot speak.>
examine <Prince Alexander's royal insignia ring.>
prefix <the>
article <it>
gender <it>
end define
define object <plank>
look <This large plank seems to be from Alexander's ship. It does not look too heavy.>
speak <It's made of wood and cannot speak.>
prefix <the>
article <it>
gender <it>
type <TLTobject>
action <take> {
if not flag <plank moved> then {
msg <You move the plank aside revealing a small box.>
move <box; Beach>
inc <Score; 1>
flag on <plank moved>
}
else msg <The plank has already been moved.>
}
end define
define object <coin>
look <A coin from Daventry.>
type <TLTobject>
type <TLTcontainable>
action <take> {
msg <You take the Daventry coin.>
inc <Score; 1>
give <coin>
}
speak <Coins can't talk.>
prefix <a>
article <it>
gender <it>
properties <isIn=box>
end define
end define
define room <limbo>
define object <box>
look <This is a small sturdy box.>
speak <It's just a box.>
prefix <the>
article <it>
gender <it>
type <TLTcontainer>
type <TLTclosable>
properties <not takeable; listHeader=The small box contains; isClosedDesc=This box is closed.; closingDesc=You close the box.; isOpenDesc=This box is open.; openingDesc=You open the box.>
action <opened> {
if not flag <box opened> then {
inc <Score; 1>
flag on <box opened>
msg <#(TLSthisObj):openingDesc#>
}
else msg <#(TLSthisObj):openingDesc#>
}
end define
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end defineAl (MaDbRiT)
steve the gaming guy
08 Oct 2004, 19:31steve the gaming guy 8)
Anonymous
08 Oct 2004, 20:08Have you noticed in other situations where typelib makes quest ignore the take tab? Is there another place to enter a script when a player takes an object?
The current version of typelib will ALWAYS ignore the standard QDK take tab when you use typelib's takeable type for an object. This is because typelib adds a default take *action* to objects which overrides the regular take tag (as all actions do). It is slightly irritating and I've coded it differently for the next version of typelib, but for the moment you just have to do things a little differently.
All that is needed is to add your own action called "take" to the object you want to amend - and put your script in this. As a local action will take precedence over the inherited default, you can effectively take over and do your own thing this way whenever needed.
Al (MaDbRiT)
Anonymous
09 Oct 2004, 02:51I sort of understand where you were going with that suggestion but I just am not certain where in QDK you are suggesting to enter the script.
Steve the confused
steve the gaming guy
09 Oct 2004, 03:20The code you presented worked like a charm in regards to opening the box and getting the coin. However, I can't take the ring despite what the code says. Just thought I'd mention it. Thanks for the box code though!
steve the gaming guy
Anonymous
09 Oct 2004, 08:17I assume you mean to create my own special action commands in the room or game properties section. Which I take to mean in this example, I would type "take or move plank" and a script is assigned to the command and not the plank?
I sort of understand where you were going with that suggestion but I just am not certain where in QDK you are suggesting to enter the script.
No, not in the room/game properties! - that's not what I mean
What you need to do add a take action to the OBJECT ITSELF. Using QDK's Interactions pane, select the object (plank in this case) click 'edit properties and actions' select the actions sub pane and then add an action calling it 'take'. This action will then be used by typelib rather than the default 'take action' typelib provides, so you put your script here.
If you load the code I gave above into QDK, this is where you'll find those take actions are set up.
The code you presented worked like a charm in regards to opening the box and getting the coin. However, I can't take the ring despite what the code says. Just thought I'd mention it. Thanks for the box code though
O.K. I admit I forgot all about the ring when I changed your code - oops! What I did with the other objects was (as I indicated) make them typelib types and then use an overriding take action exactly as I suggest above - that'll fix it...
Try substituting the code below (using a text editor) for the ring definition in the code I gave - I've not actually tested it but it ought to work
define object <ring>
look <Prince Alexander's royal insignia ring.>
type <TLTobject>
action <take> {
msg <You take the royal insignia ring.>
give <ring>
inc <Score; 1>
}
speak <This ring cannot speak.>
examine <Prince Alexander's royal insignia ring.>
prefix <the>
article <it>
gender <it>
end define
You might want to use a flag so that the player doesn't collect extra points by continually dropping and taking the coin - as you did with moving the plank of course.
Al (MaDbRiT)
Anonymous
10 Oct 2004, 19:30Thanks for showing me the code you wrote though. I would have never guessed to use TAKE in the ACTION tab. That is cool!
Right now, I'm taking a day or two break from the game so I can look for a companion book to the original game so I can remember a lot of the story and conversations. Every time I find it, I misplace it shortly after! AARRGGH!
Anyway, thanks again.
steve the gaming guy