Oh my gosh help! I haven't used choicescript in forever and I'm stumped!


#1

I’m having trouble with trying to make *if *elseif work properly for multiple variables! I’ve never tried it before, I mean I’ve done it for single variables just fine, but I can’t make this work for some reason. I even did the double paranthesis thingy I saw in another thread!

My code looks like this:

*if (human = true)
    *goto humanintro
*elseif (selonian = true)
    *goto selintro
*elseif (taxxion = true)
    *goto taxxintro
*elseif ((tyria = true) and (engineer = true))
    *goto engineerintro
*elseif ((tyria = true) and (soldier = true))
    *goto soldierintro
*elseif ((tyria = true) and (pilot = true))
    *goto pilotintro

It’s all screwy. It either shows all of them at once, OR it goes down past the first two *elseif’s and picks the third one’s path, but won’t go down to pick any of the doubles! :frowning: Can you just not mix single and multiple variables like this in an *if *elseif situation? How would I make this work then, otherwise? Please help! I want it to properly mix and match my variables!

EDIT: I’m gonna screw around with it some more and see if it fixes itself.


#2

If you use *if and *elseif, pretty sure you need to end with an *else to catch all other possibilities. If you’re pretty sure there aren’t any other possibilities then you can do this

*if
  thing
  *goto place
*elseif
  other thing
  *goto place2
*else
  *bug

Hope that works, but if it doesn’t let me(/the forum) know


#3

The last one has to be an else? I’ll try that I guess!


#4

Blahs. No. :frowning: It keeps going to the third singular choice still. It just doesn’t wanna do the double variables… :frowning: Maybe I should shift their order around and put the “AND’s” on the top or something instead of the bottom?


#5

mhnnn… I know it should technically not matter, but try replacing the
(x = true) simply with (x)?

EDIT: Like

*if (human)
    *goto humanintro
*elseif (selonian)
    *goto selintro
*elseif (taxxion)
    *goto taxxintro
*elseif ((tyria) and (engineer))
    *goto engineerintro
*elseif ((tyria) and (soldier))
    *goto soldierintro
*else
    *goto pilotintro

#6

Penguins! :penguin: :slight_smile: Thanks! I’ll try that out!


#7

I would try putting your double statements under one tree like this:

*elseif (tyria = true)
  *if (engineer)
    *goto engineerintro
  *if (soldier)
    *goto soldierintro
  *if (pilot)
    *goto pilotintro

#8

^ this too.

Also, is tyra & pilot the last remaining possibility or are there others?


#9

That’s the last one. :frowning: I only made three mixed and matched AND’s for the tyria and the classes.


#10

Blehs. Still not changing anything. Still just stops on the third choice from the top, right before it SHOULD go onto the AND’s. :frowning: It just hates the AND’s. Do you think there’s a way I can like, do it in two parts, where it goes through the first singles, THEN the doubles, but like, actually works? Like in two separate *if levels or something? I don’t know! I just want it to work. Don’t care how convoluted! :smiley:


#11

here’s what I would do:

*if (human)
  *goto humanintro
*if (selonian)
  *goto selonianintro
*if (taxxion)
  *goto taxxionintro
*if (tyria)
  *if (engineer)
    *goto engineerintro
  *if (soldier)
    *goto soldierintro
  *if (pilot)
    *goto pilotintro

Try without the elseifs and else in other words


#12

Ok!


#13

I can’t tell you how many times I’ve given myself a headache trying to figure out what could possibly be wrong with my code only to realize that it was being thrown off by a typo in there somewhere. Maybe there’s just one thing that doesn’t match the *create variable and that’s why it is only stopping at a certain *elseif?


#14

also: important question: are you up to the newest version of CS?

edit: @Writing_Fever I think then quicktest would complain. the code looks fine, all parenthesis are in place.


#15

Um, I don’t know? I’m using notepad.


#16

I’ll check.


#17

Have you tried CSide? It would let you import the scene files you already have


#18

They didn’t say that they ran any of the -tests, I don’t think.

EDIT: Actually, that might be a good idea. If you’re just running the game through dashingdon or whatever and the *label text isn’t appearing, running the -tests might give you a more specific error message.


#19

Here’s the forum thread if you want it


#20

also: when you download the newest version of ChoiceScript (from where you got your current version: Save your scenes folder elsewhere, replace the old CS folder with the new stuff and replace its scenes folder with your own files)