Skip to content
View in the app

A better way to browse. Learn more.

MagicDuel Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

npctalk compare & print choke when numeric value is zero.

Featured Replies

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

  • Author

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.

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.

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”.

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...

Forum Statistics

  • Total Topics 17.5k
  • Total Posts 182.2k

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.