Closed ainslec closed 3 years ago
Done.
This selected Elf:
start_at = my_location
strings / class : string ;
locations {
my_location : location "You are in a room.";
}
on_startup {
: add_choice "Wizard" {
: set_string var = "class" value = "Wizard" ;
}
: add_choice "Elf" default = "true" {
: set_string var = "class" value = "Elf" ;
}
: add_choice "Mermaid" {
: set_string var = "class" value = "Mermaid" ;
}
: choose "Choose a class ... " ;
: press_any_key ;
: clear_screen;
: print "Class : {class}";
: win_game ;
}
And (selected mermaid):
start_at = my_location
strings / class : string ;
locations {
my_location : location "You are in a room.";
}
on_startup {
: add_choice "Wizard" {
: set_string var = "class" value = "Wizard" ;
}
: add_choice "Elf" default = "true" {
: set_string var = "class" value = "Elf" ;
}
: add_choice "Mermaid" default = "true" {
: set_string var = "class" value = "Mermaid" ;
}
: choose "Choose a class ... " ;
: press_any_key ;
: clear_screen;
: print "Class : {class}";
: win_game ;
}
Add a function to allow to set a default "choice" for : add_choice / : choose. commands.
The most recent choice that has default = "true" will be the default choice, which will be selected if the player presses ENTER.
Another example: