Need Advice

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

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Need Advice

Post by Debaser »

Okay:

Suppose a guy wanted to make a game with a nearsighted main character. Suppose he furthermore wanted to have a "glasses" object in the game that, when not worn, would cause the game to function effectively as if there were no light sources present, only with different descriptions (i.e., instead of "You stumble around in the dark.", "You stumble around, everything an indecipherable blur."). Suppose, furthermore, that this guy wanted to make at least one room in this game that functioned differently than the others while the character was despectacled (basically, the main character's bedroom which he knows so well he can effectively navigate it blind). What would be the most efficient way for this hypothetical individual to go about creating this effect?

Keep in mind that, in my example, the programmer would have no real programming experience and only a smattering of semi-formal training and would therefore need somewhat detailed advice.

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

Re: Need Advice

Post by Ice Cream Jonsey »

Hugo supports the "darkness" feature, which works just as it did in Zork. I think that in this case you have a different sort of darkness that you want to implement in your game -- not one of pitch blackness, but of blurred vision.

So, you can change the default response to when "darkness" is enabled so that rather than have it says, "You can't see anything," it says, "You stumble around, everything an indecipherable blur." You can then have the glasses object provide "light" when worn.

I think that having the glasses provide light when worn is just as easy as, say, having a character provide consciousness when their hitpoints are above zero (which is something I have experience in doing and I think the theory is the same). So unless I am totally forgetting something, I think getting your environment modelled the way you'd like it to be wouldn't be too tough. I'd be happy to help you out with this when you get going.
the dark and gritty...Ice Cream Jonsey!

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

Hmph. Okay, part of the problem is I'm still trying to learn all the commands in Hugo. The last time I tried to code IF, it was in TADS and I was pretty much able to get by cutting and pasting sample code and renaming things - eventually from there I was able to deduce most of what I needed. Hugo seems more intuitive in a lot of ways but you still (or *I* still, to be more precise) find your(my)self stuck on things like whether it's "if glasses(worn)" or "if worn(glasses)" or something else entirely.

But yeah, I figured the answer would be in the darkness code somewhere. I tried replacing the "moveplayer" routine and appending a second check for the glasses that would result (if failed) in a blindwarning routine modeled essentially off the "darkwarning" routine (which provides the "you stumble around in the dark") message. Which is all fine and dandy, except that it doesn't work. And I'm not sure if it doesn't work because I'm doing the check wrong or if it doesn't work because the logic behind this entrie line of approach is flawed.

But, if I could get my "blindwarning" routine to actually call, I'd only be faced with the simple (if tedious) process of modifying all the relevent verbs to run a simliar check (again modelling on the code for the already present light source check). And then figuring out how to allow for the aforemention exceptions, but I can cross that bridge when I come to it. And then actually coding the rest of the game, but eh.

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

Post by Ice Cream Jonsey »

Debaser wrote:But yeah, I figured the answer would be in the darkness code somewhere. I tried replacing the "moveplayer" routine and appending a second check for the glasses that would result (if failed) in a blindwarning routine modeled essentially off the "darkwarning" routine (which provides the "you stumble around in the dark") message. Which is all fine and dandy, except that it doesn't work. And I'm not sure if it doesn't work because I'm doing the check wrong or if it doesn't work because the logic behind this entrie line of approach is flawed.
(I check the BBS way too frequently, and sometimes I miss posts the first time around. So this is my response, terribly late:)

If you like, feel free to link what you think the offending code is, or what you think may be at fault. I'd be happy to give it a scan and see if I can figure out what is problematic. If you don't want the world to see it, feel free to send it to <beaver@zombieworld.com> or put it in a private message off the BBS.
the dark and gritty...Ice Cream Jonsey!

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

Actually, your tardy reply probably just saved this game. I'd pretty much forgotten about it over the past twelve days and, seeing your post, it occured to me that "Hey, I was writing a game at one point!". Had you responded promptly, I would have never gotten this wakeup call.

On a related note, the check I was looking for is "if (glasses is not worn)", which is probably the most obvious choice in the world when you think about. I was finally able to deduce this from the ACS sourcecode which I also just thought to check for after a month of intermittedly banging my head against the wall and not doing anything. And what do you know but it ends up working like a dream. So really this whole incident would be a major public embarassment except that I doubt anyone but Robb and myself has actually more than glanced at this thread anyway.

The upside is that, now that I have a decent sample to work from (rather than trying to scour the manual, which seems a bit short on actual syntax examples), I'll hopefully be able to ramp productivity back up to my previous "three working lines of code a day" efficiency. On the downside, finding ACS's source has reminded me of ACS's menu conversation, which I'll probably end up talking myself into trying to include (since I find ask/tell generally kind of bites if you're trying to provide characterization of any depth and aren't willing to approach "Galatea" level thoroughness). So expect me to be back in a few days asking you for help with that.

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

Post by Ice Cream Jonsey »

Debaser wrote:The upside is that, now that I have a decent sample to work from (rather than trying to scour the manual, which seems a bit short on actual syntax examples), I'll hopefully be able to ramp productivity back up to my previous "three working lines of code a day" efficiency. On the downside, finding ACS's source has reminded me of ACS's menu conversation, which I'll probably end up talking myself into trying to include (since I find ask/tell generally kind of bites if you're trying to provide characterization of any depth and aren't willing to approach "Galatea" level thoroughness). So expect me to be back in a few days asking you for help with that.
Right on, sounds great. It might be a bit unintuitive to see which global variables are required to setup menu-style conversations using the Photopia-based module (I don't think I commented the code that I translated into Hugo very well) but that can be sorted out pretty quickly. Keen!
the dark and gritty...Ice Cream Jonsey!

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

Hrm. Yeah. I think I'm kinda sorta seeing how this works, but a basic overview of the dialogue code would be greatly appreciated.

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

Post by Ice Cream Jonsey »

OK, I'll try to put together a little something this weekend. If you run into a question before I get my code sloughed up onto the BBS, just give me a holler.
the dark and gritty...Ice Cream Jonsey!

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

Post by Ice Cream Jonsey »

Er, in the meantime, the code up on the archive that is called phototalk or something (it's in a sub-dir of the Hugo directory) should in fact work OK. I'll try to expand on it on the BBS here, though.
the dark and gritty...Ice Cream Jonsey!

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

I have a love/hate relationship with IFArchive. There is no way I would have *ever* found that if you hadn't specifically told me it was there. Even then... bleh. Anyway, thanks, this is a step up from trying to extract the code from the ACS source.

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

Ice Cream Jonsey wrote:OK, I'll try to put together a little something this weekend. If you run into a question before I get my code sloughed up onto the BBS, just give me a holler.
Is it this weekend yet (smiley)? Nah, I probably made it seem like I wanted a detailed ptalk tutorial which, while it would be nice, is entirely unfair to expect. So let's pare the problem down a bit.

Okay, I was taking a look at my old code and notes for <i>the Magistrate</i> and I had a bunch of ideas for a wholly seperate game just kind of occur to me while at work today. Then I pulled up your phototalk file and, where I'm lost is in the (x, y, z) quip array. I know the first number indicates the character in question, and the last number seems to always be set at 0, so I suppose it wouldn't be too large a leap to assume this is only altered during the actual procession of the PTalk code. So I'm guessing it's the middle number that's the important variable on what choices are given. But how does it relate to the case structure in question?

I mean, how do you tell the system to display cases 3 and 4 only after case 2 has been selected, to eliminate case 3 as an option if case 4 is selected and, on top of that make it start with case 1 and 2 in one scene and case 5 and 6 in another with only a single variable?

I'm sure this is all terribly simple once it's explained to me, but right now it's fucking prestidigitation as far as I can discern.

Guest

Post by Guest »

Hahaha. Got it. Zounds, I am an imbecile. Code works great, Jonsey, happily ignore this thread.

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

Post by Ice Cream Jonsey »

Whoops -- I totally didn't see that this thread got bumped until right now. I think it was because I had been logged in as a guest all over the weekend and wasn't getting the different colored Mr Bandwidths doing the sleuth work for me. Odd. I just woke up for work and I will revisit this once I have had some stimulants.
the dark and gritty...Ice Cream Jonsey!

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

Post by Ice Cream Jonsey »

Debaser wrote:Okay, I was taking a look at my old code and notes for <i>the Magistrate</i> and I had a bunch of ideas for a wholly seperate game just kind of occur to me while at work today. Then I pulled up your phototalk file and, where I'm lost is in the (x, y, z) quip array. I know the first number indicates the character in question, and the last number seems to always be set at 0, so I suppose it wouldn't be too large a leap to assume this is only altered during the actual procession of the PTalk code.
Yeah, if you see something like this:

SetQuip(1,10,1)

That means that for the character with a charnumber of 1, set quip 10 to "on." The last number is just a toggle and will only either be 1 or 0 (on or off).

So I'm guessing it's the middle number that's the important variable on what choices are given. But how does it relate to the case structure in question?

I mean, how do you tell the system to display cases 3 and 4 only after case 2 has been selected, to eliminate case 3 as an option if case 4 is selected and, on top of that make it start with case 1 and 2 in one scene and case 5 and 6 in another with only a single variable?
OK, to display case 3 and 4 after 2 has been selected, you just need to put

SetQuip(1,3,1)
SetQuip(1,4,1)
SetQuip(1,2,0)

For the response that is generated when the player goes into what you wrote for quip #2. Does that make sense? I don't know if I am explaining it right.
I'm sure this is all terribly simple once it's explained to me, but right now it's fucking prestidigitation as far as I can discern.
It sort of goes like this:

Code: Select all

Quip #1&#58; "Hey, what's going on?"
Quip #2&#58; "That's great, I love pies."
Quip #3&#58; "Hmm! I love cows."

Response #1&#58; 
 SetQuip&#40;1,1,0&#41;
 SetQuip&#40;1,2,1&#41;
 SetQuip&#40;1,3,1&#41;
 "Not much. Just thinking about pies and cows," says Gimli."

Response #2&#58;
 SetQuip&#40;1,2,0&#41;
 SetQuip&#40;1,3,0&#41;
 "Yeah, pies are great. I eat them with meat from the bone."

Response #3&#58; 
 SetQuip&#40;1,3,0&#41;
 SetQuip&#40;1,2,0&#41;
 "I like cows because they are short like me. Toss me! Haw, haw."
In the above example, we're allowing the player to discuss *either* cow or pies. We kill off the response that the player did not choose.
the dark and gritty...Ice Cream Jonsey!

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

Anonymous wrote:Hahaha. Got it. Zounds, I am an imbecile. Code works great, Jonsey, happily ignore this thread.
This wasn't a sarcastic mewl for attention. I actually had, simply by staring intently at the code for several hours, finally figured out how these mysterious "arrays" were arranged. It was a much more triumphant accomplishment to figure this out on my own, anyway. I felt like Corky in that episode of Life Goes On where he finally learns to tie his shoes.

But I appreciate the thought. And Peter Jackson should hire you to rewrite all the dialogue before the release of the final LotR movie.

Wild, Roving Bobcats

Post by Wild, Roving Bobcats »

=(

Ben

Post by Ben »

Debaser wrote:I felt like Corky
"Corky" was my family's nickname for my father, so if you could just rein in the whole "Corky reference" thing, gee, that'd be real swell! THANKS!!! HEARTLESS PIG!!!

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

Post by Ice Cream Jonsey »

"Corky" was the name of the family dog. Who died last year.

Christ, is there anything on the planet named Corky that is still kicking?
the dark and gritty...Ice Cream Jonsey!

Debaser
Posts: 878
Joined: Tue Jun 25, 2002 9:55 pm
Location: Aurora, IL

Post by Debaser »

Oh, hey not to distract from all the utterly random banter, but I do have another question:

Is there an upper limit for how high the arrays can go? I ask because I noticed I've been using very short conversational snippets for each choice (basically the PC doesn't say anything unless it's chosen from the menu), and consequently I'm getting nearly 20 "Quips" each for the initial conversations with the first two characters. If I keep up this pace, I could see the more signifigant characters going upwards of 100 by the end of the game, and I want to know now rather than then if this is going to cause the compiler to explode in a hail of delicious monterey jack cheese or some such.

Less important, but I also thought it might be nice for conversation to initialize automatically on occasion and continue for several rounds without requiring the player to type "talk to" each time. Basically like in the Infinity Engine series of games where you get a response and the menu for your next reply just pops up again. Follow? Is there an easy way to do this? If not, don't wrack your brains or anything, as it's not a huge issue.

Corky the Kickboxer

Post by Corky the Kickboxer »

*raises hand*

Post Reply