Room (location) display problem

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Tdarcos
Posts: 9333
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Room (location) display problem

Post by Tdarcos »

I'm not sure what is being done wrong but I welcome any suggestions.

I started a new game which I am calling The Librarian. I used the "new" shell from RoodyLib¹ and made substantial modifucations, but when I compile and run the game, on startup there is no description of the room and the LOOK command doesn't work either even though the room has a long_desc property.

I thought, maybe I'm doing something wrong as I wanted the player to start the game waking up on their bed, and maybe placing the player on an object (instead of a room) caused problems. So I had him arrive in the room, and still no description.

So I thought I'd check, so I compiled a vanilla (stock, unmodified) Roodylib shell (rdyshell.hug) to check it compiles, then modify it to add a long_desc to the only room, and save, compile and run. Curiously, it also shows no information.

So then I went to the Hugo supplied template (shell.hug) compiled a vanilla copy, then added long_desc, save, compile and run. Guess what the result was? If you said, "it also didn't show descriptions" you're absolutely right!

But it gets more interesting. I downloaded hugozork.hug from hugo source code on IF Atchive. This is Kent Tessman's port of a TADS port of the Fortran release of Dungeon, the predecessor to what would become Zork I.

Other than correcting two lines having minor errors due to language changes (the code says its written for version 2.7, we're using 3.1), it's essentially vanilla. And this almost stock copy works perfectly, when the game starts, it shows the description of the clearing at the mailbox in front of the white house.

So clearly it's possible to get room descriptions to show but I'm not sure why they don't. I'm asking for any suggestions. Failing to find one, I'll use the "great artist" method². Take HugoZork, rip out every room, object, fuse, and daemon (except for the initial room), and be sure the description function still works, then save that as a template to build games. Then slowly add pieces from my current game, being sure that I don't break functionality in the process, then continue building from there. Or possibly leave some complex pieces as templates to show how to use those features (like doors, rooms whose directions change, daemons, and fuses,)

Thank you for your time reading this message.


- - - -
¹ I want to give a shout out to Roody Yogurt for his work on RoodyLib, especially having read his code. One really devious piece of work was to find a way to have some objects specially reinitialized differently from what the RESTORE command does. But since all user variables and objects are reinitialized, how do you save anything? You use a system variable that is not saved or restored. So each object that wants to survive restore becomes part of the init_instructions family and type settings, then before restore, the object indicates it wants to survive RESTORE, so its name is saved in the system array word[], (which is not restored) then after restore the object's execute property is called to allow it to do whatever it needs. A brilliant solution. Very slick.

² "Good artists borrow, great artists steal."
Alan Francis wrote a book containing everything men understand about women. It consisted of 100 blank pages.

User avatar
Ice Cream Jonsey
Posts: 28878
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Re: Room (location) display problem

Post by Ice Cream Jonsey »

Did you define the player object and did you move the player to the room you want the player to be in?

I have this in the routine Init() of the first game that came up:

Code: Select all

	player = you                    ! player initialization
	location = emptyroom
	old_location = location

	move player to location
	FindLight(location)
Do you want to post your routine init(), Commander?
the dark and gritty...Ice Cream Jonsey!

User avatar
Tdarcos
Posts: 9333
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Re: Room (location) display problem

Post by Tdarcos »

Ice Cream Jonsey wrote: Sat Nov 16, 2019 10:01 am Do you want to post your routine init(), Commander?
Certainly. As I said, it started out as the stock RoodyLib template:

Code: Select all

!::	Game Initialization	routine
routine init
{
!: First Things First
	SetGlobalsAndFillArrays
!: Screen clear section
#ifclear _ROODYLIB_H
	CenterTitle("Hugo Interactive Fiction")
	cls
#ifset USE_PLURAL_OBJECTS
	InitPluralObjects
#endif
#else
	SimpleIntro
	InitScreen
!: Set up any special libries
	Init_Calls
#endif
!: Game opening
	IntroText
	MovePlayer(location)
   
}
I thought the way he breaks up init into separate routines by functionality was a great idea and I've followed it, putting array, property and global initializations into SetGlobalsAndFillArrays. I can see where this reduces clutter and makes finding things easier, and probably improves maintenance.

One thing amateur programmers forget (or are unaware of) is that every program requires maintenance. Unless it's very small, done perfectly the first time, and will never have anything added, even simple programs need maintenance. Even personal-use programs. When you start the creation of an IF game either from a template or be an "iron man¹" and start from scratch, once you get the first really simple piece "barely breathing²," and work to expand it from there to flesh out the game, everything you do to that application is now maintenance (or maintenance and development).

Let's face it, except for people doing "oh yes you can do it, here's the code to prove it, and fuck you too," demonstrations - like I did when making Teleport Test after you said it wasn't possible to implement a "go anywhere" teleporter - almost all IF is written for the same reason I write books, because I wanted to experience the story, and since no one else had written it, I had to.


- - - -
¹ This term long predates the movie, and refers to someone who is doing a very complicated or strenuous task without assistance.
² I use it in the sense from the movie Crimson Tide where Vossler is trying to fix the radio, and wants to prevent a nuclear holocaust, so when the equipment is just barely working, he reports on the intercom, "she's breathing."
Alan Francis wrote a book containing everything men understand about women. It consisted of 100 blank pages.

Roody_Yogurt
Posts: 2179
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Re: Room (location) display problem

Post by Roody_Yogurt »

Did you modify DescribePlace in any way? Maybe something you did broke something. Hugozork has its own DescribePlace replacement so maybe that's why the code works there.

User avatar
Tdarcos
Posts: 9333
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Re: Room (location) display problem

Post by Tdarcos »

I found the problem and I feel stupid.

In testing this I had a value set for all three: initial_desc, long_desc, and short_desc, and some combination of all three of these confused displayplace or the game engine. Probably the former. Once I only had long_desc and that was assigned a block¹ as opposed to just a string, it worked, and long_desc was displayed.

Now since I know I didn't check this properly - or should I say "didn't check this property" - I'll see if same-line quoted string works or for the string to work it has to be on the following line. Or maybe it has to be in a block but somehow I don't think so.


- - - -
¹ A block is a piece of executable code surrounded by braces, like
{
… some code …
}
Alan Francis wrote a book containing everything men understand about women. It consisted of 100 blank pages.

User avatar
Tdarcos
Posts: 9333
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Re: Room (location) display problem

Post by Tdarcos »

Apparently, same-line, unblocked values for properties not being displayed is ok but values for properties being displayed must be on the next line or in a block.
Alan Francis wrote a book containing everything men understand about women. It consisted of 100 blank pages.

Post Reply