Hugo syntax debugging for Necrotic Drift

Let's make some video games!

Moderator: Ice Cream Jonsey

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

Hugo syntax debugging for Necrotic Drift

Post by Ice Cream Jonsey »

I am trying to debug something a player found with Necrotic Drift.

I have one line that is supposed to set dialogue. It is different than all the other places that I set dialogue, because I (for some reason in 2004, but not intentionally) had an extra space character in the call. The calls look like this:

Code: Select all

SetQuip(11, 7,1)
SetQuip(11, 8,1)
This is the function getting called:

Code: Select all

routine SetQuip (char, line, onoff)
{
local x, y, z, n

	for (x=0; x<char; x++) 
		{
	    	 n=(n + quips[x])
		}
	n = (n + line)
	y = (n / 8)
	z = Mod(n,8)
	z = Power(2,z)
	if (onoff = 1) 
		{
	     	qflag[y] = ((qflag[y]) | (z))
		}
	if (onoff = 0) 
		{
		     qflag[y] = ((qflag[y]) & (~z))
		}
}
Is there any chance someone could start a game and that could screw things up? The extra space?

The save game I have shows the bug. I can load it with a copy of ndrift.hex and see the problem.

If I play the game through a walkthrough and try to reproduce the bug, I can't. So it works in some conditions. I would imagine the space before the numbers 7 and 8 up there don't matter. But could it?
the dark and gritty...Ice Cream Jonsey!

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

Re: Hugo syntax debugging for Necrotic Drift

Post by Ice Cream Jonsey »

I was confused. The above does not have anything to do with the bug. I guess it's still good to check assumptions in this thread though.
the dark and gritty...Ice Cream Jonsey!

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

Re: Hugo syntax debugging for Necrotic Drift

Post by Ice Cream Jonsey »

So, the bug is that we can't get into the sporting good store.

Here's the code I can see getting invoked with the save file

Code: Select all

			elseif choadgate is open and GameEvents[21] = 0
			{
				"Well, Casey and I are supposed to 'guard' the entrance. I guess we should probably do 
				that."
			}
That's what is getting executed.

What I want to see is this code:

Code: Select all

			if choadgate is open and GameEvents[21] = 1
			{
				return MallStore2
			}
Ok, so how do we get GameEvents[21] to be 1? It is clearly 0.

Searching for GameEvents[21] I see the following is the only place we change it:

Code: Select all


daemon Ghoul_Appears
{
timer 0
}

event in Ghoul_Appears
{

	self.timer++
	select(self.timer)

	case 1
		{
			if GameEvents[21] = 0
			{
				GameEvents[21] = 1
				CharShout(Barnaby,ShoutArray[1])
				CharShout(Audrey,ShoutArray[1])
			}			
		}

More in a bit
the dark and gritty...Ice Cream Jonsey!

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

Re: Hugo syntax debugging for Necrotic Drift

Post by Ice Cream Jonsey »

Looks like I can reproduce the error... at one point most players would go west, but if you go east and then west, the error happens... sorry, these are terrible notes!
the dark and gritty...Ice Cream Jonsey!

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

Re: Hugo syntax debugging for Necrotic Drift

Post by Ice Cream Jonsey »

Ok, I fixed it. This was one of the most difficult bugs to fix because of how bad a designer I was in 2004.

I use arrays for game events in my game - just a big ole array like this:

GameEvents[3] = 0 !// Whether or not we displayed the joke about weiner flavor
GameEvents[4] = 0 !// Change this to 1 when we zap the blah blah

Roody uses individual global variables when he does something similar, and this is a case where it would have helped if I had done it that way. I think.

In Necrotic Drift, if you meet Trott and don't finish his dialogue to where he opens the gate to the Sporting Goods store, you can go back to the area where the Sporting Goods store is. And the gate to it will be down. Gibs tells you to go back there and get the phone so you can ask Trott to open it. The act of going to that room *and heading back* was messing things up. I made two decisions on whether or not to print text using "GameEvents[20]" and I should not have used the same variable for both:

1. If you ask him to open the gate the very first chance you get
2. If you don't ask him, head there, then double back and then ask him.

There is no gameplay reason for ANY of this. I guess it gives "choice" to the player. But there is no payoff. This is the opposite of how I tried to implement Enceladus, and it paid off for me in that game (I guess) as nobody has reported errors like this monstrosity in Enceladus.

When Necrotic Drift came out, I wrote that the recommended resolution was 1024x768. I doubt anyone likely playing the game would be on something less than 1920x1080. The graphics have a maximum height of 200 pixels. Part of me wants to take the opportunity to double all the graphics. I don't know how pixelated it would look.
the dark and gritty...Ice Cream Jonsey!

User avatar
Tdarcos
Posts: 9329
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Re: Hugo syntax debugging for Necrotic Drift

Post by Tdarcos »

If you hadn't said you solved it, i would suggest

Code: Select all

       if choadgate is open and GameEvents[21] = 1
which might be interpreted as

Code: Select all

  if ((choadgate is open) and GameEvents[21]) = 1
 
which is a numeric result rather than boolean, so it should be expressed as

Code: Select all

       if (choadgate is open) and (GameEvents[21] = 1)
When evaluation is important, or there can be ambiguity, don't count on the compiler to do it correctly.
Evil cannot create anything new
They can only corrupt and ruin
What good forces have invented or made.
- J.R.R. Tolkien

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

Re: Hugo syntax debugging for Necrotic Drift

Post by Ice Cream Jonsey »

Flack's asked for your email address in like a dozen threads. Did you see it at all?
the dark and gritty...Ice Cream Jonsey!

Post Reply