*goto not going where expected


#1

So my game has been fine until I started getting complicated. (A Dog’s Life)

After you make your dog/wolf/coyote/hybrid, it takes you to the next scene (called Mother).

But after checking it a few minutes ago, it doesn’t do that anymore. Everyone starts off with the wolf beginning scene and continues into that.

Here’s what the txt says:

(choose name, then gender, then breed)
#Breed
<goto_scene mother>
(at mother scene)
*if (breed = “Wolf”)
<wolf start
*if (breed = “Wolfdog LC”)
<supposed to be Wolfdog LC start, but starts off at Wolf start>
*if (breed = “Wolfdog HC”)
<supposed to be Wolfdog HC start, but starts off at Wolf start>
*if ((breed = “Coyote”) or (breed = “Coydog”))
<supposed to be Coyote/Coydog start, but starts off at Wolf start>
*if else
<supposed to be Dog start, but starts off at Wolf start>


#2

Do you literally have <goto_scene mother> or is it *goto_scene mother?


#3

*goto_scene mother

I can’t make it look that way in the forum for some reason. It automatically looked like that when I posted


#4

Oh, that’s easy, just click on the Preformatted text button in order to put stuff like this (but I don’t know where your spacing is; you can do spacing in the thing below):

(choose name, then gender, then breed)
#Breed
<goto_scene mother>
(at mother scene)
*if (breed = “Wolf”)
<wolf start
*if (breed = “Wolfdog LC”)
<supposed to be Wolfdog LC start, but starts off at Wolf start>
*if (breed = “Wolfdog HC”)
<supposed to be Wolfdog HC start, but starts off at Wolf start>
*if ((breed = “Coyote”) or (breed = “Coydog”))
<supposed to be Coyote/Coydog start, but starts off at Wolf start>
*if else
<supposed to be Dog start, but starts off at Wolf start>

#5


#6

This may be a portion of the error: The necessary statement is *else, not *if else, It may not be the whole of the error, though. Try correcting this then re-testing. What happens once that’s been changed?

EDIT: Right now, your *if structure looks something like this:

*if
*if
*if
*if
*else

However, in that situation, the *else will only apply to the final *if, not to all of them. For the *else to apply to the whole chain of *if statements, it would need to look something like this:

*if
*elseif
*elseif
*elseif
*else

Also note, that unless implicit control flow is enabled, *else and *elseif will require *goto commands after each. That would look something like this:

*if
  *goto next
*elseif
  *goto next
*elseif
  *goto next
*elseif
  *goto next
*else
  *goto next
*label next

#7

Same issue. tested it with each wolf, coyote, both wolfdogs, & a random dog breed


#8

Could you post your code as preformatted text, without the (what i assume to be, at least) comments? That would make it easier to see what might be the problem


#9

(create gender, choose name, pick breed)

#breed
    info about breed
    *goto_scene mother

(mother scene)

*if (breed = "Wolf")
      wolf beginning
*if (breed = "Wolfdog LC")
      wolfdog lc beginning (but turns out to be wolf beginning)
*if (breed = "Wolfdog HC")
      wolfdog hc beginning (but turns out to be wolf beginning)
*if ((breed = "Coyote") or (breed = "Coydog"))
      coyote/coydog beginning (but turns out to be wolf start)
*else
      dog beginning (but turns out the be wolf start)


#10

You need to post the original code in order for us to see and solve the problem though :slight_smile:


#11

Ok, and is your “mother scene” on the same text file as your current code, or is it its own text file?


#12

Its a seperate text file


#13

And your mother scene is named

mother.txt

right?


#14

That is correct. This scene is too big to put into with the startup file


#15

Ok so you have 2 options.

1- change it all to if’s then put the text for each if below the statement, then just continue with the plot.

2- use *if *elseif’s and *else then make seperate labels for each and put *goto below each statement, directing to which label you need.

EDIT: if another scene use *goto_scene label


#16

Ok then, do you see the top of your code that starts with
#Breed

Is this listed under a
*choice
?

Example:

*choice
   #Breed

#17

@Carlos.R yes it is.

& I’m trying the label thing now @needs-to-be-loved i’ll replay in a few minutes if that works or not


#18

Also, please let us know if you get a specific quicktest or randomtest error. It’s very easy to narrow down the problem using those tools.


#19

Alright, so I tried the *label thing, seperated according to breed & used an *else statement, and it worked!
Below is how I fixed it! Thanks guys!

*if (breed = "Wolf")
   *goto breedwolf
*if (breed = "Wolfdog LC")
   *goto breedwolfdoglc
*if (breed = "Wolfdog HC")
   *goto breedwolfdog HC
*if ((breed = "Coyote") or (breed = "Coydog")
   *goto breedcoyote
*else
   *goto breeddog

#20

I’m glad you fixed it, but this still bothers me…

*choice
 #Option
  *goto_scene SomeScene

This should work every time. If it doesn’t, something else is wrong.