I have just invented a "fastquit" verb! (weird runtime bug)

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
Tdarcos
Posts: 7669
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

I have just invented a "fastquit" verb! (weird runtime bug)

Post by Tdarcos »

At first I thought there was a weird bug, and it was interesting as this causes the game to crash, as if the run-time system had executed some "fastquit" command that quits immediately without asking for confirmation or displaying a message. I was I was afraid it was one of those "well it works on my machine even if (side tone of complete disbelief) it doesn't work on yours" type errors.

As I was pasting the code here I saw what the problem was.

Code: Select all

xverb "test"
 *				DoTest
 * "on"/"off"

...

routine DoTest
{

  if not word[2]
  {
   "Test is ";
    if test
      "on."
    else
      "off."
    return
  }
  If word[2]="on"
  {
    if test
      "Test is already on."
    else
    {
      test = 1
      "Test enabled."
    }
  }
  else
  {
    if not test
      "Test is already off."
    else
    {
      test = 0
      "Test disabled."
    }
  }
}
If you read very closely, "test" (to show the state of the test variable) works, but "test on" or "test off" cause a crash in the runtime system (the game engine) because in the grammar I have no vebroutine defined! (I'm using a "test" variable in order to selectively show debugging information at run time.)

And to think I only discovered this because I wanted to have 1 routine do the work of 3. (Same routine shows the state of the variable, turns it on or turns it off.) As a result of using Roodylib (I suspect) I already "blew through the cap" of 320 routines and had to increase it.
"You're motorin', what's your price for flight, when finding Mr. Right?"
- Night Ranger, Sister Christian