DEBASER SMASH HUGO!!!

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

DEBASER SMASH HUGO!!!

Post by Debaser »

Why in the blue hell does the following not compile?

Code: Select all

array transit[5] = 0, 0, 0, 0, 0

routine GoTransit
{
 local a, b, c
 "Choose a destination (0 to remain where you are):"
 for &#40;a=0; a<20; a=a+1&#41;
 &#123;
  if &#40;transit&#91;a&#93; = 1&#41;
  &#123;
   b = b + 1
   print number b; "&#58; ";
   select a
    case 0 &#123; "Gothic St. &#40;Your Apartment&#41;" &#125;
    case 1 &#123; "Far West Side &#40;Mickey's House&#41;" &#125;
    case 2 &#123; "Adams Ave. &#40;Kingston University&#41;" &#125;
    case 3 &#123; "Independence Blvd. &#40;Downtown&#41;" &#125;
    case 4 &#40; "Olympus St. &#40;Greek Town&#41;" &#125;
  &#125;
 &#125;
 input
 if &#40;word&#91;1&#93; = 0&#41; &#123; "You decide to stay here." &#125;
 else
 &#123;
  for &#40;a=0; a<20 ; a=1+1&#41;
  &#123;
   if &#40;transit&#91;a&#93; = 1&#41;
   &#123;
    b = b + 1
    if &#40;b = word&#91;1&#93;&#41;
    &#123;
     c = a
     a = 20
     select c
      case 0 &#123; "Gothic St." &#125;
      case 1 &#123; "Far West Side" &#125;
      case 2 &#123; "Adams Ave." &#125;
      case 3 &#123; "Independence Blvd." &#125;
      case 4 &#123; "Olympus St." &#125;
    &#125;
   &#125;
  &#125;
 &#125;
&#125;
After not recognizing the input line, the compiler refuses to recognize any other line in the routine. Removing the input line allows it to compile, but obviously I need to be able to get an input from the keyboard. Changing "input" to "GetInput" does nothing.

Kent

Brace mismatch

Post by Kent »

The 'case 4' line immediately before the 'input' statement that gives the first error should have a '{' where it currently has a '('.

I'll look into why the compiler isn't giving a more helpful error message, but for future reference, getting 'Unknown compiler directive' as an error is usually a sign that braces or quotes or something are mismatched somewhere, because the compiler thinks it has left the current object/routine/whatever.

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

Post by Debaser »

Thank you! I just knew it had to be something idiotic on my part but, given that this is the first time I've tried to use arrays, for loops, or input requests, I didn't think to check for the usual typos.

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

Post by Debaser »

Nother problem: It compiles now (and I fixed the stupid a=1+1 error in the second loop), but it's not reading the input correctly. Basically, no matter what I type at the prompt I get the "You decide to stay here." response, which would indicate that word[1] is still registering as zero.

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

Post by Debaser »

Nevermind. Didn't realize that word[1] had to be a string value. Just putting the 0 in quotes did the trick.

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

Post by Ice Cream Jonsey »

This seems to effectively be the same thing as getting a quip working in the Phototalk.hug thingie that I use in all my Hugo games. Let me re-write this Transit routine for you... be right back.
the dark and gritty...Ice Cream Jonsey!

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

Post by Ice Cream Jonsey »

Code: Select all

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!Globals
array temp_transit&#91;1&#93; = 0 
global selected
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


routine DisplayTransitChoices&#40;&#41;
&#123;
local a, b, c 

	"Choose a destination &#40;0 to remain where you are&#41;&#58;" 

	for &#40;a=0; a<20; a=a+1&#41; 
	&#123; 
  		if &#40;transit&#91;a&#93; = 1&#41; 
  		&#123; 
   			b = b + 1 
   			print number b; "&#58; "; 

   			select a 
    			case 0 &#123; "Gothic St. &#40;Your Apartment&#41;" &#125; 
    			case 1 &#123; "Far West Side &#40;Mickey's House&#41;" &#125; 
    			case 2 &#123; "Adams Ave. &#40;Kingston University&#41;" &#125; 
    			case 3 &#123; "Independence Blvd. &#40;Downtown&#41;" &#125; 
    			case 4 &#123; "Olympus St. &#40;Greek Town&#41;" &#125; 
  		&#125; 

  	GoTransit&#40;&#41;
	&#125; !for

	if &#40;selected = 0&#41; 
	&#123;
		"You decide to stay here." 
	&#125; 

	else 
	&#123;
		select&#40;selected&#41;
      		case 0 &#123; "Gothic St." &#125; 
	      	case 1 &#123; "Far West Side" &#125; 
      		case 2 &#123; "Adams Ave." &#125; 
	      	case 3 &#123; "Independence Blvd." &#125; 
      		case 4 &#123; "Olympus St." &#125; 
	&#125; 
&#125; !routine


routine GoTransit
&#123;
local temp

   COLOR LIGHT_CYAN

   print ">> "; 

   COLOR TEXTCOLOR

   input

   if word&#91;1&#93;
	&#123;
	  	string&#40;tempquip, word&#91;1&#93;&#41;
	&#125;
   else
	&#123;
       		string&#40;tempquip, parse$&#41;
	&#125;

   temp = tempquip&#91;0&#93; - '0'

   if &#40;temp = 0&#41;
	&#123;
		"\nI decide to not go anywhere."
		selected = temp
		return
	&#125;
   else
	&#123;
		selected = temp
	&#125;
return
&#125;
OK, I think the part that helps you in your last problem, Debaser, is the code that appears after the "if word[1]" bit in the second routine. I think that properly gets the player's input into a mode where it's "1" or "2" as you expect.

I didn't compile this, so let me know if it presents any new problems or if it just doesn't work (the theories there should be OK, as I do this exact thing in the Dialogue routines that I use).

(Also, to everyone -- I've been a bit under the weather the last few days, which explains why I haven't been around so much. Feeling much better tonight, though.)
the dark and gritty...Ice Cream Jonsey!

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

Post by Roody_Yogurt »

Good to hear it.

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

Post by Debaser »

This seems to effectively be the same thing as getting a quip working in the Phototalk.hug thingie that I use in all my Hugo games. Let me re-write this Transit routine for you... be right back.
Yeah, if I didn't have phototalk to crib from, I wouldn't have even gotten this far.
OK, I think the part that helps you in your last problem, Debaser, is the code that appears after the "if word[1]" bit in the second routine. I think that properly gets the player's input into a mode where it's "1" or "2" as you expect.
Yeah, I've been trying to rip that bit off for the last hour or so. It looks like this bit:

Code: Select all

   if word&#91;1&#93; 
   &#123; 
        string&#40;tempquip, word&#91;1&#93;&#41; 
   &#125; 
   else 
   &#123; 
             string&#40;tempquip, parse$&#41; 
   &#125; 

   temp = tempquip&#91;0&#93; - '0'
is the part where it's supposed to switch over to integer data so I can use it for a proper case selection, but it's not doing that. The if/else structure looks like it's just checking for valid input, but I'm not sure. "tempquip[0] - '0'" seems completely meaningless, so I figured that was the magic code, but no dice.

Just straight copying and pasting your code, I have to move the call to GoTransit outside the for loop, and renamed a couple variables, but the result's the same as with my code.
(Also, to everyone -- I've been a bit under the weather the last few days, which explains why I haven't been around so much. Feeling much better tonight, though.)
Reading this paragraph I am sad, then happy, then frustrated again.

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

Post by Ice Cream Jonsey »

Can you zip up all the code you have and send it to me at beaver@zombieworld.com? I'll create a directory on my drive and have at it from there (probably easier to do it that way than have me take the shell.hug file and build around it -- this way, I know I've got exactly what you have as I go in to debug it).
the dark and gritty...Ice Cream Jonsey!

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

Post by Debaser »

Should be on its way.

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

Post by Ice Cream Jonsey »

OK, I see that you had GetDial() already in there -- if you change your routine to this, do you see more-or-less positive results?

Code: Select all

routine GoTransit
&#123;
 local a, b, z
 "Choose a destination &#40;0 to remain where you are&#41;&#58;\n"
 for &#40;a=0; a<20 ; a++&#41;
 &#123;
  if &#40;transit&#91;a&#93; = 1&#41;
  &#123;
   b = b + 1
   print number b; "&#58; ";
   select a
    case 0 &#123; "Gothic St. &#40;Your Apartment&#41;" &#125;
    case 1 &#123; "Far West Side &#40;Mickey's House&#41;" &#125;
    case 2 &#123; "Adams Ave. &#40;Kingston University&#41;" &#125;
    case 3 &#123; "Independence Blvd. &#40;Downtown&#41;" &#125;
    case 4 &#123; "Olympus St. &#40;Greek Town&#41;" &#125;
  &#125;
 &#125;
 "\n>";

 GetDial&#40;z&#41;

 if &#40;word&#91;1&#93; = "0"&#41; &#123; "You decide to stay here." &#125;
 else
 &#123;
      select word&#91;1&#93;
      case "0" &#123; "Gothic St." &#125;
      case "1" &#123; "Far West Side" &#125;
      case "2" &#123; "Adams Ave." &#125;
      case "3" &#123; "Independence Blvd." &#125;
      case "4" &#123; "Olympus St." &#125;
  
  
  &#125;
&#125;
... For instance, with this, if I choose "2" when invoking the GoTransit routine, "Adams Ave." does indeed come up. Does this behave the same way for you?
the dark and gritty...Ice Cream Jonsey!

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

Post by Debaser »

Not quite. Under that scheme, the input corresponds directly to the original array, rather than to the adjusted menu location. Inputing "2" gives you Adams Street because transit[2] refers to Adams Street. But inputting "1" gives you "Far West Side" (transit[1]), which isn't even a menu option, rather than "Gothic Street", which is the proper response.

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

Post by Ice Cream Jonsey »

Ah, right right right. Let me grab some sleep and I'll take another look at this and get it fixed with a fresh head.
the dark and gritty...Ice Cream Jonsey!

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

Post by Debaser »

Thanks, Robb, I've figured it out. Once you pointed out I could just call GetDial, rather than reproduce the code (modulization!), it was basically just a matter of chucking GetDial(b) into what I already had and fiddling with the logic. Works perfect. Many many thanks for sticking it out with me all damn night.

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

Post by Ice Cream Jonsey »

OK, cool, I am glad that you got it working. I got hung up on making the "2" appear correctly there. My sleeping habits have become quite poor, so being able to whip off a round of programming with the Debaser was a good way to kill the time until the angry glare of the sun came through my room.
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 think I've added maybe two rooms worth of code and one brief conversation since getting that working. You know what I'm discovering: describing shit is a pain in the ass.

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

Post by Ice Cream Jonsey »

Debaser wrote:I think I've added maybe two rooms worth of code and one brief conversation since getting that working. You know what I'm discovering: describing shit is a pain in the ass.
Chain Gang Guy is playing a number of characters in the thing I am currently working on, and for one character he had a picture taken of himself where he is hiding behind a big, leafy, potted plant.

I realized yesterday that I have just about run out of ways to describe big, leafy, potted plants.

In days of old, the editor to Amiga Power would ban the word "very" because it brings nothing to the table. But there I was, doling out the "very big" and "very large" text snippets like I was making the next Stiffy Makane adventure. I have nothing left to say about plants. I have nothing left to say about vegetables. I even passed freshman Botany -- I had an old, shriveled, wizened guy who would have looked more in place in a Harry Potter movie than in front of a bunch of students speak at great length about plants and plant cells and so forth for fifty minutes three days a week for three months of my life and STILL... I got nothing.

Luckily, a picture equals one thousand words, so I just threw CGG's mug up on the screen and added 1,000 to my word count.
the dark and gritty...Ice Cream Jonsey!

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

Post by Debaser »

Yeah. Part of the problem is that, right before that point I was doing this house that was owned by an NPC and rented out by 3 other NPCs, none of whom were fucking. So that meant 4 bedrooms. So that meant 4 beds (or bed-like items), 4 dressers, 4 music-playing devices, 3 collections of CDs, 2 bookcases, 2 collections of books and, some part of me had the integrity to say "each of these items must be distinct" and so they were. Then I took a break and got the transit code working. That was frustrating, but at least it was novel.

Then I did a store, the foyer of a library, and the inside of a more or less empty bar. Doing 3 seperate counters (or, in the case of the bar, a counter-like item) was some sort of breaking point. It took every ounce of willpower not to make the long_desc "It holds shit up. What the fuck do you want from me? It holds shit up. It's not important to any aspect of the game. It holds shit up. And don't you fucking dare try to put anything on top of it, asshole."

But I think I've recovered. Now we get to visit the PC's apartment. It should be an exciting portion of the game for the player. He gets to cast his first spell, has to sneak past a couple armed characters in masks, gets to find a couple important clues in the game's central mystery. But for me it means another bed, another dresser, at least one more bookcase, and at least one more set of books. If I'm going to have integrity about this, it's going to mean another music-playing device, and then I have to figure out what, beyond Wagner, the PC is likely to have in his CD collection.

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

Post by Roody_Yogurt »

I hope that most if not all of those bedrooms have something necessary to the plot or game play. Otherwise, as a player, I would probably prefer just not being able to go into them. For me, at least, rooms that are implemented just for the sake of logic often have a dead sort of feel to them.

Post Reply