Alright quick question guys, I have this code set up but it will not show up though when I separate them, they both work. So is it the and or did I mess the parenthesis up?
((gender = “Male”) and (varromance = true))
Alright quick question guys, I have this code set up but it will not show up though when I separate them, they both work. So is it the and or did I mess the parenthesis up?
((gender = “Male”) and (varromance = true))
There is nothing wrong with what you have shown us so far, aside from maybe a missing *if… You’d have to show us more of your code for us to have a better idea of what’s going wrong.
If i were to make a totally wild guess, I’d ask you to check that capitalizations and quotes that occur when the variables are set, also match what’s being checked.
Whit out seeing the could as @P_Tigras said we can only guess, but if a statement is true you do not need =true on it.
((gender = “Male”) and (varromance))
I don’t think it really matters though.
No it may not matter, but why add more code then needed. I am good about adding to much code at time which often leaves typos, smaller is better.
I didn’t think it would make a big difference, but it worked when I took true out. So thank you.
And I didn’t add more code because I didn’t think really think it mattered either. When I put the codes in separately they worked it was just as one code that they didn’t. So I believed it was literally just something wrong with the code I gave.
Readability, my good man. It’s a good programming rule (not just in Choicescript, but any programming language) to never sacrifice reability for execution speed, less typing, whatever. But in this case, since we’re just talking about a boolean compare, there’s not much added benefit from adding the full version.
Of course the counter argument: is *if something = true
is more readable than *if something_else
(obviously I lean towards the latter).
I know you figured out the solution, and I agree with Lordirish and stainedofmind, so I won’t repeat them, but just so you don’t have problems in the future, if you are making a boolean comparison, I believe true should have been in quotations?
Meaning, if you ever wanted to do the full code (sometimes I fill out both true and false when it’s all in a wall of text, when I need to be able to skim clearly and don’t want to confuse myself later), it would look like this:
*if ((gender = "Male") and (varromance = "true"))
Just my two cents, since that always works for me. Hope it might explain why you were having a problem and how taking out the = true part solved it. For those with more experience, if I am wrong, let me know (and please forgive me)!
I’m not the most experienced in ChoiceScript, certainly, but for what it’s worth: I’ve never used “” for true and false. True and false are booleans, right? They’re not a string, so no need for the inverted commas.
I do tend to just use
*if (nifty)
or
*if not (nifty)
The exception for me would be when I’m using a list of variables, e.g.
*if (((nifty = false) and (splendid > 75)) or ((nifty = true) and (sparkles = "appalling")))
or when using *if statements with choices.
If I recall correctly,
*if not (nifty)
can potentially cause problems on an option line though.
As a small note, it was previously recommended to use true
over "true"
because they didn’t play nice together. That said, in the newest versions of CS, true = "true"
, so *if you_want
have at it, even *if you_want = "true"
Get it? Got it. Good.
(Or, to put it more simply, "true"
now equals true
.)
Subjectivist.
[…]
true and not “True”.