Fyrd Argentus Posted June 29, 2022 Report Posted June 29, 2022 (edited) 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 June 29, 2022 by Fyrd Argentus Quote
Fyrd Argentus Posted June 29, 2022 Author Report Posted June 29, 2022 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. Quote
Root Admin Chewett Posted July 2, 2022 Root Admin Report Posted July 2, 2022 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. Quote
Fyrd Argentus Posted July 3, 2022 Author Report Posted July 3, 2022 The only problem I am seeing now is that when the value is zero and you try to print that out, you get a blank instead. Quote
Valoryn Posted July 3, 2022 Report Posted July 3, 2022 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: 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. Quote
Fyrd Argentus Posted July 3, 2022 Author Report Posted July 3, 2022 35 minutes ago, Valoryn said: first run it will display the variable’s name instead This bit had me confused - why I sometimes saw the name instead of a blank. Thanks for the clarification. Quote
Valoryn Posted July 3, 2022 Report Posted July 3, 2022 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”. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.