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

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:smile: :sad: :eek: :shock: :cool: :-x :razz: :oops: :evil: :twisted: :wink: :idea: :arrow: :neutral: :mrgreen:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: I have just invented a "fastquit" verb! (weird runtime bug)

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

by Tdarcos » Wed Nov 13, 2019 7:26 am

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.

Top