Ultimate Noob Coding

The first choice determines what the second set of choices will be but the choice 2’s answers keep replacing choice 3’s answers as well as omitting the text before it. Did I input something wrong?

Here’s an example of my code:

*create strength 10
*create agility 10
*create intelegence 10
*create charisma 10
*create gender "undetermined"
*create mx "mx"
*create name ""
Pick blah blah blah blah blah blah.
*choice1
	#Male
		*set gender "male"
		*goto gender_chosen
	#Female
		*set gender "female"
		*goto gender_chosen
	#I Don't care...
		*temp random_gender
		*rand random_gender 1 2
		*if (random_gender = 1)
			*set gender "male"
		*if (random_gender = 2)
			*set gender "female"
		*goto gender_chosen
*label gender_chosen
*if (gender = "male")
	*set mx "Dante"
*if (gender = "female")
	*set mx "Lilith"
*if (gender = "male")
	Bunch of words here.
*choice2
	#option1
		*set strength +10
	#option2
		*set agility +10
		*goto action
*if (gender = "female")
	Bunch of words here
*choice3
	#option1 
		*set charisma +10
	#option2
		*set intelegence +10
		*goto action
*label action
Well ${mx}.
*line_break
Blah Blah Blah Blah Blah.
*finish
Example
*commend
    Indent
1 Like

Welcome! For starters, there has to be a *goto after each option in a choice; it looks like you only have it under the last option in each choice. But if I choose to boost strength, I need a goto, and if I choose to boost agility, I need a goto, even if they’re the same one (which they usually would be, though they certainly don’t have to be).

1 Like

Another code question -

I have a situation where I have a number of dialogue choices (1 - 8). Choice 8 moves the scene on, choices 1-7 are dialogue loops which go back to the choice menu. 5 of the options are always visible but dialogue options 6 and 7 are contingent on previous events

It looks like this.

*label choice_loop
*choice
    *disable_reuse #Talk about A
        text
        *goto choice_loop
    *disable_reuse #Talk about B
        text
        *goto choice_loop
    *disable_reuse #Talk about C
        text
        *goto choice_loop
    *disable_reuse #Talk about D
        text
        *goto choice_loop
    *disable_reuse #Talk about E
        text
        *goto choice_loop
    *if (variable_1 = 1)
        *disable_reuse #Talk about F
            text
            *goto choice_loop
    *if (variable_2 = 1)
        *disable_reuse #Talk about G
            text
            *goto choice_loop
    #You don't want to talk about the others.
        *goto next_scene

Now the last option - to move the scene onwards I want to change the wording based on if you have exausted all other dialogue options

So if you have exausted all options it would say “There is nothing else to talk about.” but if there were still options availability you don’t want to chose it will say “You don’t want to talk about the others.”

Now I know how to do this if all other dialogue options were selectable at all times, you could just use a simple count which goes up for each dialogue choice and a check to see if the max count has been reached then change the text of the final choice depending on that, using e.g. multireplace or various other ways

But my problem is that the “max” dialogue choices in this instance range from 6 to 8 depending on previous choices. So my question is - 1) is there a way to just code a check to see if all other dialogue choices have been exhausted? and 2) if this is not possible could anyone think of a work around?

you could use a numeral temp and multireplace. (for this assume F and G can’t show up in the same playthrough)

so

*temp talkywalky 0

*label choice_loop
*choice
    *disable_reuse #Talk about A
      *set talkywalky +1
      text
      *goto choice_loop
    *disable_reuse #Talk about B
      *set talkywalky +1
      text
      *goto choice_loop
    *disable_reuse #Talk about C
      *set talkywalky +1
      text
      *goto choice_loop
    *disable_reuse #Talk about D
      *set talkywalky +1
      text
      *goto choice_loop
    *disable_reuse #Talk about E
      *set talkywalky +1
      text
      *goto choice_loop
    *if (variable_1 = 1) *disable_reuse #Talk about F
      *set talkywalky +1
      text
      *goto choice_loop
    *if (variable_2 = 1) *disable_reuse #Talk about G
      *set talkywalky +1
      text
      *goto choice_loop
    #@{(talkywalky =5) There's no one else to talk to| You don't want to talk about the others}.
      *goto next_scene

adjust the indents to your needs

unfortunatly that won’t work because the value of “talkywalk” will vary between 6 and 8 in my example.

see here:

Do #F and #G made visible by A~E, or are they triggered by condition outside of this *choice scope?

they are triggered by conditions outside of this code snippet.

The only workaround I can currently think of is to have the same variables that allow F and G to be conditioned to increase the “max count”

waaaaait what if:

*temp talkywalky 0
*temp talkywalkytrigger 5
*if variable_1 = 1
    *set talkywalkytrigger + 1
*if variable_2 = 1
    *set talkywalkytrigger + 1 

All the rest of the code here

#@{(talkywalky = talkywalkytrigger) There's no one else to talk to| You don't want to talk about the others}.
      *goto next_scene

think i might have solved it thank you all

as said, adjust things to your needs

Bit of ring rust showing up. Is there a reason why my quick and random test have stopped working? Tried to run it on my new WIP and it says Error: couldn’t open web/mygame/scenes/startup.txt. Tried it with the Parenting ones and it says the same thing.

Anyone know about the above issue? Still have not figured it out, and it’s throwing off me potentially putting up a new WIP thread today.

Not sure why this might be happening. Is it possible the files got corrupted?

Some things to consider/try if you haven’t already:

Does the problem persist with a freshly downloaded copy of CS?

Is your browser updated to the most recent version?

If you create a brand new blank game, do the tests work on that?

1 Like

They shouldn’t be corrupted; they work on CSIDE just fine.

I have never had a new version of CS. I guess I did not know that was a thing. Do you just delete all the old stuff or something?

It’s been a while since I’ve downloaded an up to date version of ChoiceScript, but I would be terribly surprised if the answer has changed: I’ve always been able to keep multiple ChoiceScript versions side-by-side, each in their own folder. I’ve never deleted any of them, and never had a conflict.

That said, your original error message (couldn’t open web/mygame/scenes/startup.txt) is almost certainly possibly due to an update in your web browser that changes the way locally hosted files (index.html, quicktest.html, randomtest.html, etc.) can load other files (startup.txt, etc.).

Download a new ChoiceScript installation, read the installation instructions three times (because they’re almost certainly different than what you’ve done with past versions), then follow the instructions and try it with the new version.

1 Like