(done) default values for exvar when nil

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

(done) default values for exvar when nil

Post by Joramun »

Ok, I often (when using RTSB or other stuff) have the following "trouble" :

- potions/bombs without power
- walltext and scrolls without text
- other item without charge.

I suggest to have default values in the base code, like :
in the scroll subrenderer :

Code: Select all

 if not exvar[id].text then
  num_lines = 0
 else
  normal behavior
 end
And the same for potions, and other items that require values right now, and will cause the game to crash / report a bug if not set.
I understand it was not implemented in order to report "missing" stuff to the designer,
but it might be intended to have no text in scroll (e.g.) and in any case,
crashing the game because of a small mistake like that or a potion without power is a bit harsh for playtesting.
What Is Your Quest ?
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Joramun wrote:crashing the game because of a small mistake like that or a potion without power is a bit harsh for playtesting.
True.
I wonder, though, should it just completely silently substitute a default value, or should it print a complaint message?
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

I would say both. In any case, if you don't want the game to crash, you need to provide a healing value to a cure potion (e.g.)
What Is Your Quest ?
Remy
Craftsman
Posts: 111
Joined: Wed Sep 05, 2007 5:24 pm
Contact:

Post by Remy »

If it's oriented towards just getting through playtesting and debugging, it should report it so the designer remembers to fix it. If it's supposed to act as an alternative to setting those values - i.e., a true default value - it shouldn't.
I tend to lean towards the first in the two given examples (potions and scrolls - scrolls can be blanked out by setting 'text' to an empty string, "", in the final release), but I wonder where else this might be a problem.
User avatar
Parallax
DMwiki contributor
Posts: 424
Joined: Mon Aug 28, 2006 7:56 pm
Location: Back in New Jersey

Post by Parallax »

I think it's a really a case-by-case decisio, depending on items.

A scroll without text is just a blank text, I'm not sure if DSB should even say anything about it. It definitely should not crash.

A potion without a power is a problem, though, to the extent that a function calls for that power. So while I'm not a fan of DSB exiting with an error message, I'd definitely would like one to be displayed in-game, in the ugliest and most mood-breaking color that can be found, as it will motivate the dungeon designer to fix the problem. :)

Items without charge. Once again, to the extent that a function associated with the item calls for a charge, I'd like an error message displayed, and no charge exvar.

The difference between the scroll and the other two examples is that in the case of a scroll, looking at it to see its text does not imply the game doing anything with the information beyond displaying it, whereas the power of potions and charges of charged items are critical for the game to keep track of.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

I think Parallax has the right idea.

There's actually an ugly shade of orange that's not used anywhere in normal DM that I've been using for that kind of stuff, because it stands out immediately... so, now, the game won't just boot you out, but it will complain in the console.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4322
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

What I did in CSBwin in several places
is to shout out an error message the
first time some error occurred and
to quietly apply a default on subsequent
errors of the same general type. This
lets the designer know there is a problem
but does not keep interfering over and over
again.
Post Reply