Variable not changing

So I have a variable called coat, which stands for coat length. But when I test it, no matter the breed, it doesn’t change. The variable in the startup file says coat, at the breed choice it may say *set coat “Long” but when I check the stats screen is still says Unknown

1 Like

could you copy the code (from startup and the bit in question? and the stats?) here

1 Like

There’s other variables too, but they vary with each breed.

*create coat "Unknown"


*choice
  #Breed 1
    (text here)
    *set coat "Long"
    *finish
1 Like

test

*set coat = “Long”

might work

1 Like

I believe *set coat “Long” is the proper way, no equals sign.

3 Likes

I think the finish might make it wonky

Hex, Could you post ALL of the relevant code?

1 Like

If your concern is with the stats screen, we need to see the choicescript_stats file as well.

1 Like

Here’s what the stats screen looks like.

[b]Breed Info[/b]
*stat_chart
  text Breed
  text Size
  text Pelt
  text Eyes
  text coat
  text texture
  text tail
  text muzzle
  text Legs

The startup scene has:

*create coat "Unknown"

*choice
  #breed 1
    (text here)
    *set coat "Long"
    *goto_scene motherscene

There are numerous choices that look similar.

1 Like

Here’s an actual snippit from my code, edited the text though

#Bloodhound
            (info text here)
            *set eyes "Brown"
            *set subbreed "Hound"
            *set size "Large"
            *set breed "Bloodhound"
            *set coat "Short"
            *set texture "Smooth"
            *set muzzle "Thick"
            *set legs "Long Thin"
            *set tail "Long Thin"
            *set str +1
            *set smell +7
            *set int +1
            *set rescue +1
            *set listen %+5
            *set like %+5
            *set moral %+25
            *rand coatpat 1 3
            *if (coatpat = "1")
              *set pelt "Liver & Tan"
              *goto_scene puremom
            *if (coatpat = "2")
              *set pelt "Tan"
              *goto_scene puremom
            *if (coatpat = "3")
              *set pelt "Black & Gold"
              *goto_scene puremom
1 Like

I’m not entirely certain, but there might be several hiccups with the rand and… do the scenes continue via finish or return?

1 Like

Minor point: You can just do *if coatpat = 1. You don’t need the quotation marks, because it’s not a string, it’s a numerical value. It’s good practice to not treat numbers as strings.

2 Likes

well the coatpat works. there’s nothing wrong with it at all, it’s only the coat that doesn’t work.

The scenes continue onto another scene entirely, which hasn’t been written.

What issues do you see with the rand?

1 Like

mainly just what gower said.
and to code more efficiently you can just put the *rand coatpat on top of the file. Will work just as well.

As for the coat: The other bits work? can you screenshot the statsscreen?

1 Like

Every other stat works fine, it’s literally just the coat that’s not working.

Here is the behavior stats screen.

[b]Behavioral Stats[/b]
    *stat_chart
      opposed_pair listen
        Listen
        Rebel
      opposed_pair rank
        Alpha
        Omega
      opposed_pair like
        Love Humans
        Hate Humans
      opposed_pair vocal
        Talkative
        Quiet
      opposed_pair moral
        Friendly
        Mean
      opposed_pair pack
        Pack
        Loner
      opposed_pair fear
        Brave
        Coward
      opposed_pair humview
        Tame
        Feral
      opposed_pair hon
        Honorable
        Dishonorable
1 Like

Curious.
okay. let’s try this:

  1. change all variable names to lower case (eyes instead of Eyes etc)
  2. change *create coat “unknown” to *create coat “”
1 Like

Wow. Ok, so I just found the problem. I have temp stats ready to help with making a random dog, one of the stats said

*temp coat 0

instead of

*temp coat1 0

Thanks for all the help though guys (I was about to try @MeltingPenguins thing though)

3 Likes

I’m sorry for posting on an old thread, but I had the same problem.

I had
*create toy “unknown”
in the startup, and at the next scene, it will have multiple choices that are basically
*set toy “firetruck”
but when I put ${toy}, it says ‘unknown’ rather than ‘firetruck’

I think I’m missing something, but I have no idea what to do. Any tips?

1 Like

Could you copy the code here?

In the startup
*create bettertoy "false"
*create toy "unknown"
Set to
"What is your toy?" she asks me.
*choice
    #"A firetruck."
        *set toy "firetruck"
        *goto boytoys
    #"A doll."
        *set toy "doll"
        *goto girltoys
    #"A robot."
        *set toy "robot"
        *goto boytoys
    #"A teddy bear."
        *set toy "teddy bear"
        *goto girltoys
In a scene
I go home, thinking about the events that day. 
*fake_choice
    #I'm just sad about it that's all.
        I can't help but be sad about my ${toy}. It was a toy that I was enjoying, and she just threw it like it was nothing.
        *set fine "false"
    #I understand.
        *set fine "true"
        *if (bettertoy = "true")
            Actually, I understood that some toys are just not appropriate for ${boy}s. Though it's still a bit unclear.
        *if (bettertoy = "false")
            Actually, I understood that she had to throw out the ${toy}. It was ruined anyway. Though I don't know why she didn't just suggest to fix it.
    #I understand, but that doesn't mean I'm fine with it.
        *set fine "false"
        I understand that some things just doesn't go my way, but that doesn't mean that I'm happy about it.
        
        *if (bettertoy = "true")
            I was confused on why she was alarmed when I told her that I had a ${toy} toy.
        *if (bettertoy = "false")
            I didn't understand why she just threw my toy. It's still mine to begin with.
    #I'm angry.
        *set fine "false"
        I can't help but give a scowl at the events, even more so at my teacher.
        *if (bettertoy = "true")
            She just flipped when I told her I had a ${toy} toy.
        *if (bettertoy = "false")
            She just threw my toy like it was nothing.
        It was still mine.
    #Meh.
        *set fine "true"
        I… don't think I actually mind. I was just alarmed when my toy got suddenly lost. Either way, I just shrug and continue on home.

*page_break
In another scene
*label blessthemeal
I nod. "Sure, I'll do it."

Mom smiles.

We link our hands together, and I close my eyes.

"Almighty, thank you for the meal that we have received today…"
*fake_choice
    #"I hope that I get my old toy back."
        *set toyinprayer "true"
        "I hope that I get my old toy back. I miss it."
        
        I open my eyes and I can see a frown from both mom and dad.
        
        "What happened to your toy?" dad asked.
        
        *if (bettertoy = "true")
            "My teacher was mad because I had a ${toy} for a toy."
            
            My mom raises her eyebrows. "You have a ${toy} toy?"
            
            I nod.
        *if (bettertoy = "false")
            "My teacher threw my toy because there was a slight dent in it."
            
            My mom raises her eyebrows. "It is the right thing to do."
            
            I frown a little at her response.
    #"I hope that you punish my teacher for taking my toy."
        *set punishtheteacher "true"
        *set toyinprayer "true"
        *if (fine = "true")
            Even if I was fine with what happened, I can't help but feel angry.
        *if (fine = "false")
            I was still reeling over the events from before. I'm still upset.
            
        *if (bettertoy = "true")
            "I hope that you punish my teacher for taking my toy, just because she didn't agree with what I was playing with."
        *if (bettertoy = "false")
            "I hope that you punish my teacher for taking my toy, and throwing it, just because it was a little bit scratched."
        
        I open my eyes to see mom and dad frowning. "That was a bit much, don't you think?" mom says.
    #"I hope we're happy everyday, that's all."
        "I hope we continue to be happy everyday, that's all."
        
        I open my eyes to see mom and dad smiling warmly at me.
        
*if (toyinprayer = "true")
    *line_break
    *line_break
    "Lets leave that talk later," dad says, trying to calm the air.
    
    Mom nods.
    
"Alright. Let's eat," she says.

Ps. Sorry for the grammatical errors if you see one.

Do you write in Notepad++ (or any other text editor)? You might want to double check if you have saved the files before testing them.