Jump to content

npctalk compare & print choke when numeric value is zero.


Fyrd Argentus

Recommended Posts

When a numeric value is zero, it does not print out properly (or at all).  Zero acts like "false" (I think).

Background code:
npctalkdatanumeric#key=3CH-Glow;value=1;mode=set
npctalkdatanumeric#key=3CH-Glow;value=1;mode=subtract

Entry code:
Glow: [[3CH-Glow]] (But what is glow?)  => this does not print out as the value zero.

~~~~~~~~~~

At the moment I don't remember what happened when you use either of the following command, but I will test and report :
npctalkdata#key=3CH-Glow;value=0;compare=equal
npctalkdata#key=3CH-Glow;value=1;compare=less

 

 

Edited by Fyrd Argentus
Link to comment
Share on other sites

Upon further testing, the comparisons are working fine.  It just doesn't print a zero.

I have a vague memory of Mur discussing possible issues with zero values when he first told us about this new function, but I can't find it.  I did find Valoryn's discussion in the A25 Team thread about his issues with variables set to text vs float types.

Link to comment
Share on other sites

  • Root Admin

Hi Fyrd,

I'm not clear what you are saying here. Are you saying that you think its working and no change is needed, or that it needs to print out a 0 somewhere? Could you clarify this please so I may work on it if there is an issue.

Link to comment
Share on other sites

I managed to reproduce the issue with the following simple test topic:

Introduction [result] # Variable value: [[weird_variable]]
	Add 1 # [loadaction] npctalkdatanumeric#key=weird_variable;value=1;mode=add npctalk#goto=result
	Subtract 1 # [loadaction] npctalkdatanumeric#key=weird_variable;value=1;mode=subtract npctalk#goto=result
	Reset # [loadaction] npctalkdatanumeric#key=weird_variable;reset npctalk#goto=result

Note that on the first run it will display the variable’s name instead, because the variable is never set to an initial value when the topic's text box first shows up on the screen.

When the variable’s value reaches 0 via either calculations or a reset, it shows like this:

variable_zero_value_issue.png.f528c896537175a386376cb5f835f338.png

This can be seen in action at the Weird Playground on item56. If on the item’s normal action you replace topic 762 (whose contents are shown above) with topic 665 (Mur’s original Reception Quest), you will also see the same issue there. The original Reception Quest used to display zero values in variables correctly as 0 instead of nothing. So did other experiments and tests I worked on till early to mid May. I haven't used NPCtalk related functionality since then so I can't tell when the issue possibly showed up for the first time.

 

I also tried adding the empty= setting in the above npctalkdatanumeric# functions. empty=empty, empty=zero and empty=none displayed the words "empty", "zero" and "none" correctly instead of the value of the variable. empty=0 still displayed nothing though, which means that it can take a numeric value as well instead of a string (why would empty= need to hold anything other than a string is beyond the scope of this bug report though and can be reported separately if it's indeed an issue).

 

On 6/29/2022 at 5:26 PM, Fyrd Argentus said:

I did find Valoryn's discussion in the A25 Team thread about his issues with variables set to text vs float types.

That was a totally different issue, because I was getting an error that I was trying to make calculations on a non-numeric variable even though all calculations were made correctly and the result displayed correctly as well.

Link to comment
Share on other sites

NPCtalk treats an entry text (Text on Page) as, well, text. Thus, when it encounters [[weird_variable]] in an entry text, it can’t tell if it’s actually a variable or plain text that you chose to enclose in double square brackets for whatever weird reason and it decides to display plain text. That’s until it encounters the first npctalkdata# or npctalkdatanumeric# loadaction with weird_variable as its key= and when it does, it goes: “Aha! That’s a variable, so I will display its value instead of plain text from now on”.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Forum Statistics

    17.5k
    Total Topics
    182.5k
    Total Posts
  • Recently Browsing

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...