Help with Choicescript if and variables


#21

oh, and before I forget it:

having a
! in front of the =
(like (drink != “nothing”))
means that this will go for all variables different from “nothing” (or what you put in there))


#22
*else
  You stand there.
  *goto questions

Okay it worked for the water after i put the exclamation mark. But now it shows the water result even if i choose nothing.


#23

oh, you don’t need to put the ! in this one.
That was just an example.
Could you copy the full code here again?


#24
*if (drink = "coffee")
  You sip the coffee. 
  *goto questions

*elseif (drink = "tea") 
  You sip the tea. 
  *goto questions

*elseif (drink != "water")
  You sip the water. 
  *goto questions

*else
  You stand there. 
  *goto questions

#25

ahh, as said, the != is when you want something being different from the variable:

*if (rival != Walter)
   It's almost a shame ${rival_name} is your rival instead of Walter. You'd have loved beating him at this.
   *goto bleh
*else
   You rejoice at the fact that you beat Walter of all people at this game.
   *goto bleh

so, just remove the ! and it should be fine.
also, maybe remove the paragraphs

*if (drink = "coffee")
  You sip the coffee. 
  *goto questions
*elseif (drink = "tea") 
  You sip the tea. 
  *goto questions
*elseif (drink = "water")
  You sip the water. 
  *goto questions
*else
  You stand there. 
  *goto questions

#26
*if (drink = "coffee")
  You sip the coffee. 
  *goto questions
*elseif (drink = "tea") 
  You sip the tea. 
  *goto questions
*elseif (drink = "water")
  You sip the water. 
  *goto questions
*else
  You stand there. 
  *goto questions

I did what you asked and it goes with the same mistake when i choose water. It goes to the nothing result.


#27

Okay, can you copy the choice to set the drink?


#28
*temp drink ""
*choice
  #Coffee seems like the only fuel you can consume here, I'll take it.
    *set drink "coffee"
    *goto intro
  #Tea helps me calm down, I'll have a cup of it.
    *set drink "tea"
    *goto intro
  #Water. Need to be hydrated.
    *goto intro
    *set drink "water"
  #Nothing really.
    *set drink "nothing"
    *goto intro

#29

ah, there’s the problem. it jumps over the *set for water

  #Water. Need to be hydrated.
    *set drink "water"
    *goto intro

This way round :slight_smile:
Everything you want to *set or have as special text needs to come before the *goto


#30

Oh dangit! I didn’t even notice XD
Sorry and thank you!


#31

No worries
Stuff like that is the bane of basically everyone making games here.
I managed to miss that my game does not set pronouns if the player chooses to play as cis woman or trans woman >_>


#32

Wow must have taken quite a while to fix it
but really thank you so much! It worked and all!


#33

not really, actually. XD
’they’ and other pronouns where set in the choice.
for the rest it was this after the next label:

*if ((gender_parent="male") or (gender_parent="trans man"))
   *set they "he"
   *set them "him"
   *set their "his"
   *set theirs "his"
   *set themselves "himself"
   *goto wakingup_train1
*elseif ((gender_parent="female") or (gender_parent="trans woman"))
   *set they "she"
   *set them "her"
   *set their "her"
   *set theirs "hers"
   *set themselves "herself"
   *goto wakingup_train1

#34

Wow.
You’re pretty good at this. :smiley:

A new inquiry has blocked me off:

"And your weaknesses?"
*choice
  *selectable_if (Mnemonist < 40) #I tend to forget things occasionally. I don't even remember my one birthday sometimes, but i've been trying to improve it.
      *set Mnemonist -10
      Agent Coy nods, understanding. Grateful that at least you've been honest and open to improvement.
      *goto person
  *selectable_if (Reflexes < 40) #I'm very clumsy, i trip over my own feet, i drop a lot of stuff... It's a difficult life.
    *set Reflexes -10
    Agent Coy nods, giving you a sympathetic smile. He seems grateful that you were honest.
    *goto person
  *selectable_if (Sharp < 40) #I've been told that i am very naive. I'm slow to understand when someone means something, and i'm not very knowledgeable in a broad sense.
    *set Sharp -10
    Agent Coy nods, barely able to hide his smile. He seems to stop himself before saying something.
    *goto person
  *selectable_if (Soothing < 40) #I can be angered easily, i have almost zero patience and i lose my temper. I apologize in advance.
    *set Soothing -10
    Agent Coy nods, grateful for your sincere apology.
    *goto person

That’s my coding right now, and what’s showing me when i test it is this “No selectable options”


#35

XD wait till you see folks like @Szaal or @Fiogan

mhnn
either redo the variable names in lowercases (IIRC sometimes things get fishy there)
or
what do you have in the
*create
for the at start of startup?


#36

I’m betting they are as good as you XD

*create Mnemonist 50
*create Reflexes 50
*create Sharp 50
*create Soothing 50

#37

okay, this might sound weird, but is there any point where it lowers these to at least 39?
if you want to have these selectable if the score is 40 OR lower you need to use

<=

instead of <


#38

The only time is when he asks for your strengths:

*choice
  #I have an amazing memory. My parents were shocked once i told them i remember certain things that happened when i was just one year old. I rarely forget information...
    *set Mnemonist +10
    "That is very impressive. And useful in your position." Agent Coy seems to be impressed and intruigued, a knowning smile on his lips. 
    *goto weak
  #I have good reflexes, though that is more applied to physical situations, i can also be very flexible in regards to schedule and a certain circusmtance.
    *set Reflexes +10
    "Now we know you won't drop anything." He laughs quietly. And you nod uncertain, you aren't sure if you can promise anything.
    *goto weak
  #I would say i'm sharp. I can sense when someone's sad, happy or angered. Reading people, Reading a situation and thinking quick is defintenly my strenght.
    *set Sharp +10
    "Very good skill for an assistant, i'm sure the team is going to love you." He smiles, but his face shows a bit of hesitation.
    *goto weak
  #People tend to feel at ease around me. I have a soothing aura and i try my best to make everyone comfortable.
    *set Soothing +10
    "That is very nice." He replies, calmly. He seems to smile as if to say that he can see what you mean.
    *goto weak

The stats are organized like this:

 opposed_pair Mnemonist
   Forgetful
 opposed_pair Reflexes
   Clumsy
 opposed_pair Sharp
   Naive
 opposed_pair Soothing
   Hot-temper

#39

Ah, this means you’ll have only 50 and one 60 in your stats after that.
change the < 40 to <=50
OR
*selectable_if (Mnemonist != 60)
etc


#40

Yes! It worked! Thank you so much!
You’re so nice and patient with me :smiley: