Help with variables

Hello !

I know how to make variable, I know how to make them go + or - , what I want to know is how to make what I have in mind without doing a mess with variables…

SO ! I want to make a lot of choice, that will happen by moment in my game, where we can choose to change or not some features of the MC : like pointy ears that appeared after a night for example.

But I want to slowly add “numbers” to the races availables when the features fit the race… I don’t know how to explain it

I will make an example with some kind of schedule “in game”, it’s just an example, imagine there is a story with it x)

day 1 : you look like usual
day 2 : you see that your nails are now claws
day 3 : you have now wolf ears instead of human ears
day 4 : some furs appear on your arms
etc…

If someone understand what I mean I will gladly accept the help ! X) Yes I want to do something difficult… But I want to !

I think you want something like this:

In startup.txt (to make it persistent) create a ‘day’ variable with value 1:

*create day 1

In any file add:

*if day = 1
you look like usual
*elseif day = 2
you see that your nails are now claws

(edit: every second line should be indented, it’s not displaying properly for me)

Increment the day where appropriate

*set day + 1

2 Likes
*create werewolf_infection false
*comment for when you first get infected with lycanthropy

*create werewolf_tracker 0
*comment to track how far along in your transformation you are

*create werewolf false
*comment for when you fully become a werewolf
*comment Start of new day, anywhere in the game.

*gosub_scene mutation_tracker mutation_tracker
*comment mutation_tracker.txt

*label mutation_tracker

*if (werewolf_infection)
  *if (werewolf_tracker = 1)
    You feel completely fine today. There is nothing wrong with you. Ignore the hunger. You'll be okay.
  *if (werewolf_tracker = 2)
    You notice your nails have grown out quite a bit. Didn't you clip them last night? They're pretty sharp, too. Like claws.
  *if (werewolf_tracker = 3)
    Everything sounds crisper. Like, until today, you've been wearing mufflers over your ears, and now you've finally taken them off. You can hear the wingbeats of butterflies. You can hear the rainclouds approaching from the horizon. You can hear the blood coursing through your best friend's veins.
  *if (werewolf_tracker = 4)
    Every hair on your body bristles, and there is much more hair than there was the other day. Just by standing still, you can feel the movement of everyone else in the room. Your hair rises -- goosebumps -- as the mood changes and everyone else goes silent.
  *if (werewolf_tracker >= 5)
    You're a werewolf, dude, come on. Everyone knows it.
    *set werewolf true

*set werewolf_tracker +1

*return
*comment Can be used for flavour as well.

Your mum pats you @{werewolf_tracker>2 behind the ears, in your favourite spot|on the head}.
4 Likes

comment Can be used for flavour as well.
Your mum pats you @{werewolf_tracker>2 behind the ears, in your favourite spot|on the head}.

:exploding_head: How did I not know about this!! I didn’t know you could treat it like an if statement in the middle of text! The amount of options for me to use multireplace just doubled :smiling_imp:

Also, I think that is missing () in order for it to function properly, though I could be wrong.

2 Likes

Yep, it’s pretty useful! I sometimes have some issues with it – I can’t recall if it accepts @{variable>=3 or not; I think it has to be a single operator: =, <, or >. Annoying but doesn’t limit its functionality, I think.

What also blew my mind recently is that you can do this: He says, @{met_before "Hi ${name}!"|"Hey, nice to meet you!"} – you can add the ${} command into multireplace and it doesn’t freak out!

2 Likes

Yup! Only single operator, just double checked. I have made a disgusting amount of use already out of the latter quirk you made mention of haha.

2 Likes

Some features of the ChoiceScript interpreter are really barely documented. There is a lot of tricks that people know by hit and miss rather than reading the documentation.

1 Like

Could potentially start a ChoiceScript Advanced User’s Guide thread that documents these functionalities in more detail. There’s a wiki which isn’t too bad, but I find it kind of useless for troubleshooting because it only talks about the most general case and doesn’t go into depth, and is straight up missing a tonne of commands I use in practically every scene.

4 Likes

I was considering doing so myself, but I want to focus on my own project first and get more experience under my belt first. For me, I wanted to focus on visual indicator implementation since I am quite a fan of what I came up with there. Plus, abilities to build on it afterwards would be great!

I just think that I should get more experience with the program first, since I’ve only really been using it a month!

Response to @Nahim_Kerman :
Arrays are completely beyond me, by which I mean today I learned arrays exist.

1 Like

I confess I am still stumble on things that ChoiceScript offers and I had no idea. I thought arrays weren’t declarable until discovering the “*create_array” command. I wonder how many other things I may be losing. CS_LIB also has some great functions that I only discovered after, out of curiosity, reading the source code… bruh.

Seconded. I just learnt about it right now. Looks really useful.

Edit: After checking, I realise this is implicit in the Wiki section on Multireplace. It just needed something to trigger the “hey, man, this can be a ternary operator” reaction. @Will l like the idea of the advanced user’s guide.

I know for a fact you can use <= / >= because I use it. I always put multireplace/if check variables in brackets though, so I tested it for you. With brackets works, without does not. From something I wrote:

@{(ruwell <=2) A| An annoying,} faint smirk…

If you don’t use brackets, it assumes you want to return:

  1. “<=2 A faint smirk…”
  2. “An annoying, faint smirk…”
2 Likes

Great! Looks that mystery’s been solved. Good investigative work.

VSC flagged it as an issue for me but maybe it is just being hyper vigilant haha.

Hm, not sure what’s with that. I’m a barbarian who writes in N++ and checks for bugs by uploading to DashingDon. Story plays fine with brackets, without it I got an error saying there weren’t enough options in the multireplace.

1 Like