Opened 4 months ago

Closed 4 months ago

#15288 closed defect (fixed)

SCI: CAMELOT: Counting your money incorrectly reports your purse as empty

Reported by: eriktorbjorn Owned by: sluicebox
Priority: normal Component: Engine: SCI
Version: Keywords:
Cc: Game: Conquests of Camelot

Description (last modified by eriktorbjorn)

English GOG version of Conquests of Camelot, current development ScummVM.

After getting money for my purse, I tried counting it to see how much I had. The game showed me, but then claimed the purse was empty. (The command "look in pouch" does not trigger the bug, but it also doesn't trigger the message about the pouch being empty, even when it is.)

Maybe it has something to do with this warning message?

WARNING: Uninitialized read for parameter 1 from method ::export 0 (room 5, script 117, localCall 2ba)!




Attachments (4)

camelot.001 (13.4 KB ) - added by eriktorbjorn 4 months ago.
scummvm-camelot-00000.png (15.3 KB ) - added by eriktorbjorn 4 months ago.
scummvm-camelot-00001.png (16.7 KB ) - added by eriktorbjorn 4 months ago.
scummvm-camelot-00002.png (12.4 KB ) - added by eriktorbjorn 4 months ago.

Download all attachments as: .zip

Change History (14)

by eriktorbjorn, 4 months ago

Attachment: camelot.001 added

by eriktorbjorn, 4 months ago

Attachment: scummvm-camelot-00000.png added

by eriktorbjorn, 4 months ago

Attachment: scummvm-camelot-00001.png added

by eriktorbjorn, 4 months ago

Attachment: scummvm-camelot-00002.png added

comment:1 by eriktorbjorn, 4 months ago

Description: modified (diff)

comment:2 by eriktorbjorn, 4 months ago

Description: modified (diff)

comment:3 by eriktorbjorn, 4 months ago

Using sluicebox's scripts, I guess https://github.com/sluicebox/sci-scripts/tree/main/camelot-dos-1.001.000 is the relevant game, and I think this command is handled by Main.sc:

					(
						(or
							(Said 'pay')
							(Said 'give,count/coin,copper,dirham,dinar')
							(Said 'open/moneybag')
						)
						(cond
							((not (gEgo has: 3)) ; purse
								(Print 0 4) ; "If you had a purse, you would be able to acquire money to give away."
							)
							((not (DoPurse))
								(Print 800 (Random 29 34))
							)
							(else
								(Print 800 (Random 23 25))
							)
						)
						(proc0_18)
					)

But if so, the strange thing (to me) is that "pay" and "count money" both trigger the glitch, but "give money" and "open purse" does not.

comment:4 by eriktorbjorn, 4 months ago

Working with that theory, there is a call to kRandom() where it asks for a random number from 29 through 34. That suggests that the DoPurse method returned zero?

But then that's also weird, because I thought DoPurse returned global132, and that seems to be a variable that keeps track of whether or not you have money.

Regardless of whether DoPurse returns zero or non-zero, there should be a message, and for some commands there isn't. I'm going to assume that when there is no message, the command was handled by a different script. I've already verified that "give money" does trigger the glitch in at least some rooms, contrary to what I wrote before.

comment:5 by eriktorbjorn, 4 months ago

No, wait, it's not global132 that keeps track of your money. It's globals 120 through 123, isn't it? From Rm5.sc, when taking back your purse:

					((and (== global122 0) (== global121 0) (== global120 0))
						(Talk 5 41) ; "Here you are, m'lord, but the purse is empty. I beg you to let me fill it for you ere you go."
						(gEgo get: 3) ; purse
						(SetMenu 1281 112 1)
					)
					((!= global123 3)
						(Talk 5 42) ; "There is room for more, m'lord, but here it is, as you command."
						(gEgo get: 3) ; purse
						(SetMenu 1281 112 1)
						(SetFlag 0)
					)
					(else
						(Talk 5 43) ; "Here it is, m'lord, as you command."
						(gEgo get: 3) ; purse
						(SetMenu 1281 112 1)
						(SetFlag 0)
					)

From what I understand:

Variable Meaning
global120 Number of copper coins in your purse
global121 Number of silver coins in your purse
global122 Number of gold coins in your purse
global123 Number of types of coins that you've picked up from your treasury

Does that mean that DoPurse should return global123 instead? Or is it possible to gain money without using the treasury?

comment:6 by eriktorbjorn, 4 months ago

But no, that doesn't make sense either because the game seems to use global132 to check for money in lots of places. So what is global132 anyway? I don't get it.

comment:7 by eriktorbjorn, 4 months ago

Maybe I'm just misunderstanding the interface here, but it seems the message you get depends on how much money I'm giving, even though I was just trying to count it. I couldn't find any clarification in the manual.

comment:8 by eriktorbjorn, 4 months ago

So anyway, I'm beginning to suspect that this is working as designed. In which case, I guess this bug report should be closed as invalid. But I'll let someone else comment on it first, in case I'm mistaken.

comment:9 by sluicebox <22204938+sluicebox@…>, 4 months ago

In 7bd9f0b8:

SCI: Fix CAMELOT empty purse message

Fixes bug #15288

comment:10 by sluicebox, 4 months ago

Owner: set to sluicebox
Resolution: fixed
Status: newclosed

Good catch, this is a legit script bug

Note: See TracTickets for help on using tickets.