Fall out of choice


#1

So I’ve checked my code 100 times (using ChoiceScript IDE), but every time I use randomtest or quicktest, it gives the same error almost every time (every time for quicktest)

I can play the game perfectly, no other issues. But this stop it every time. Correct indentations, correct *goto and *goto_scene, nothing wrong in the code that crashes my game when I test it.


#2

Can you post the problematic code so we can have a look?


#3

It’s doing this with almost every choice in randomtest, but there is rarely a real problem!

*choice 1
  (text here)
  *goto_scene newscene

#4

Could you provide the entire bit of code? with all the text etc?


#5
#Great Pyrenees
        A large to giant working breed, Pyrenees are generally 2'1" to 2'8" at the shoulder, weighing between 85-160 lbs, and can live about 10-12 years. Originally bred for guarding flocks alongside shepherds, this intelligent dog is a natural for therapy and rescue work.
        *line_break
        Extremely devoted to their family, this calm dog is excellent about moving around small spaces. Unfortunately, this dog is very vocal and thanks to their keen senses of sight and smell, they are quick to bark a strangers at the door. They are also very touchy dogs, always nudging people to get attention.
        *line_break
        *line_break
        Pyrenees are always white, but sometimes get tan lines around their nose and eyes.
        *set eyes "Blue"
        *set subbreed "Working"
        *set size "Giant"
        *set breed "Great Pyrenees"
        *set coat "Long"
        *set texture "Thick"
        *set muzzle "Thick"
        *set legs "Long Thick"
        *set pelt "White"
        *set tail "Fluffy"
        *set str +2
        *set agi +1
        *set dex +2
        *set thera +1
        *set rescue +1
        *set int +2
        *set listen %+5
        *set smell +1
        *set sight +1
        *set vocal %-10
        *set like %+10
        *set service +1
        *set guard +1
        *rand moral 40 60
        *rand rank 30 70
        *rand pack 30 70
        *rand play 40 60
        *rand fear 40 60
        *rand humview 40 60
        *goto_scene puremom

#6

Mhnn… it might be that th error is in a line above or below… or that it stumbles over the rands or double linebreaks


#7

Even though the game plays with no errors?


#8

In either the actual quicktest or the actual randomtest, what line number is giving an error, and where is the line number in the code you provided?


#9

line 549 is the error, the choice sits on line 549. The option above it has no issues


#10

Ok, then can you show us the entire choice tree?

*choice
 #choice 1
 #choice 2
 #etc

#11

Ok, there is so much I am not posting it here. Dashingdon allows you to see the files, so here’s a link to the game
https://dashingdon.com/play/hexfur/a-dogs-life-pt-1/mygame/ (I am not trying to be an ass or anything, but there is just so much I do not want to post it)


#12

That’s fine. What scene file is it in?


#13

The startup file, after the names list


#14

Ok, I think I see the problem.

In the #Newfoundland choice above your #Great Pyrenees choice, you do in fact have some *goto_scene commands, but they are under an *if command.

I suspect the automated testing is treating the code as if those *if commands did not exist, therefore it thinks you fell out of the choice because it doesn’t know where to go.


#15

Bur when i test the game, it plays through just fine. Im able to go onto the next scenes with no issues.


#16

& as u could see, almodt every choice in the nreeds list has that *if then a *goto


#17

Let’s look at this example:

        *if (coatpat = "1")
          *set pelt "Black"
          *goto_scene puremom
        *if (coatpat = "2")
          *set pelt "Brown"
          *goto_scene puremom

The way you coded it won’t change gameplay if your coatpat variable is either 1 or 2 because you coded the game to handle it if is either 1 or 2. But, if it is not either 1 or 2 then the game doesn’t know what to do.

That said, if you know the variable will always be either 1 or 2, you can try adding a “dead” command below your existing code, like this:

        *if (coatpat = "1")
          *set pelt "Black"
          *goto_scene puremom
        *if (coatpat = "2")
          *set pelt "Brown"
          *goto_scene puremom
        *goto_scene puremom

The new line (*goto_scene puremom) without any if commands should, ordinarily, never be reached in normal gameplay if your variable is always 1 or 2. However, it should satisfy the automated testing because all it’s looking for is a place to go.


#18

A sidenote:
If I see this correctly some rand commands are identical between the all choices, right?

you can code more efficiently by moving them into one bit of code before the choices. like:

*temp coat1 0
*rand X
*rand coatpat 1 8

and at the choices that have less than 8 coats change it to

*if ((((coatpat =2) or (coatpat =4)) or (coatpat =6)) or (coatpat =8))

or

*if (coatpat <=4)
   *set x
   *goto x
*else
   *goto

#19

Ok, so I added the dead command below each breed that had a *if then a *goto, and now I’m getting a new error


#20

What’s the new error message?