How to implement an image on each turn/room entry

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
Paul Robinson
Posts: 145
Joined: Fri Sep 30, 2011 9:40 am
Location: Just ask TDarcos; he knows

How to implement an image on each turn/room entry

Post by Paul Robinson »

I'm not sure exactly how to do it, but how is it in some games, and I think CryptoZookeeper does that, where, when someone goes into a room it shows an image, i.e. the picture image of the room - perhaps as an alternative or in addition to describing it - so that it's showing the image when someone enters the room. If there's source code around showing how this is done, that's fine but I wanted a general idea how it's done.

I think forcing things into 8 lines has sharpened my thinking. I've got to be much more careful to be precise now. (Again, just squeaked into 8 lines!)

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

Post by Roody_Yogurt »

What I would do is:

- Have a routine called by main that draws the window that will show your graphic (as main is called after every successful turn)
- Have the graphic being drawn be stored in a global variable so you can easily update what graphic is being shown.
- Have code that updates the global variable in applicable situations, like putting the following in your room object:

Code: Select all

after  {
        location MovePlayer
           {
           current_graphic = <room>
           &#125;
That'd change the current_graphic global variable to whatever you want, which would then be drawn when main is called after the turn is over.

You could do the same thing for DoLookAround (to bring the graphic back to the room after looking at something else).

Does that help, or would you like me to go in further detail about something?

User avatar
Paul Robinson
Posts: 145
Joined: Fri Sep 30, 2011 9:40 am
Location: Just ask TDarcos; he knows

Post by Paul Robinson »

Roody_Yogurt wrote:(1)draw window show graphic (2)
graphic stored global variable (3) update gv in room object:
(4) do for DoLookAround
Does #3 mean putting routine every room or can have list of pictures assigning one to each room and how assigned? E.g. @ entrance to Freeway, show freeway entrance with sign. @ entrance to airport, airport entrance; approaching warehouse, the building, etc. Or could there be a window at the top for a graphic, the text scrolls below but window stays fixed, then on a move, it changes the image in window?

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

Post by Roody_Yogurt »

Paul Robinson wrote: Or could there be a window at the top for a graphic, the text scrolls below but window stays fixed, then on a move, it changes the image in window?
Yeah, I was describing how to do this (it's the style used in Guilty Bastards and Robb's graphical games).

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

Post by Roody_Yogurt »

You can look see for yourself how Guilty Bastards does it by looking at GB's source, too: http://ifarchive.org/if-archive/games/s ... source.zip

Post Reply