Hey folks, I’ve come here with a few questions in mind about variables, and just coding, to a certain degree.
So say I had six variables to work with: strength, agility, astuteness, stealth, intimidation, and persuasion, and I wanted the player to be able to choose which one is the highest out of the group, and after they choose their highest stat, they can go on to choose the stats that go after.
Hey there, I’m back, and with more problems(unfortunately).
I modeled my coding based on what you had, but when it got down to the bottom, I get an error saying: Invalid return, we’ve already returned from the last gosub.
The invalid return is the first one in the coding, under the *gosub questions
Replace the first return with *goto [label of wherever the story continues]. That’s not a subroutine (which needs to end in *return), that’s your main story.
Everything between *label questions and the bottom *return is your subroutine. The only way people should read that is if they get there via a *gosub. You could stick all your subroutines at the very bottom of your scene txt file, underneath the final *finish, just to keep them out of the way. Or you can keep them in the middle of your story and write around them, using a label to jump from your stat-setting question to the next bit of the story.
And incidentally, you don’t need the “if round = 4, set it %+0” lines – as you’ll of course be aware, adding zero literally does nothing.
Edit:
Ah, yes, that’s right – you’d actually want to replace the first *return with
*if round=5
*goto next_bit_of_story
*goto ask
That way, you’ll go back to “ask” for rounds 1-4, and then continue the story after round 5.
That completely solved my problem. Thanks for the help, guys. ^.^
@UmbraLama, I just copied and pasted my code into the preformatted text button thing.
It looks like this : </>
Ah, and there’s another problem that I’ve run across. I want certain attributes(more specifically, the ones that weren’t picked) to be raised be a certain percentage(let’s say 5).
Doesn’t exactly solve your problem but if you don’t want any stats to remain at 0 then why not do “If strength = 0 set strength 5” instead of adding 5. I am not sure but it could possibly be an error with fairmath, maybe it can’t handle zeroes?
Fairmath can’t handle zeroes – it runs 01-99. The best way to use fairmath is for opposed stats, where 50 is (in effect) zero. For non-opposed stats that increase from 0, I’d suggest using normal math (ie take out the % before your +/-).
Right, increasing 0% by a percent of itself is always going to be 0.
I just read fairmath goes between 1-99 and doesn’t work with other numbers in ways you’d expect.