Adding several choice options on one page


#1

@Reaperoa
I noticed in your aeon sage game that you strung together several choice options on one page. How would one code something like that.
What I’m trying to do is have the reader select multiple pieces of armour and it seems like a better idea to have them do this on one page rather then pick one item, push ok then have to repeat this over and over again…


#2

You have to nest additional choices inside a choice selection so there’s a lot of repeated lines:

*choice
  #Armor 1
    *set armor 1
    *choice
      #Helmet 1
        *set helmet 1
        *finish
      #Helmet 2
        *set helmet 2
        *finish
      #Helmet 3
        *set helmet 3
        *finish
  #Armor 2
    *set armor 2
    *choice
      #Helmet 1
        *set helmet 1
        *finish
      #Helmet 2
        *set helmet 2
        *finish
      #Helmet 3
        *set helmet 3
        *finish
  #Armor 3
    *set armor 3
    *choice
      #Helmet 1
        *set helmet 1
        *finish
      #Helmet 2
        *set helmet 2
        *finish
      #Helmet 3
        *set helmet 3
        *finish

Can’t check it right now but I’m pretty sure that’s good code/format for it


#3

Straight copy/paste from my game.

*choice Verbosity Difficulty System
  #High
    #Normal
      #Imperial
        *gosub easy_mode_defaults
        *set imperial true
        *finish
      #Metric
        *gosub easy_mode_defaults
        *set metric true
        *finish
    #Hard Mode
      #Imperial
        *set hardmode true
        *set imperial true
        *finish
      #Metric
        *set hardmode true
        *set metric true
        *finish
  #Low
    #Normal
      #Imperial
        *gosub easy_mode_defaults
        *set verbose false
        *set imperial true
        *finish
      #Metric
        *gosub easy_mode_defaults
        *set verbose false
        *set metric true
        *finish
    #Hard Mode
      #Imperial
        *set hardmode true
        *set verbose false
        *set imperial true
        *finish
      #Metric
        *set hardmode true
        *set verbose false
        *set metric true
        *finish

Magical Academy (story idea)
The Beastie Watch (WiP) - Updated 25 September
#4

@dashingdon
not quite what I was after but thank you for the quick response :slight_smile:
@Reaperoa
Oh wow thank you!


#6

so ive use @Reaperoa coding and came up with this monstrosity

*label armour_select
*choice Armour selection
	#light chest set.
		#light armour Gauntlet
			#light armour Greaves
				#light armour helmet
					*set light_chest true
					*set light_gauntlet true
					*set light_greaves true
					*set light_helmet true
					*goto weapon_select
				#Heavy armour helmet
					*set light_chest true
					*set light_gauntlet true
					*set light_greaves true
					*set heavy_helmet true
					*goto weapon_select
			#Heavy armour Greaves
				#light armour helmet
					*set light_chest true
					*set light_gauntlet true
					*set heavy_greaves true
					*set light_helmet true
					*goto weapon_select
				#Heavy armour helmet
					*set light_chest true
					*set light_gauntlet true
					*set heavy_greaves true
					*set heavy_helmet true
					*goto weapon_select
		#Heavy armour Gauntlet
			#light armour Greaves
				#light armour helmet
					*set light_chest true
					*set heavy_gauntlet true
					*set light_greaves true
					*set light_helmet true
					*goto weapon_select
				#Heavy armour helmet
					*set light_chest true
					*set heavy_gauntlet true
					*set light_greaves true
					*set heavy_helmet true
					*goto weapon_select
			#Heavy armour Greaves
				#light armour helmet
					*set light_chest true
					*set heavy_gauntlet true
					*set heavy_greaves true
					*set light_helmet true
					*goto weapon_select
				#Heavy armour helmet
					*set light_chest true
					*set heavy_gauntlet true
					*set heavy_greaves true
					*set heavy_helmet true
					*goto weapon_select
	#Heavy chest set.
		#light armour Gauntlet
			#light armour Greaves
				#light armour helmet
					*set heavy_chest true
					*set light_gauntlet true
					*set light_greaves true
					*set light_helmet true
					*goto weapon_select
				#Heavy armour helmet
					*set heavy_chest true
					*set light_gauntlet true
					*set light_greaves true
					*set heavy_helmet true
					*goto weapon_select
			#Heavy armour Greaves
				#light armour helmet
					*set heavy_chest true
					*set light_gauntlet true
					*set heavy_greaves true
					*set light_helmet true
					*goto weapon_select
				#Heavy armour helmet
					*set heavy_chest true
					*set light_gauntlet true
					*set heavy_greaves true
					*set heavy_helmet true
					*goto weapon_select
		#Heavy armour Gauntlet
			#light armour Greaves
				#light armour helmet
					*set heavy_chest true
					*set heavy_gauntlet true
					*set light_greaves true
					*set light_helmet true
					*goto weapon_select
				#Heavy armour helmet
					*set heavy_chest true
					*set heavy_gauntlet true
					*set light_greaves true
					*set heavy_helmet true
					*goto weapon_select
			#Heavy armour Greaves
				#light armour helmet
					*set heavy_chest true
					*set heavy_gauntlet true
					*set heavy_greaves true
					*set light_helmet true
					*goto weapon_select
				#Heavy armour helmet
					*set heavy_chest true
					*set heavy_gauntlet true
					*set heavy_greaves true
					*set heavy_helmet true
					*goto weapon_select  

now it comes up with two choices on the single page which is what i was trying for (chest and gauntlet) but not (greaves and helmet), so obviously what ive done isnt quite right. confirmed by this coming up when i press the next button.

line 229: it is illegal to fall out of a *choice statement;you must goto or finish before the end of the indented block. #light armour Greaves is the line its showing…

any master coders see where i messed up?


#7

Your problem lies mainly in the first few lines, beginning with the *choice line itself. Take a look at the multi choice example given on the wiki, which is especially handy as you can see both the code and how it actually appears in-game:


#8

checked it out but the “Multiple *choice” segment example is somewhat confusing, it either doesn’t work on my computer for some reason or there’s something wrong with the example (appears as one solid wall of text…)


#9

I changed the above line to this:

*choice chest gauntlet greaves helmet

and it works after that change.


#10

@dashingdon
oh awesome!! Thank you very much, that did the job!
not sure i fully understand how or why it worked but happy as hell over it :smiley:


#11

I think you just have to explicitly tell *choice how many selections will be nested by naming each nested entry. You’ll notice that now it says:

Select a chest:

Above the first selection and then subsequently “gauntlet” “greaves” and “helmet” instead of “chest” for the remaining selections. So it seems the engine parses the words following *choice to label the selections. Without those words for the labels, the engine gets ornery and errors out.


#12

Very odd. May I ask which browser you’re using?

Does anyone else see just a confusing wall of text for the “multiple choice” example on that wiki page? (To clarify: what you should see is an interactive example, whereby you can click the ‘Result’ tab to see how the example code will actually appear in-game).


#13

this is what i get unfortunately

and this comes up when i hit the result button

Mozilla firefox


#14

It feels very odd ‘liking’ that so I’ll just say thanks for taking the time to show us the problem – hopefully @CJW will be able to look into it for us and see what the problem might be, although it will probably take a while to sort out.


#15

No thank you and all the other members of the forum for all the help. And that wiki page is amazing, ive been studying and using it a lot over the past two weeks (its why im running firefox and pad ++ because it was recommended it) :blush: