# Help please! Wondering if something simple is possible?

#1

Okay so, you know how you can make variables for relationship points like in a romance game, and have the percentage bar fill up or drain as you add or remove points to it? WELL, I was wondering if it’s possible to put a cap on the relationship bar? Like, cause if you get more and more points it’ll just go up right past 100 percent won’t it? And if you remove more and more points it’ll eventually go below zero right? So is there a way to make it STOP when it hits 100, and STOP when it hits 0 too?

#2

#3

Ooh, that looks like exactly what I wanted! Thanks! I’ll try out this fairmath % stuff then! I’ve just been using plain old +10 or -50 stuff, for example. I didn’t know you could do %+ or %- and that it’d keep it in the 0-100 range. Thank you!!!

#4

If you want to work in whole numbers (I find fairmath difficult to montior myself for stat checks due to the changing percentages as you get closer to 0 and 100) and you can keep it pretty close to within 0-100, if you go over or under a little, you can kind of cheat with a code to set it back to 100 or 0. Basically something along the lines of :

``````*set strength +10
*if (strength > 100)
*set strength 100
``````

Depends what you need to do with it really

#5

Thanks! I’ll try this out sometime I guess! Kinda would suck to have to put that *if clause on every single *set variable though…But that’s just me being lazy. It’d not be more work than having to make every single *set variable to begin with!

#6

You could create a little subroutine with that code in it. You call the subroutine with *gosub name and end the subroutine with *return. Then you can call it from anywhere in your story as many times as you like. You can add parameters as well so you can vary the amount you change the strength by.

e.g.

``````*label add_strength amt
*params amt
*set strength (strength + amt)
*if (strength > 100)
*set strength 100
*return

``````

Then you just call it as many times as you like, with: