1  #!/bin/bash
     2  
     3  # extension1_13 - Sub script of an example extension quiz.
     4  # this quiz is almost the same as the lake quiz, "greatsaltlake"
     5  
     6  # function called by a function, "ext3_quiz" to show an animation for the Lake quiz
     7  ext1_13_blink()
     8  {
     9  for ((i=1; i < 11; i++)) ;do
    10    for ((j=1; j < 3; j++)) ;do
    11      sleep 0.25; ~/mos/ext/map/.usamap_Cu_ext1_13_blink_$j; echo "";
    12    done
    13  done
    14  }
    15  
    16  # function called by the main script, to quiz a user about Great Salt Lake
    17  ext1_13_quiz()
    18  {
    19  answer=
    20  count=0
    21  
    22  stage_n=$((stage_n + 1))
    23  clear
    24  ext1_13_blink
    25  ## .usamap_984_gl
    26  clear
    27  ~/mos/ext/map/.usamap_Cu_ext1_13_blink_1
    28  federal_quiz_message
    29  quiz_of_federal3
    30  while [ "$answer" != "1" ] ; do
    31    read answer
    32    if [ $answer -eq 1 ] ;then
    33      clear
    34      choose_area_list
    35      .cusam_Cu$territory
    36      choose_next_gstate_list
    37      echo "$w_correct_message_h $o_gstate $w_correct_message_t"
    38      sleep 3
    39      clear
    40      .world_map
    41      if [ "$rswitch" = off ] ; then
    42        echo "$report"
    43      else
    44        cut_and_sleep "$report"
    45      fi
    46      lake="Great-Salt-Lake"
    47      lake2="Caspian-sea"
    48      lake3="Lake-Baikal"
    49      topography $lake $lake2 $lake3
    50    else
    51      count=$((count + 1))
    52      if [ $count -gt 1 ] ; then
    53        echo "$game_over_twice"
    54        exit 4
    55      else
    56        echo -n "$wrong_message_h2 $count $wrong_message_t "
    57      fi  
    58    fi  
    59  done
    60  sleep 5
    61  }

The developer explained how to create a new quiz comparing any nation in the world with USA by modifying "extension1_11".
This time, the developer explains the way to make a new quiz about US topography by modifying "extension1_13".
Now let's create a new quiz to ask a user about Lake Mead which lies between Nevada and Arizona.
At first we must change the present map to a new map indicating the location of Lake Mead.
The above script, "extension1_13" calls the map in the line 11 < sleep 0.25; ~/mos/ext/map/.usamap_Cu_ext1_13_blink_$j; echo "" > and
line 27 < ~/mos/ext/map/.usamap_Cu_ext1_13_blink_1 >.
These commands call a script (scritpts in the line 11), ".usamap_Cu_ext1_13_blink_*" (* is a symbol to indicate any continuous 0-or-more letter(s)).
"$j" of < sleep 0.25; ~/mos/ext/map/.usamap_Cu_ext1_13_blink_$j; echo "" > indicates 1 or 2 in this case.
The developer will explain the reason why it indicates these numbers latter.
Then, let's see the script, ".usamap_Cu_ext1_13_blink_1" in a directory, "~/mos/ext/map/" first.

     1  #!/bin/bash
     2  
     3  # .usamap_Cu_ext1_13_blink_1 - Sub script to show a slide of the animation of a topographic map for a quiz named "extension1_13".
     4  
     5  . ~/mos/bin/changeable_capital_initializeANSI
     6  base_initializeANSI
     7  
     8  redf1=
     9  redf2=
    10  redf3=
    11  redf4=
    12  redf5=
    13  
    14  #gl_r=$reset
    15  
    16  . ~/mos/ext/map/usamap_Cu_ext1_13_source.sh
    17  ext3_source

In this script two other scripts are inserted in the line 5 and line 16.
We must change only the line 16 to call a new map source.
We must also create a new map source before calling it.  Then let's see the script, "usamap_Cu_ext1_13_source.sh" in the directory, "~/mos/ext/map/".

     1  #!/bin/bash
     2  
     3  # usamap_Cu_ext1_13_source.sh - Sub script to work as a source for the slides of the animation for the lake quiz.
     4  # This script is a source to show slides for a demo and almost the same as "usamap_Cu_gl_source.sh" which is for the lake quiz.
     5  # You can create a new slide or a new static map for your own quiz by modifying this script.
     6  
     7  ext3_source()
     8  {
     9  cat << EOF
    10  ------------------------------- Welcome to Master of States. Let's learn about the United States of America! ---------------------------------
    11  ${yellowb}${whitef}*  ${reset}${blueb}****${whitef}*${reset}${blueb}***${reset}   ${whitef}*     ${blueb}${blackf}*${whitef}*${reset}${blueb}******${reset}${yellowf}*${purpleb}${yellowf}${yellowf}UVWXYZ${redf}1${yellowf}234567${whitef}8${yellowf}9ABCDE${whitef}F${yellowf}GHIJ${yellowf}KL${whitef}M${yellowf}NOPQRS${whitef}T${yellowf}UVWXYZ${redf}1${yellowf}234567${whitef}8${yellowf}9ABCDE${whitef}F${yellowf}GHIJKL${whitef}M${yellowf}NOPQRS${whitef}T${yellowf}UVWXYZ${redf}1${yellowf}234567${whitef}8${yellowf}9ABCDE${whitef}F${yellowf}GHIJKL${whitef}M${yellowf}NOPQRS${whitef}T${yellowf}UVWXYZ${redf}1${yellowf}2${reset}0
    12  ${blueb}*****${reset}  ${blueb}**${reset}                 ${blueb}**${reset} ${yellowb}                                                       ${blueb}******************${yellowb}                     ${blueb}*******************${reset}1
    13  ${blueb}******${reset}                    ${yellowb}  ${reset} ${yellowb}                                                      ${blueb}*******************${yellowb}                             ${blueb}***********${reset}2
    14  ${blueb}***${reset}                      ${yellowb}   ${reset} ${yellowb}                                                      ${blueb}*********************${yellowb}                                    ${blueb}**${reset}3
    15  ${blueb}**${reset}        ${yellowb} ${reset}             ${yellowb}    ${reset} ${yellowb}                                                       ${blueb}**********************${yellowb}                                 ${blueb}**${yellowb} ${reset}4
    16  ${blueb}${redf}*${reset}${blueb}**${yellowb} ${reset}   ${yellowf}* ${blueb}${blackf}*${reset}    ${yellowf}*      * ${yellowb}     ${reset}${yellowf}*${yellowb}${whitef}      *      *      *      *      *      *      *      *   ${reset}${blueb}***${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}******${redf}*${reset}${yellowb}${whitef}      *      *      *      *    ${reset}${blueb}**${redf}*${yellowb} ${reset}5
    17  ${blueb}****${reset}  ${blueb}***********${reset}     ${yellowb}      ${reset} ${yellowb}                                                                     ${blueb}*****${yellowb}                              ${blueb}*********${reset}6
    18  ${blueb}***${reset} ${blueb}*****************${reset}  ${reset}${yellowb}     ${reset} ${yellowb}                                                                       ${blueb}****${yellowb}                           ${blueb}***${yellowb}   ${reset}${blueb}*****${reset}7
    19  ${blueb}**********************${reset}  ${yellowb}    ${reset} ${yellowb}                                                                                                      ${blueb}*${yellowb}          ${reset}8
    20                               ${yellowb}                                                                                                    ${bluef}_?  ${reset}     ${yellowb}   ${blueb}*${reset}9
    21  ${blueb}${redf}*${reset}${blueb}******${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}*${reset}     ${yellowf}*${reset} ${yellowb}${whitef}     *      *      *      *      *      *      *      *      *      *      *      *      *      *${bluef}_/${blackf}    ${reset}${yellowf}*${reset}      ${blueb}${redf}*${reset}${blueb}*${reset}A
    22  ${blueb}********************${reset}   ${blueb}*${reset}                 ${yellowb}                                                   ${cyanb}******${reset}${yellowb}                            ${bluef}/${reset}           ${blueb}****${reset}B
    23  ${blueb}*********************${reset}    ${yellowb} ${reset}            ${bluef}___${reset}         ${bluef}_______${reset}   ${yellowb}                      ${reset}       ${cyanb}*****${reset} ${cyanb}****${reset}${yellowb}                    ${bluef}_____/${reset}          ${blueb}*******${reset}C
    24  ${blueb}********************${reset}                  ${bluef}\\  \\_______/${reset}       ${bluef}\\_____${reset}                   ${bluef}${resetb2}${redf2}-${bluef}${resetb3}${redf3}-${bluef}${resetb4}${redf4}-${bluef}${resetb5}${redf5}+${reset}              ${cyanb}********${yellowb}         ${bluef}_/${reset}      ${reset}        ${blueb}*********${reset}D
    25  ${blueb}********************${reset}                  ${bluef}/${reset}                        ${bluef}\\${reset}                     ${bluef}${resetb1}${redf1}/${reset}            ${cyanb}**${reset}    ${cyanb}**${reset}${yellowb} ${cyanb}**${reset}${yellowb}    ${cyanb}*****${reset}              ${blueb}**********${reset}E
    26  ${blueb}${redf}*${reset}${blueb}******${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}****${reset}  ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}  ${bluef}\\_${reset}  ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}${bluef}\\${reset}     ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}${bluef}${resetb2}${redf2}\\${bluef}${resetb3}${redf3}_${bluef}${resetb4}${redf4}_${reset}   ${yellowf}*${reset}     ${cyanb}*${whitef}*${reset}      ${cyanb}${redf}*${reset}${yellowb}     ${cyanb}*${whitef}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}${blueb}******${whitef}*${reset}${blueb}******${redf}*${reset}${blueb}*${reset}F
    27  ${blueb}******************${reset}                                               ${bluef}|${reset}                      ${bluef}${resetb5}${redf5}\\${reset}        ${cyanb}***${reset}       ${yellowb} ${cyanb}****${reset}              ${blueb}*${reset}  ${blueb}*************${reset}G
    28  ${blueb}*****************${reset}                                                 ${bluef}\\_${reset}                     ${bluef}${resetb1}${redf1}\\${bluef}${resetb2}${redf2}_${reset}      ${cyanb}**${reset}        ${cyanb}**${reset}    ${bluef}_/${reset}           ${blueb}****************${reset}H
    29  ${blueb}*****************${reset}                                                   ${bluef}\\_____${reset}              ${bluef}${resetb3}${redf3}_${bluef}${resetb4}${redf4}_${bluef}${resetb5}${redf5}/${reset}                     ${bluef}/${reset}              ${blueb}***************${reset}I
    30  ${blueb}****************${reset}                                                          ${bluef}|${reset}            ${bluef}${resetb1}${redf1}/${reset}                      ${bluef}_/${reset}               ${blueb}***************${reset}J
    31  ${blueb}${redf}*${reset}${blueb}******${whitef}*${reset}${blueb}******${whitef}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${cyanb}${gl_r}${redf}?${reset}${cyanb}${gl_r}*${reset}     ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}   ${bluef}|${reset}  ${yellowf}*${reset}      ${yellowf}*${reset} ${bluef}${resetb3}${redf3}/${reset}    ${yellowf}*${reset}      ${yellowf}*${reset}     ${bluef}_${yellowf}*${reset}   ${bluef}/${reset}  ${yellowf}*${reset}      ${yellowf}*${reset}   ${blueb}*${reset}  ${blueb}${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}******${redf}*${reset}${blueb}*${reset}K
    32  ${blueb}****************${reset}                                            ${redf}THIS IS DEMO AS${bluef}\\${redf}extension1${bluef}${resetb3}${redf3}_${redf}13            ${bluef}__/ \\_/${reset}               ${blueb}*${reset}  ${blueb}****************${reset}L
    33  ${blueb}***************${reset}     ${cyanb}*${reset}                                                       ${bluef}\\____      ${bluef}${resetb4}${redf4}\\${bluef}${resetb5}${redf5}_${reset}     ${bluef}______/${reset}                      ${blueb}**${reset} ${blueb}****************${reset}M
    34  ${blueb}***************${reset}                           ${bluef}_/   ${yellowb} ${reset}   ${yellowb} ${reset} ${bluef}\\__                         ${bluef}\\------?${bluef}${resetb1}${redf1}\\${reset}   ${bluef}/${reset}                              ${blueb}******************${reset}N
    35  ${blueb}****************${reset}                       ${bluef}__/${reset}       ${yellowb} ${reset} ${bluef}\\${reset}    ${bluef}\------------------+${reset}              ${bluef}${resetb2}${redf2}|${bluef}?+${reset}                                 ${blueb}****************${reset}O
    36  ${blueb}${redf}*${reset}${blueb}******${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}*${reset}   ${yellowb} ${reset} ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset} ${bluef}_/   ${reset}${yellowf}*${reset}      ${yellowf}*${reset} ${bluef}/    ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}     ${bluef}\\${reset}${yellowf}*${reset}      ${yellowf}*${reset}     ${bluef}${resetb3}${redf3}\\${reset}${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}  ${yellowb} ${reset}   ${yellowf}*${reset}      ${yellowf}*${reset}     ${blueb}*${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}******${redf}*${reset}${blueb}*${reset}P
    37  ${blueb}*****************${reset}            ${cyanb}*${reset}${bluef}__${reset}  ${bluef}+-/${reset}             ${bluef}/${reset}                          ${bluef}\\-------+   ${bluef}${resetb5}${redf5}_${bluef}${resetb4}${redf4}/${reset}                                ${blueb}*******************${reset}Q
    38  ${blueb}*****************${reset}             ${bluef}| \\_|${reset}              ${bluef}/${reset}                                    ${bluef}\\ ${bluef}${resetb1}${redf1}| ${reset}                               ${blueb}*********************${reset}R
    39                  ${blueb}***${reset}           ${bluef}|${reset}                 ${bluef}|${reset}                                      ${bluef}?${bluef}${resetb2}${redf2}/${reset}                              ${blueb}***********************${reset}S
    40  ${reset} ${blueb}**************${reset} ${blueb}******${reset}        ${bluef}|${reset}                 ${bluef}|${reset}                                      ${bluef}${resetb3}${redf3}/${reset}                             ${blueb}*************************${reset}T
    41  ${blueb}${redf}*${reset}${blueb}******${blueb}${whitef}*${reset}${blueb}******${whitef}*${reset}${reset} ${blueb}*****${whitef}*${reset}${blueb}*${reset}${yellowb}     ${whitef}* ${bluef}?   ${reset} ${yellowf}*${reset}      ${yellowf}*${reset}     ${bluef}|${reset}${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}  ${bluef}${resetb4}${redf4}\\${reset}   ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}  ${blueb}****${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}******${redf}*${reset}${blueb}*${reset}U
    42  ${blueb}*****${reset} ${blueb}*********${reset} ${blueb}*********${yellowb}     ${blueb}***${yellowb}               ${reset}${bluef}|___${reset}    ${bluef}+-+${reset}                            ${bluef}${resetb5}${redf5}/${bluef}${resetb1}${redf1}_${reset}                        ${blueb}*****************************${reset}V
    43  ${blueb}********${reset} ${blueb}******${reset} ${blueb}************${yellowb}   ${blueb}***${yellowb}                  ${reset}${bluef}\\__/${reset}${yellowb}   ${reset}${bluef}\\-+${reset}                           ${bluef}${resetb2}${redf2}?${reset}   ${blueb}***************${reset}    ${blueb}******************************${reset}W
    44  ${blueb}***************${reset} ${blueb}**************${yellowb}   ${blueb}****${yellowb}                         ${reset}${bluef}\\-+${reset}            ${blueb}*************${reset} ${blueb}*****************${reset}      ${blueb}****************************${reset}X
    45  ${blueb}*************${reset}   ${blueb}*************${yellowb}       ${blueb}***${yellowb}                          ${reset}${bluef}\\-----?${reset}${blueb}**************************************${reset}      ${reset}${blueb}**************************${reset}Y
    46  ${purpleb}${redf}1${yellowf}234567${whitef}8${yellowf}9ABCDE${whitef}F${yellowf}GHIJKL${whitef}M${yellowf}NOPQRS${yellowf}${whitef}T${yellowf}UVWXYZ${redf}1${yellowf}234567${yellowb}${whitef}8${cyanf}9ABCDE${whitef}F${cyanf}GHIJ${cyanf}KL${whitef}M${cyanf}NOPQRS${whitef}T${cyanf}UVWXY${reset}    ${blueb}${yellowf}4567${whitef}8${yellowf}9ABCDE${whitef}F${yellowf}GHIJKL${whitef}M${yellowf}NOPQRS${whitef}T${yellowf}UVWXYZ${redf}1${yellowf}234567${whitef}8${reset}   ${purpleb}${yellowf}CDE${purpleb}${yellowf}${whitef}F${yellowf}GHIJKL${whitef}M${yellowf}NOPQRS${whitef}T${yellowf}UVWX${reset}  ${purpleb}${redf}1${yellowf}2${reset}Z
    47  EOF
    48  }

In this script, you can see "cat" command in the line 9. "cat" displays the following file. (This explain is not precise because being-too-precise
is sometimes an obstacle to understand a basic matter.)
In the UNIX rule everything is considered a file.  Then "cat" displays not only usual files (kind of text saved in a storage (ex. SSD HHD))
but also a kind of text in a memory.
In this case "cat" displays the content from the line 10 to line 46.
However "cat" doesn't display the content as it is.  "cat" interprets some key words starting with "${" and ending with "}".
These key words are not natively reserved words by UNIX(Linux).  But variables defined in a script, "changeable_capital_initializeANSI"
in the directory, "~/mos/bin/".  The developer skips an exact explanation of this definition.  Instead of it, the developer explains it simply.
There are two types in the variables (key words) in this script.  The alphabetical words belonging to one of them ends with "f" which
means foreground.  This type variables change the color of letters of the text.  There are the following eight variables in this type.

${blackf}  ${redf}  ${greenf}  ${yellowf}   ${bluef}  ${purplef}  ${cyanf}  ${whitef}

The alphabetical words belonging to another of them ends with "b" which means background.  This type variables change the color of the background.
There are the following eight in this type.

${blackb}  ${redb}  ${greenb}  ${yellowb}   ${blueb}  ${purpleb}  ${cyanb}  ${whiteb}

"${reset}" is a variable to return the colors of the both of letters and their backgronds to the default ones, black and white.

There are one more character which is not displayed.  That is "\", a special (meta) character to change other meta characters to just characters
to be displayed.  In this case "\" (from now on "r\") following its left-next "\" (from now on "l\") is changed "r\" from a meta character to a usual character.

The above magics are all what the maps in the game use.  Those sets of lines look like maps, however those are just assemblages of colored characters.
Now we are trying to make a map for a quiz about Lake Mead, then we must know which character indicates Lake Mead and which indicates Great Salt
Lake.
At first let's remove the magic to blink the characters to indicates the location of Great Salt Lake. Great Salt Lake is shown by the line 31.
"${cyanb}${gl_r}${redf}?${reset}${cyanb}${gl_r}*${reset}" in the line 31 includes the magic.  The leading part of the magic is "${gl_r}".
This magic word, "${gl_r}" has sometimes a meaning and sometimes does not have a meaning.
When ".usamap_Cu_ext1_13_blink_1" is executed, "${gl_r}" has no meaning, because it is an empty variable doing nothing.
When ".usamap_Cu_ext1_13_blink_2" is executed, "${gl_r}" has a meaning which equals to one of "${reset}".
According to this rule let's rewrite "${cyanb}${gl_r}${redf}?${reset}${cyanb}${gl_r}*${reset}".
If we rewrite it, the result is "${cyanb}${reset}${redf}?${reset}${cyanb}${reset}*${reset}".
What color do the characters, "?" and "*" have in this case?  The answer is red color "?" with white background and black color "*" with white
background.
Then let's rewrite "${cyanb}${gl_r}${redf}?${reset}${cyanb}${gl_r}*${reset}" thinking that "${gl_r}" is nothing.
The result is "${cyanb}${redf}?${reset}${cyanb}*${reset}".
What color do the characters, "?" and "*" have in this case?  The answer is red color "?" with cyan background and black color "*" with cyan
background.
To remove this magic, we must rewrite the line 31 as follows:

31      ${blueb}${redf}*${reset}${blueb}******${whitef}*${reset}${blueb}******${whitef}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${cyanb}**${reset}     ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}      ${yellowf}*${reset}   ${bluef}|${reset}  ${yellowf}*${reset}      ${yellowf}*${reset} ${bluef}${resetb3}${redf3}/${reset}    ${yellowf}*${reset}      ${yellowf}*${reset}     ${bluef}_${yellowf}*${reset}   ${bluef}/${reset}  ${yellowf}*${reset}      ${yellowf}*${reset}   ${blueb}*${reset}  ${blueb}${whitef}*${reset}${blueb}******${whitef}*${reset}${blueb}******${redf}*${reset}${blueb}*${reset}K

Then we must put a similar magic in the line 37 which includes characters to indicate the location of Lake Mead.
The following code is the result.  Please try to understand why this code works by yourself.

37      ${blueb}*****************${reset}            ${cyanb}${gl_r}${redf}?${reset}${bluef}__${reset}  ${bluef}+-/${reset}             ${bluef}/${reset}                          ${bluef}\\-------+   ${bluef}${resetb5}${redf5}_${bluef}${resetb4}${redf4}/${reset}                                ${blueb}*******************${reset}Q

This script having the code to inform users of the purpose of it as the DEMO in the line 32. Then let's remove it.  The result is as follow.

32      ${blueb}****************${reset}                                                           ${bluef}\\${redf}          ${bluef}${resetb3}${redf3}\\${reset}              ${bluef}__/ \\_/${reset}               ${blueb}*${reset}  ${blueb}****************${reset}L

Then we must also change the file name and the function name of this script.  Let's change the file name from "usamap_Cu_ext1_13_source.sh"
to "usamap_Cu_ext1_23_source.sh".  Before saving this script as "usamap_Cu_ext1_23_source.sh", let's change the line 3 ~ 5. The result is as follows:

     3  # usamap_Cu_ext1_23_source.sh - Sub script to work as a source for the slides of the animation for the Lake Mead quiz.
     4  # This script is a source to show slides for an extension quiz in the choice of Hawaii in Pacific State.
     5  # Please use this source as a new sample to create more new slides or new static maps for your own quizzes.

Before saving we must do one more task.  Let's change the line 7 as follows:

     7  ext1_23_source()

Now let's save this script.  Don't forget to change the name to "usamap_Cu_ext1_23_source.sh".
Let's return to the subject of "$j" now.  The following part of "extension1_13" is the magic to make "$j" numbers.

    10    for ((j=1; j < 3; j++)) ;do
    11      sleep 0.25; ~/mos/ext/map/.usamap_Cu_ext1_13_blink_$j; echo "";
    12    done

The above code is called "for loop".
"$" out of "$j" is a symbol to indicate "j" is a variable.
By the line 10, a command,"sleep 0.25" and a function, ".usamap_Cu_ext1_13_blink_$j" in the following line 11 are executed repeatedly (twice) because "j" must be numbers less than 3 and be increased from 1 by 1 increment.
Then in the first time, "$j" is 1.  In the second time, "$j" is 2.

Next we must also create new scripts to display an animation and a static map for the new extension quiz.
The code of one of the new scripts, ".usamap_Cu_ext1_23_blink_1" is as follows:

     1  #!/bin/bash
     2  
     3  # .usamap_Cu_ext1_23_blink_1 - Sub script to show a slide of the animation of a topographic map for a quiz named "extension1_23".
     4  
     5  . ~/mos/bin/changeable_capital_initializeANSI
     6  base_initializeANSI
     7  
     8  redf1=
     9  redf2=
    10  redf3=
    11  redf4=
    12  redf5=
    13  
    14  #gl_r=$reset
    15  
    16  . ~/mos/ext/map/usamap_Cu_ext1_23_source.sh
    17  ext1_23_source

The code of another of the new scripts, ".usamap_Cu_ext1_23_blink_2" is as follows:

     1  #!/bin/bash
     2  
     3  # .usamap_Cu_ext1_23_blink_2 - Sub script to show a slide of the animation of a topographic map for a quiz named "extension1_23".
     4  
     5  . ~/mos/bin/changeable_capital_initializeANSI
     6  base_initializeANSI
     7  
     8  redf1=
     9  redf2=
    10  redf3=
    11  redf4=
    12  redf5=
    13  
    14  gl_r=$reset
    15  
    16  . ~/mos/ext/map/usamap_Cu_ext1_23_source.sh
    17  ext1_23_source

The difference between ".usamap_Cu_ext1_23_blink_1" and ".usamap_Cu_ext1_23_blink_2" lies at the line 3 and line 14.
Specially the difference at the line 14 is important.
"#" out of "#gl_r=$reset" of ".usamap_Cu_ext1_23_blink_1" has a function to make the substitution, "gl_r=$reset" incapable.
"gl_r" becomes a variable having the same meaning as "reset" by "gl_r=$reset", however "#" changes the following code to just a comment.
"=" out of "gl_r=$reset" is a kind of function to make the left side of it to the same meaning word of the right side of it.
We must pay attention to the fact that "=" does not make the right side the left side.  Can a fake symbol, "<-" make you imagine the function?
Please forget "<-", because it is just a fake and let's go back to the original subject.
Finally we are ready to create a new extension, "extension1_23". The following code is it.

     1  #!/bin/bash
     2  
     3  # extension1_23 - Sub script of an extension quiz to ask a user about Leak Mead.
     4  # this quiz is almost the same as the lake quiz, "greatsaltlake"
     5  
     6  # function called by a function, "ext1_23_quiz" to show an animation for the Lake quiz
     7  ext1_23_blink()
     8  {
     9  for ((i=1; i < 11; i++)) ;do
    10    for ((j=1; j < 3; j++)) ;do
    11      sleep 0.25; ~/mos/ext/map/.usamap_Cu_ext1_23_blink_$j; echo "";
    12    done
    13  done
    14  }
    15  
    16  # function called by the main script, to quiz a user about Lake Mead
    17  ext1_23_quiz()
    18  {
    19  answer=
    20  count=0
    21  
    22  stage_n=$((stage_n + 1))
    23  clear
    24  ext1_23_blink
    25  ## .usamap_984_gl
    26  clear
    27  ~/mos/ext/map/.usamap_Cu_ext1_23_blink_1
    28  federal_quiz_message
    29  ~/mos/ext/quiz_of_federal1_23
    30  while [ "$answer" != "3" ] ; do
    31    read answer
    32    if [ $answer -eq 3 ] ;then
    33      clear
    34      choose_area_list
    35      .cusam_Cu$territory
    36      choose_next_gstate_list
    37      echo "$w_correct_message_h $o_gstate $w_correct_message_t"
    38      sleep 3
    39      clear
    40      .world_map
    41      if [ "$rswitch" = off ] ; then
    42        echo "$report"
    43      else
    44        cut_and_sleep "$report"
    45      fi
    46      lake="Lake-Baikal"
    47      lake2="Caspian-sea"
    48      lake3="Lake-Mead"
    49      topography $lake $lake2 $lake3
    50    else
    51      count=$((count + 1))
    52      if [ $count -gt 1 ] ; then
    53        echo "$game_over_twice"
    54        exit 4
    55      else
    56        echo -n "$wrong_message_h2 $count $wrong_message_t "
    57      fi  
    58    fi  
    59  done
    60  sleep 5
    61  }

We changed the line 3, 6, 7, 11, 17, 24, 27, 29, 30, 32, 46 and 48.
Specially the changes of the line 29, 46 and 49 are important.
The first change of the line 29 means that we must prepare a new script, "quiz_of_federal1_23" in the directory, "~/mos/ext/".
The following code is "quiz_of_federal1_23".

     1  #!/bin/bash
     2 # quiz_of_federal1_23 -  
     3  # sub sript called by extension1_23 to display a quesion for the Lake Mead quiz
     4  
     5    echo "Which of the following lakes is the one indicated by an middle-left red question mark in a cyan square mark in the map?"
     6    echo -n "1)Lake Baikal  2)Lake-Victoria  3)Lake Mead "

Did you realize that there are two ways to execute an external script?
One is that at first insert the external script by "." preceding the full path script name, then execute a function (or functions) of
the inserted script with the function name(s).
Another is that execute the external script with the full path script name.
If the external script does not have any global variable (all variable are global if these are not defined as local in the bash script rule) you can use the latter method.  While if the external script has global variables
you must the former method.

The changes of the line 46 and 48 are related to the above change.
The function, topography displays the information of the three choices of lakes provided in "quiz_of_federal1_23", Lake-Baikal, Caspian-sea
and Lake-Mead by the code of the line 49.
However a data file, ".topography" in the directory, "~/mos/data/" which a function, "topography" uses does not have a data for Lake Mead.
But we want to avoid modifying ".topography" because this modification impairs the identity of the game as an application.
Same name data files having the different contents might cause an unexpected overwriting. It means that the original data file might
overwrite your modified data file to end up losing your own data.
To solve this problem, "mos0.994" can read the additional data file, ".add_topography" in the directory, "~/mos/ext/" if it exists.
Then we must also create ".add_topography".  The content of ".add_topography" must be as follows.

Lake-Mead:              artificial lake made by damming up of Hoover Dam between Nevada and Arizona in USA (181). 640km2. 372m above sea level.

This file does not have a line, "#!/bin/bash" at the top because this is not a script but a data file.
The difference between a script and a data file is if a file has some function.
If a file must have any function, it must be a script, while if a file does not need any function it is a data file.
Now we have got all knowledge (however you must learn the grammar of bash script by yourself) to create a new quiz, "extension1_23".
Let's try to make it now!  Good luck.
inserted by FC2 system