Page 1 of 1

Window Panes

Posted: Mon Jan 09, 2012 9:15 am
by Flack
I read the part about windows (separate panes, not Microsoft Windows) in the Hugo Book, but I'm not getting something.

Could anyone (like someone who wrote a big Hugo adventure game about cryptids that effectively utilized multiple window panes) post the basics here for us dummies?

What I would like to include, for lack of a better explanation, would be something like a heads up display (HUD) that presented additional information to the player as he moved through the game.

Posted: Mon Jan 09, 2012 11:14 am
by Ice Cream Jonsey
Oh it's possible!

How about this. I'll be home tomorrow night, and I'll post some code. (Although since you bought Cryptozookeeper, you have the source code to how I did Windows on the disc.) In the meantime, can you go into MS-Paint and sort of draw some lines that show how you'd like the display to look? Because what I can do is then put it together and document how I did it. It would serve to be a valuable resource on setting up Windows for future Hugonauts.

Posted: Mon Jan 09, 2012 11:22 am
by Roody_Yogurt
This page tries to break down windows a bit:
http://hugo.gerynarsabode.org/index.php?title=Window

Other important rules-
  • 1. You cannot have the main window (the window you type in) above another window.

    2. If you make a window that just takes up a corner, the main window won't scroll text up to the area next to the corner window (it can't coexist horizontally). The trick then is to try to make all of that blank space look intentional (or figure out a way to fill out the rest of that part of the screen with more windows).

    3. You'll need to put calls to routines that redraw you windows in the main routine so they are updated after every successful turn. (I'm sure this is mentioned in the book and on the page, but it's an important one).
Also, to get yourself acquainted with your screen "real estate," maybe you'd want to use something like my DoScreen verb routine. It's just a silly little thing I wrote when figuring out how an earlier game would look on different kinds of interpreters, but maybe seeing your window's character measurements might help you plan out windows more effectively.

Code: Select all

routine DoScreen
{
print "The screen width is "; number display.screenwidth; " characters."
print "The screen height is ";  number display.screenheight; " characters."
print "The line length is "; number display.linelength; " characters."
print "The window lines height is "; number display.windowlines; " characters."
print "The status line height is "; number display.statusline_height; " characters."
print "This interpreter ";
if display.hasgraphics
	"supports graphics."
else
	"does not support graphics."
}

Posted: Mon Jan 09, 2012 1:11 pm
by Flack
Ice Cream Jonsey wrote:In the meantime, can you go into MS-Paint and sort of draw some lines that show how you'd like the display to look? Because what I can do is then put it together and document how I did it. It would serve to be a valuable resource on setting up Windows for future Hugonauts.
Image

Posted: Mon Jan 09, 2012 2:15 pm
by Roody_Yogurt
I'd say that's very doable.

Posted: Mon Jan 09, 2012 2:57 pm
by pinback
Eheheh.

Posted: Mon Jan 09, 2012 8:52 pm
by Roody_Yogurt
I put up a proof-of-concept here:
http://roody.gerynarsabode.org/JC/flack.hug

It needs window.h and resource.h from the Hugo Library, and it looks for a pinback picture called "pinback.jpg".

As you can see, borders only have a so-so success, and I had to futz with it a lot just to get it looking that nice in both hewin and Hugor.

I imagine that's part of the reason Robb faked borders in CZK by putting them in the graphics themselves.

Still, if that's good enough for you, feel free to adapt my code for your own purposes.

Posted: Tue Jan 10, 2012 10:38 am
by Tdarcos
pinback wrote:Eheheh.
It could be worse, Ben, that could be my picture. Yours is simply disgusting, but mine violates obscenity laws in twelve states and the District of Columbia!

And that isn't even counting my infamous elephant picture!

Posted: Tue Jan 10, 2012 8:33 pm
by Ice Cream Jonsey
Jesus! Roody nailed it. Flack, I am sending you the compiled game and source code.

If you are implementing the game you mentioned over e-mail, I guess the real decision for you is how you want text to appear in that right most pane. Do you want to use an array with several dozen pieces of text? Do you want to have a piece of text as a property of an object and then print that? You can do.... anything. (Except have the main text window on top of something.)

Posted: Tue Jan 10, 2012 11:18 pm
by Roody_Yogurt
If we are okay with bucking tradition, here is a version that just switches the two windows, which looks better on hewin (text in the right window seems to do a little bit of graphic distortion... at least in my current font):

http://roody.gerynarsabode.org/JC/reverseflack.hug

Anyhow, glad to help.

Posted: Wed Jan 11, 2012 4:05 pm
by Flack
Thanks for the quick and thorough responses guys, I really appreciate it.

I am in a scripting class all week (Microsoft PowerShell sadly, not Hugo or IF related -- although ...) and am too worried about combining apples and oranges to get into this (or put the spit shine on "Spinning", for that matter) until this weekend.

Posted: Wed Jan 11, 2012 5:24 pm
by Roody_Yogurt
Good luck with your class!

Posted: Wed Jan 11, 2012 8:51 pm
by Flack
The class is shit. For starters, when I walked into the room everybody in the room got a copy of the manual on a thumb drive except me and my co-worker. Because we put down that we worked for the FAA, they (Microsoft) said we were intelligible for any "gifts" from their company. Legally I am required to decline any gift from any customer we directly do business with that is worth more than $20. I don't know where Microsoft is buying their 1 gig USB sticks, but if they're paying more than $20, they should shop around.

You know how most languages get most things right, but there's always that one thing that will drive a newcomer nuts? (Like, "end every line with a semi-colon"?) In PowerShell, you don't use <, >, or = to compare strings -- instead, you would use -lt (less than), -gt, -le (less than or equal to), or -eq. So yeah, I looked at a script for 10 minutes trying to figure out why "if $a > $b" wouldn't work, when the correct syntax would be "if $a -gt $b".

Of course it would be a lot easier if I had a copy of the manual. Harumph.

Posted: Thu Jan 12, 2012 10:29 am
by Tdarcos
Flack wrote:I don't know where Microsoft is buying their 1 gig USB sticks, but if they're paying more than $20, they should shop around.
Right off the top of my head I think retail they're around $5, so that probably means around $2 in carload quantities. I just glanced and right off the bat, Micro Center sells - in store, at retail - its own 8 GB thumb drives for $7.99, 16GB at $13.99, 4GB at $4.99.

Not only that, they're so cheap that even a 2GB is also $4.99 and they don't sell anything smaller!

Talk about nailing it, I didn't even have to look, I said $5 and I was dead-on right, and that's for a 4 GB.

I still have the first thumb drive I ever bought, I can't remember what it cost - probably $10 back then - and holds a whopping 64 megabytes!
In PowerShell, you don't use <, >, or = to compare strings -- instead, you would use -lt (less than), -gt, -le (less than or equal to), or -eq. So yeah, I looked at a script for 10 minutes trying to figure out why "if $a > $b" wouldn't work, when the correct syntax would be "if $a -gt $b".

Of course it would be a lot easier if I had a copy of the manual. Harumph.
Are they kidding? I mean, I'm used to it, but use of GT, LT, NE, EQ etc. goes back to Fortran 66! As bad as C is and the problems it has, it still uses the standard <, ==, > to do comparisons. (Well, maybe not standard, most other languages use plain = and that's one of the things C got badly wrong; there's no legitimate reason to put an assignment in the middle of a comparison.)

Pascal solved the problem of the confusion of = as comparison and = as assignment by the use of the symbol "becomes", := as the exclusive assignment operator. Although I don't think it was that much of a problem, other languages handled = as assignment and = as comparator and most people didn't have a problem. But putting = as an assignment operator in comparisons was a brain dead moronic error.

One thing C did get right was the use of the double plus, double minus and "operator =" constructs, e.g. a++, --a, a *= 5, a -=k as substitutes for a=a+1; use a: a=a-1; a = a*5; and a=a-k. One thing C got horribly wrong was case sensitivity on identifiers.

Posted: Thu Jan 12, 2012 10:47 am
by RetroRomper
Is there a reason (besides the obvious) that Microsoft developed their own language as opposed to using batch or Python? Or even FORTRAN for that matter...

Bloody christ though, another scripting language? Does the world need another scripting language?

Posted: Thu Jan 12, 2012 10:55 am
by Tdarcos
RetroRomper wrote:Is there a reason (besides the obvious) that Microsoft developed their own language as opposed to using batch or Python? Or even FORTRAN for that matter...

Bloody christ though, another scripting language? Does the world need another scripting language?
"You know engineers, they love to change things!"
- Dr. Leonard McCoy, Star Trek I

Posted: Sun Jan 29, 2012 5:43 pm
by Roody_Yogurt
I decided to take on the window-distortion-when-you-have-text-along-the-window-edge issue by writing a routine thing-y that wrote everything to a string and figured out proper margins. Just when I was about to do this, it occurred to me that it'd be a lot easier to just draw a "margin window" that covers the entire window area but then draw a smaller window within that to hold all of your text.

I tried it out with our running example here, and it seems to work fine! http://roody.gerynarsabode.org/JC/flacktaketwo.hug

So yeah, that is a tip that many games with windows could benefit from, I'd think!