Messages in hieroglyphics

Again, creating messages in code- this time in Egyptian hieroglyphs.

The 'look-up' of the graphics symbols is used. Can you read the name/message and the 'cartouche'??

You'll need these images saved to run the code... - -


Code


    '   ******************************************************
    '   **                                                  **
    '   **      Hieroglyph messages-   hieroglyphs3b.bas    **
    '   **                                                  **
    '   **      tenochtitlanuk   Oct 30 2020                **
    '   **                                                  **
    '   ******************************************************


    nomainwin

    WindowWidth  =1290
    WindowHeight = 460

    textbox    #w.tb1, 930, 260, 240,  30

    graphicbox  #w.g0,  15,   5, 230, 305
    graphicbox  #w.g1, 255,   5, 650, 308
    graphicbox  #w.g2,   5, 330,1200,  70

    button      #w.b1, "New Text",     [newText], LR,  50, 156, 74, 72
    button      #w.b2, "Save graphic", [saveGr],  LR,  50,  78, 74, 72

    statictext  #w.st1, "", 930,  20, 380, 160


    open "Hieroglyph writer" for window as #w

    #w "trapclose quit"

    CR$ =chr$( 10)
    #w.st1 "You can find a lot about Egyptian hieroglyphs on Wikipedia" +CR$ +CR$ +_
              "I am using here a simplified phonetic version"           +CR$ +CR$ +_
              "'New Text' asks for new word or message."                +CR$ +CR$ +_
              "'Save graphic' saves the message as a BMP"

    #w.st1 "!font 12"
    #w.tb1 "!font 10"
    #w.tb1 "New source here. a...z and space only."

    loadbmp "scr", "view.bmp"
    #w.g0 "down ; drawbmp scr 1 1 ; flush"

    loadbmp "scr", "hieroglyphs7b.bmp"
    #w.g1 "down ; drawbmp scr 1 1 ; flush"

    #w.g2 "down ; fill 180 180 80 ; flush"

    for x =0 to 5
        for y =0 to 4
            xScr =66 +x *107
            yScr = 7 +y * 60
            #w.g1 "getbmp scr" +right$( "00" +str$( x +6 *y), 2) +" "; xScr; " "; yScr; " 50 50"
        next y
    next x

    loadbmp "scr", "cartouche.bmp"

    #w.g1 "down ; drawbmp scr 1 1 ; flush"

    letter$ ="abcde fghijklmnopqrstuvwxyz"
    source$ ="alexandros the great"

    gosub [firstRun]

    wait

  [newText]
    #w.tb1 "!contents? source$"
    source$     =lower$( source$)
    for l =1 to len( source$)
        g$ =mid$( source$, l, 1)
        if instr( "abcdefghijklmnopqrstuvwxyz ", g$) =0 then
            #w.tb1 "Invalid input"
            timer 4000, [k]
            wait
            [k]
            timer 0
            #w.tb1 ""
            exit for
        end if
    next l

  [firstRun]
    #w.g2 "fill 180 180 80"
    for j =1 to len( source$)
        p       =instr( letter$, mid$( source$, j, 1))
        n$      =right$( "00" +str$( p -1), 2)
        #w.g2 "drawbmp scr" +n$ +" " +str$( 54 *j +2) +" 10"
    next j

    #w.g2 "flush"

    wait

  [saveGr]
    #w.g2 "getbmp scr 1 1 1200 70"
    filedialog "Filename", "*.bmp", fn$
    bmpsave "scr", fn$ +".bmp"
    wait

    sub quit h$
        close #w
        end
    end sub