Set [stat] %-x not substracting


#1

I’m having some sort of trouble with %+/- command.

Namely, the code is set as %-5, so it should in theory substract the appropriate amount off the given stat, or at least that’s the way I understand it. Instead, it continues to add to a given stat as if I used %+5.

Any guidelines on how to solve the problem would be greatly appreciated. c:


#2

Copy and past the code you are using so we can see exactly what is going on.


#3

Have you read http://choicescriptdev.wikia.com/wiki/Arithmetic_operators


#4

Don’t forget to “refresh” your game every time you made a change to the code.


#5

*set [stat] %-5 is what I’ve been using.

Refreshing proved ineffective; also it seems like altering the code as the link says (into [stat]- 5) doesn’t work either.


#6

Okay, writing *set [stat] %- 5 should produce an error that say something like “could not extract token”, because you can’t use brackets ([]) in a stat name.


#7

Oh sorry. I replaced the actual stat to avoid spoilers. >.>

There are no brackets there. My bad.


#8

You might need the space in there between - and 5?
*set var %- 5


#9

You should copy directly what your code is. We need to see all of the code to be able to help.

I’d also add in some code, just when testing, to display the value of the variable both before and after it’s set.


#10

*set toughness %- 5
*set toughness % -5
*set toughness %-5

All three of those i’ve tried and none have really worked to actually substract. Is there perhaps a different symbol I could replace the hyphen with?

Ah. How can I do that? That sounds like it could be handy.


#11

Just put ${toughness} before

or even

*stat_chart 
    percent toughness

#12

I’m sorry, but I don’t follow. Where am I supposed to put it? >.>

If you mean in the set bit of code, that seems to be triggering an error.

If it helps in anything, set stat -x does work compared to the percentage one.


#13

What I do is I run some sample code.

So I will do

${toughness}

*set toughness %-5

${toughness}

To double check that what I think is happening, is actually happening. That it is that bit of code causing the error.


#14

Quick investigation reveals that now, for some reason, toughness doesn’t increase… but it doesn’t decrease either (when faced with %-5). The same applies to other stats I’ve checked.

I’m not really sure what’s happening. >.>


#15

You have toughness set at a value between 1 and 99?


#16

Yup. For example, having a scene earlier which increased it from 10 to 19, I went for an option that should decrease it by the unfortunate %-5. No change occured, it was still 19.


#17

-5 in fair math may simply not be enough to budge the stat.

Try -15 and see if that does anything.


#18

Embarrassing as this might be to say, that seems to have helped. >.>

Anyway, I suppose that problem is out of the way. Thanks for help. I need to get a proper feeling on this fairmath, so it doesn’t grow too big too early as well.