Help I can't fairmath

I’ve never used fairmath. I’m working on a collaborative project now where the standard is to use it. “How hard can it be?” I thought. “I’ve been given the format.”

*set (variable_name) %+number
(or %-number)

And yet, my code refuses to go any further than that point. Here’s the bit of code, an option in a perfectly normal choice, before a goto to a valid label, such as might work a hundred other times (p.s., I have word wrap on for the screenshot, which is why some of the text looks indented):

In text, if you prefer (spacing is off):
#Interrogate the waitress about the caller before leaving.
For whatever reason you’ve been summoned, it might be useful to know who called. “Did the person who called for me leave their name?” you asked.

  "No, it was just some man," the waitress replies vaguely. "He sounded upset, and said to hurry and give you that message. He hung up before I could ask anything."
  
  This information doesn't seem all that helpful, but you thank her before setting off for the listed address.
  *set (genre_savvy) %+10
  *goto murderhouse

Please, someone who can fairmath. What am I doing wrong? :cry:

1 Like

Hi, try removing the parenthesis?

1 Like

I tried several times and i am totally incapable of doing it too . SO i understand your pain. The explanations are written in maths and i don’t speak maths. I would love someone explanation in plain English

I put them in after the first time the code tripped up. Sometimes it helps un-confuse ChoiceScript. So, it failed the first time without them.

1 Like

Can you paste the code where you create genre_savvy as a stat?

Oh, all my apologies, then, I admit that I don’t use fairmath myself :slight_smile:

Try doing this again. Because the code works for me, in the IDE as long as I remove those parenthesis

Sure. It’s an opposed stat, if that matters, but I don’t see how startup would even know that. At first I typed it in as 0, then I thought that might be confusing the math (that it might be impossible to use a % function on 0) so I changed it to 50. Choicescript_stats is currently blank.

This is the one line in startup:
*create genre_savvy 50

I’ll try that again. Maybe it needs the combination of not-zero and no parentheses?

Yeah, fairmath stats can’t be 0.

Hmm. Although 0 does seem to work in the IDE. I thought they couldn’t be 0 though.

1 Like

I removed the parentheses, genre_savvy is 50, and it’s still broken. I guess I can yank that command for now to test the rest of the scene, but it’s a mystery.

I don’t know if this might help or not but i found a choicescipt wiki Arithmetic operators - ChoiceScript Wiki - Wikia and it looks like it might help

Does it crash with an error message, and so, which one?

I can do

*create genre_savvy 50
*set genre_savvy %+10

and it will work. So your problem isn’t in either of those things. It’s happening elsewhere. What is the exact error you’re getting?

SashiraTale line 53: Invalid expression at char 5, expected no more tokens, found: OPERATOR [%]

That’s the line where I’m attempting fairmath. It’s almost the first thing in the scene. All I do before that is create some temp variables and rename some permanent ones; neither has anything to do with that variable.

There’s a mystery keeping me from finishing a mystery. There’s irony somewhere in here…

1 Like

You’ve removed the parenthesis?

Line 53 character 5 is

*set genre_savvy %+10

So literally, it’s objecting to a blank space? Must be ghosts.

Can you share the whole code file? It’ll be easier to track down where the error is then.

Huh, I had a thought. I’m having to go through my code by hand because quicktest is mysteriously not working. The last time I had bizarre code malfunctions was also the last time my quicktest broke and I had to try to sort them out by hand - when I was trying to code Moonlight Circus for the contest. Maybe there’s some deeper technical difficulty that’s affecting both.

I’ll try re-downloading Choicescript, adding the text files back in to a clean copy, and see what happens.

Okay! Good luck with that.

I asked my boyfriend to take a look at my code, and the error was mysteriously gone. Same code, same computer. My best guess is that although I saved the new changes, they didn’t properly implement until he hit Restart (I was refreshing the page instead.) Quicktest is still mysteriously down, but one fewer bug is nice? Maybe no parentheses + not-zero for the variable did the trick.

3 Likes