Same room, different graphic redux

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

Hugella

Same room, different graphic redux

Post by Hugella »

Back in 2000, Jonsey posted <a href="http://groups.google.com/groups?q=hugo+ ... num=340">a question</a> to raif asking basically, how can i get a single room object to display multiple pictures based on the current status of that room.

Did you ever get an answer? (Google doesn't record one.)
If so, what is it?

Kent
Posts: 119
Joined: Fri Jun 27, 2003 12:10 pm

graphic property routine

Post by Kent »

Hmm. Actually that should work (the example Robb posted). I don't remember if we eventually figured out what was going on or not.

Anyway, what I usually use is a property routine. (This example is a lot simpler if you assume all graphics are in the same resourcefile.)

So in the room object, I might have something like:

Code: Select all

graphic
&#123;
     if roomdoor is open
          return "roomgraphic_dooropen"
     else
          return "roomgraphic_doorclosed"

     etc.
&#125;
That way, all the logic for the room's graphic gets kept in one place.

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

Post by Ice Cream Jonsey »

Whoa! Thought I responded to this.

I use this method:

Code: Select all

	graphic
	&#123;
	
		select&#40;LocationState&#91;11&#93;&#41;
			case 1
			&#123;
				current_resource_file = "mall"
				current_resource = "sporting01"
			&#125;

			case 2
			&#123;
				current_resource_file = "mall"
				current_resource = "sporting02"
			&#125;

			case 3
			&#123;
				current_resource_file = "mall"
				current_resource = "sporting03"
			&#125;
			else
			&#123;
				current_resource_file = "mall"
				current_resource = "sporting01"
			&#125;

		return -1
	&#125;
If I remember right, the thing I was missing was the "return -1" bit.

If you're stuck at all, Hugella, just let me know. I've got plenty of source code I can send you with multiple graphics going on in the same room. I did wrestle with it for a night a few years ago, but Kent pointed me in the right direction, and I definitely hope that getting it working yourself doesn't slow you down, because the solution's all there.


Robb
the dark and gritty...Ice Cream Jonsey!

Hugella

Post by Hugella »

Robb, I'd be happy to see *any* source code you wanted to share. As much as possible! :)

Seriously though, I'd appreciate it.

Post Reply