I need help in coding


#1

Sorry to bother everyone I’m new to coding and all these but I love Choice of Games so much that I want to create one of my own I’m starting to get the hang of the basic coding but I still don’t know how to add a last name. I copied some of the codes from the given Choice of a Dragon and tweaked it so that it would help me a bit and I still don’t know how to separate the Basic stats and the Relationships. I’m already staring on my work but only just a bit of it.


#2

Hi, I just moved it into the “Choicescript help” category :wink:

Have a good day, and I hope you will find help (I’m sure you will :smiley: ).


#3

What’ve you got so far?

Have you looked at




#4

@FairyGodfeather Not yet but thanks I need all the help I can get


#5

I also did a tutorial specifically on names. (Not sure if the others include that.) There’s a few tweaks I’d ideally make to it nowadays but I’m thinking there’s likely someone done a better one around.


#6

Can you pinpoint the part where you went wrong?


#7

Oh I didn’t go wrong anywhere. I’d have just added a few fancy other options in. Like automatically capitalising the first letter of a name. And maybe adding in an option for gender-neutral characters. But the basics are there.


#8

There was nothing wrong with your tutorial it was amazing and it helped me so much but whenever I run Quicktest on firefox this pops up “Error: startup line 189: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.”


#9

Those are tricky. Try using *fake_choice instead. I use it almost exclusively for that reason.

Background: If you use *choice you have to *finish or *goto at the end do every #decision.


#10

Can you paste a sample of your code around line 189?

As it says, you need to have a *goto or a *finish after every single section in a choice block, unless you use fake_choice. I use fake_choice a lot to avoid that, but it’s bad practice.


#11

@CitizenShawn I tried it and it worked perfectly

@FairyGodfeather Here is the code i don’t know if it will help

*label orientation
Who are you attracted to?
*choice
  #Men
    *if (gender="male")
      *set orientation "gay"
      *goto meet_romance
    *if (gender="female")
      *set orientation "straight"
      *goto meet_romance
  #Women
    *if (gender="female")
      *set orientation "gay"
      *goto meet_romance
    *if (gender="male")
      *set orientation "straight"
      *goto meet_romance

*label meet_romance
*if ((gender="male") and (orientation="gay"))
  *gosub lover_male
  *goto lover_male
*if ((gender="female") and (orientation="straight"))
  *gosub lover_male
  *goto lover_male
*if ((gender="male") and (orientation="straight"))
  *gosub lover_female
  *goto lover_female
*if ((gender="female") and (orientation="gay"))
  *gosub lover_female 
  *goto lover_female

*label lover_female
*set valentine "Valentina"
*set boyfriend "girlfriend"
*set husband "wife"
*set val_he "she"
*set val_his "her"
*set val_man "woman"
*set handsome "beautiful"
*return
*goto A

*label lover_male
*set valentine "Valentine"
*set boyfriend "boyfriend"
*set husband "husband"
*set val_he "he"
*set val_his "his"
*set handsome "handsome"
*set val_man "man"
*return
*goto A

*label A
You are now stranded what are you going to do?
*fake_choice
  #Die
    *finish
  #Starve
    *finish

#12

If all else fails I’m gonna use “fake_choice”


#13

Why are you gosubing and then goto-ing the same label? That’s strange, the *choice part of your code seems to be correct, not sure why you would get that error.

The last *fake_choice is fine (oh, was that where the error was?), but you don’t need to *finish under each of those, you can just put *finish at the end, like this:

*label A
You are now stranded, what are you going to do?
*fake_choice
  #Die
    You Die
  #Starve
    You Starve
*finish

#14

@CitizenShawn Sorry I’m so new to coding I’m just learning bit by bit i haven’t coded anything before thanks for the help though


#15

No need to apologize, I’m sorrry! I realized it sounded like I thought you knew what you were doing after I posted. I know you’re new xD

In this particular situation, you just need to use *goto, *gosub will bring you back to that point after a *return. So here, you can get rid of the *gosubs and the *returns. :slight_smile:


#16

I used subs for a reason in my example, although you definitely don’t actually need them in that instance, and I can’t really remember why I used them.

I think it was because I had two occasions when you might be setting things male, two setting things female, and I liked the idea of bouncing back to where you started. But I don’t make full use of actually having used subroutines instead of gotos there, so that might have also been something on my todo list to fix about the tutorial.


#17

The tutorial I made had a section for gender variables, along with detailed notes on how to get gender neutral options in there, if you want to reference that as a starting point for improving your own guide.

Gender Pronouns Template

P.S. I would actually recommend against automatically capitalizing names, in case someone wants to RP as bell hooks or someone like that.


"I don't understand it" is the new "I don't want to listen"?
#18

How do you add checkpoints to your work?


#19

What do you need checkpoints for? They’re not something I tend to bother with.

There are a few ways,


#20

Since I’m lazy I might just point at your guide and leave it at that.

I agree! However I think it’s a nice thing to show writers it’s possible, since it was one of those little things I went ooh at. Only I couldn’t find a way to work it into my tutorial.