parse$

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
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: parse$

parse$

by Roody_Yogurt » Wed Apr 24, 2024 9:33 pm

When testing values of the elements of the word array after a normal game command, the unrecognized word (which parse$ is set to) gets the value -1. On the other hand, if the "input" command is used, the element with the unrecognized word gets a value of 0.

This came up in my somewhat recent exercise of re-envisioning "Hammurabi" to use the main game loop instead of the input command. The routine responsible for turning unrecognized words (since Hugo, by default, only recognizes 1 through 5 or 10, I forget) into numbers was no longer working. It expected parse$ to be 0 and here they were, coming up as -1. The funny thing is that I had remembered parse$ being -1 in the past, but just the same, before thinking too much about it, I uploaded a new version of Roodylib to the IF archive with code that expected a 0 value (there were some other little updates so it's not completely wasted effort).

I only recently noticed that the two scenarios give different values. I added a fix to the Roodylib repository at https://bitbucket.org/roody_yogurt/hugo ... /roodylib/ that allows for either value (since a recognized dictionary word would never have the value 0 or -1), but I'm not going to rush out a new Roodylib release over this.

So it's just something to be aware of for now.

Top