Help I can't fairmath


#1

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:


#2

Hi, try removing the parenthesis?


#3

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


#4

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.


#5

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


#6

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


#7

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


#8

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?


#9

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.


#10

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.


#11

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


#12

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


#13

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?


#14

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…


#15

You’ve removed the parenthesis?

Line 53 character 5 is

*set genre_savvy %+10


#16

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


#17

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


#18

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.


#19

Okay! Good luck with that.


#20

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.