Go To Room problem

steve the gaming guy
18 Nov 2004, 14:46
Alex or MaDbRiT

Stranger and stranger...The game I'm working on has a town with a few shops. When the player walks into the town, the shops are set up as "Go To" rooms. They seem to work fine. I'm working on a different part of the game now where there is a room called small cottage which is basically the outside area of the cottage. To go inside the cottage, I have that set up as a "Go To" room also. But I can't get it to work for some reason. When you try to go there, it says "You can't go there" AAAHHH!!!


' "King's Quest V - text adventure"
' Created with QDK 3.52 - UNREGISTERED VERSION

!include <Typelib.qlb>

define game <King's Quest V - text adventure>
asl-version <350>
gametype singleplayer
start <small cottage>
game author <Steve Lingle>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
startscript do <start>
afterturn doaction <Cedric; following>
command <look at path> msg <The path is sturdy enough to walk on.>
command <look path> msg <The path is sturdy enough to walk on.>
command <x path> msg <The path is sturdy enough to walk on.>
command <examine path> msg <The path is sturdy enough to walk on.>
define variable <Score>
type numeric
value <0>
display <Score: ! of 230>
end define
end define

define synonyms
take = get
end define

define room <small cottage>
prefix <the>
look <A small cottage sits off of the main path that runs parallel to the stream. The cottage is made of stone and a small stone chimney reaches to the trees. It seems someone is here as you can see licks of smoke creeping from the chimney. An aging oak tree completes the picture that reaches its limbs across the length of the house out in front. On the front of the cottage is a small sign.|nTo the east is the entrance to the small town. To the north is a clearing in the forest. To the west is a small country inn.>
indescription <You are in front of>
north <clearing>
east <town entrance>
west <small country inn>
place <the; small cottage - inside>
command <read sign> msg <The sign says "Freshly Baked Pies">

define object <sign>
look <A small sign is nailed to the front of the cottage next to the door.>
examine <The sign says "Freshly Baked Pies">
prefix <the>
article <it>
end define

end define

define room <small country inn>
prefix <the>
look <The main path continues on east and west in front of a small country inn. In the back, you see a small barn with a large haystack sitting in front of it. A worn path winds its way north between the barn and the inn.|nTo the east is a small cottage. To the west is a more barren area with an old rotting tree. To the north you can make out a small house built into the bottom of a tree.>
indescription <You are in front of>
north <tree house>
east <small cottage>
west <old rotting tree>
place <the; small country inn - inside>

define object <barn>
look <A small barn sits towards the back of the land on which the inn is located.>
examine <There's nothing much interesting about this barn. The doors are locked.>
prefix <the>
article <it>
end define

end define

define room <inven room>

define object <crispin's wand>
alt <wand>
look <Crispin's wand seems dormant at the moment and does not seem to possess any magical power.>
speak <Talking to the wand will do nothing.>
article <it>
gender <it>
use msg <You wave the wand but only a couple sparkles fizzle out from the wand and nothing happens.>
use on anything msg <You wave the wand but only a couple sparkles fizzle out from the wand and nothing happens.>
drop nowhere <>
end define

define object <Cedric>
alt <owl; bird>
look <Cedric minds his own business as you explore your surroundings.>
take msg <Cedric would not appreciate you trying to pick him up.>
prefix < >
type <TLTactor>
properties <displaytype=owl>
action <following> if flag <cedric_following> and ( $locationof(Cedric)$ <> #quest.currentroom# ) then move <Cedric; #quest.currentroom#>
action <speak> do <cedric>
end define

define object <silver coin>
alt <coin>
look <A small silver coin.>
take {
msg <Graham picks up the silver coin.>
inc <Score; 1>
}
prefix <the>
article <it>
gender <it>
drop nowhere <The silver coin can be used elsewhere.>
end define

end define

define room <small country inn - inside>
prefix <the>
look <The inn is rather empty aside from the rough looking clerk behind the counter. He is having a conversation with two other roughly dressed men. They are just out of earshot so you can't hear what they are saying.>
out <out; small country inn>
end define

define room <small cottage - inside>
prefix <the>
look <Inside the small cottage, you can see a variety of baked goods. The smell of fresh bread hits your nose as soon as you walk in. On the front counter, a freshly baked custard pie sits tempting you.|nA baker in the back room can be heard clanging dishes and scurrying back and forth cooking the next batch of bread. The head baker is behind the counter near the custard pies.>
out <the; small cottage>

define object <bread>
look <The freshly baked bread fills the bakery with a pleasant aroma.>
prefix <the>
article <them>
gender <they>
invisible
type <TLTscenery>
end define

define object <custard pie>
look <This freshly baked pie looks and smells delicious.>
take {
msg <Graham requests the custard pie from the baker.|n|n|cr"I'd like to buy that custard pie, good man."|cb|n|n|cl"Of course, that will be one silver coin."|cb|n|n>
wait <press any key>
if got <silver coin> then {
msg <Graham hands the baker his silver coin.|n|n|cl"Very good. Now enjoy your pie."|cb|n|n>
give <custard pie>
lose <silver coin>
move <silver coin; inven room>
wait <press any key>
}
}
prefix <the>
article <it>
gender <it>
end define

define object <counter>
look <The counter has an array of freshly baked custard pies.>
prefix <the>
gender <it>
end define

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define


Please help!!!! :!: :!:

Alex
18 Nov 2004, 18:57
Looking at the string variables debug window, quest.command shows that "inside" is being converted to "into". This is a synonym set up in TypeLib.qlb. Since there's no room "small cottage - into" you get an error.

I suppose one work around for this is to hard-code the command "go to small cottage - into" but it's rather messy.

steve the gaming guy
18 Nov 2004, 19:36
Alex wrote:Looking at the string variables debug window, quest.command shows that "inside" is being converted to "into". This is a synonym set up in TypeLib.qlb. Since there's no room "small cottage - into" you get an error.

I suppose one work around for this is to hard-code the command "go to small cottage - into" but it's rather messy.


Alex,

I thought it was going to be something of that nature but I wasn't sure how to read the code properly. Thank you for narrowing that down for me.

:shock: :lol:

steve the gaming guy
22 Nov 2004, 18:44
I never did verify until today since I've been working on the desert portion of the game.
I changed the room name to show 'small cottage - indoors' and it seems to be working just fine. Thanks for pointing out where I went wrong!

:shock: 8) :lol:

Anonymous
24 Nov 2004, 15:57
Hi Steve

Yeah, the synonyms in typelib are causing the issue here, although I do strongly advise you to use MUCH shorter object names in code and use 'aliases' to get more verbose descriptions.

But whatever, here's an interesting tip that comes to mind. You can override/unravel typelib's synonyms (or anything else) by adding another library before it in your code...

e.g. This little library would have solved your 'inside - into' problem without needing any changes (though as I say I think you ought to change the names you use anyway!)

!library

!asl-version <311>
!name <Override Type Library>
!version <1.00 24-Nov-2004>
!author <MaDbRiT (Al Bampton)>

!addto synonyms
inn - into = inn - inside
cottage - into = cottage - inside
!end


If you save this as (say) 'fixlib.qlb' and then INCLUDE it into your game before typelib, it will (for the inn - into & cottage - into errors only) fix your problem.

I don't actually recommend you do this on this particular occasion, but thought you might find it interesting to see how you can fine tune what typelib does without actually altering the typelib code.

Al (MaDbRiT)

steve the gaming guy
24 Nov 2004, 16:14
Hey Al,

Yes, I did get it to work by changing the name. As far as the length of the name, I did try to shorten that as well and where I didn't, I changed the aliases and added other names that could work. Ex: "Go to the small country inn" can simply be "Go to the inn"
This, of course, is helpful for those who wish to type everything and not take advantage of the display on the right side of the screen. If you used that, you could simply double-click the small country inn and it would take you there.

That is a very interesting tidbit of information about adding the library. I will keep that in mind for future use.

Thanks!