Sketch it! - a pen platformer (+ EDITOR) v0.05
@Stage\n\nwhen [x v] key pressed\nif <[hosts v] contains (username)?> then\n    change [level # v] by (1)\n    broadcast (spawn player v)\nend\n\n@ \n\nset [tile index v] to ((((([floor v] of (([abs v] of ((y) - (180)) ) / (25)) ) - (1)) * (18)) * <(([floor v] of (([abs v] of ((y) - (180)) ) / (25)) ) - (1)) > [0]>) + ([floor v] of (([abs v] of ((-240) - (x)) ) / (25)) ))\n\n@renderer\n\ndefine draw square centered (x) (y) side length (pl) able to see? <f/t>\nset pen color to (#0000ff)\nset pen size to (5)\npen up\ngo to x: ((x) + ((pl) / (2))) y: ((y) + ((pl) / (2)))\npen down\nchange x by ((pl) * (-1))\nchange y by ((pl) * (-1))\nchange x by (pl)\nchange y by (pl)\n\nwhen flag clicked\nset [level # v] to [1]\nrender - regular mode\nshow list [save code v]\nset [code load v] to [n]\nset [time v] to [0]\nbroadcast (SETUP v)\nset [deaths v] to [0]\nbroadcast (spawn player v)\nforever\n    if <<(mode) = [PLAY]> and <(code load) = [n]>> then\n        load level code (item (LEVEL #) of [level codes v])\n    end\n    if <<(mode) = [PLAY]> and <(code load) = [y]>> then\n        load level code (_ENTERED CODE)\n    end\n    if <<(DEATHS) = [0]> and <(LEVEL #) = (length of [level codes v])>> then\n        change [☁ people who survived with 0 deaths v] by (1)\n    end\nend\n\ndefine render - regular mode\n​​log​​ (join [render triggered ] (timer))\nerase all\nset pen color to (#0000ff)\nbroadcast (draw endline v)\nset [i v] to [1]\nset [stamp y v] to [150]\nrepeat (14)\n    set [stamp x v] to [-210]\n    repeat (18)\n        if <<(item (i) of [tile grid v]) = [1]> or <(item (i) of [tile grid v]) = [E]>> then\n            draw square centered (stamp x) (stamp y) side length [25] able to see? <>\n        else\n            if <(item (i) of [tile grid v]) = [2]> then\n                draw spike centered (stamp x) (stamp y) size [25]\n            else\n                if <(item (i) of [tile grid v]) = [3]> then\n                    draw bouncy (stamp x) (stamp y)\n                else\n                    if <(item (i) of [tile grid v]) = [S]> then\n                        draw square centered (stamp x) (stamp y) side length [25] able to see? <>\n                        render sticky (stamp x) (stamp y)\n                    else\n                        if <(item (i) of [tile grid v]) = [4]> then\n                            draw coin at (stamp x) (stamp y)\n                        else\n                            if <(item (i) of [tile grid v]) = [5]> then\n                                render half LEFT sticky (stamp x) (stamp y)\n                                draw square centered (stamp x) (stamp y) side length [25] able to see? <>\n                            else\n                                if <(item (i) of [tile grid v]) = [6]> then\n                                    render half RIGHT sticky (stamp x) (stamp y)\n                                    draw square centered (stamp x) (stamp y) side length [25] able to see? <>\n                                else\n                                    if <(item (i) of [tile grid v]) = [7]> then\n                                        draw coin at (stamp x) (stamp y)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [stamp x v] by (25)\n        change [i v] by (1)\n    end\n    change [stamp y v] by (-25)\nend\n​​log​​ (join [render done] (timer))\n\ndefine load level code (code)\n​​log​​ (join [loading level code ] (timer))\ndelete all of [tile grid v]\nset [i v] to [1]\nrepeat (239)\n    add (letter (i) of (code)) to [tile grid v]\n    change [i v] by (1)\nend\n​​log​​ (join [loading level code done ] (timer))\nrender - regular mode\n\ndefine draw spike centered (x) (y) size (pl)\nset pen color to (#ff0000)\nset pen size to (5)\npen up\ngo to x: ((x) - (13)) y: ((y) - (13))\npen down\ngo to x: (x) y: (y)\ngo to x: ((x) + (13)) y: ((y) - (13))\n\ndefine draw bouncy (x) (y)\nset pen color to (#ff8800)\nset pen size to (5)\npen up\ngo to x: ((x) - ((25) / (4))) y: ((y) - (12.5))\npen down\ngo to x: (x position) y: ((y position) + (18.75))\npen up\ngo to x: ((x) + ((25) / (4))) y: ((y) - (12.5))\npen down\ngo to x: (x position) y: ((y position) + (18.75))\npen up\ngo to x: ((x) - (12.5)) y: ((y) + ((25) / (4)))\npen down\ngo to x: ((x) + (12.5)) y: ((y) + (6.75))\n\ndefine render sticky (x) (y)\nset pen color to (#ff06c9)\nset pen size to (5)\npen up\ngo to x: ((x) - (12.5)) y: ((y) + (15.5))\npen down\ngo to x: ((x) + (12.5)) y: ((y) + (15.5))\n\nwhen I receive [switch - play mode v]\nshow\n\ndefine render - editor\nerase all\nset pen color to (#0000ff)\nbroadcast (draw endline v)\nset [i v] to [1]\nset [stamp y v] to [150]\nrepeat (14)\n    set [stamp x v] to [-210]\n    repeat (18)\n        if <<(item (i) of [edit tile grid v]) = [1]> or <(item (i) of [edit tile grid v]) = [E]>> then\n            draw square (stamp x) (stamp y)\n        else\n            if <(item (i) of [edit tile grid v]) = [2]> then\n                draw spike centered (stamp x) (stamp y) size [50]\n            else\n                if <(item (i) of [edit tile grid v]) = [3]> then\n                    draw bouncy (stamp x) (stamp y)\n                else\n                    if <(item (i) of [edit tile grid v]) = [S]> then\n                        draw square (stamp x) (stamp y)\n                        render sticky (stamp x) (stamp y)\n                    else\n                        if <(item (i) of [edit tile grid v]) = [4]> then\n                            draw coin at (stamp x) (stamp y)\n                        else\n                            if <(item (i) of [edit tile grid v]) = [5]> then\n                                render half LEFT sticky (stamp x) (stamp y)\n                                draw square centered (stamp x) (stamp y) side length [25] able to see? <>\n                            else\n                                if <(item (i) of [edit tile grid v]) = [6]> then\n                                    render half RIGHT sticky (stamp x) (stamp y)\n                                    draw square centered (stamp x) (stamp y) side length [25] able to see? <>\n                                else\n                                    if <(item (i) of [edit tile grid v]) = [7]> then\n                                        draw coin at (stamp x) (stamp y)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [stamp x v] by (25)\n        change [i v] by (1)\n    end\n    change [stamp y v] by (-25)\nend\n\nwhen I receive [render - editor v]\nrender - editor\n\ndefine draw square (x) (y)\nset pen color to (#0000ff)\nset pen size to (5)\npen up\ngo to x: ((x) + ((25) / (2))) y: ((y) + ((25) / (2)))\npen down\nchange x by ((25) * (-1))\nchange y by ((25) * (-1))\nchange x by (25)\nchange y by (25)\n\nwhen [l v] key pressed\nask [Level code? \(Only ] and wait\nset [_entered code v] to (answer)\nset [code load v] to [y]\n\ndefine draw coin at (x) (y)\nset pen color to (#eeff00)\nset pen size to (10)\npen up\ngo to x: (x) y: (y)\npen down\n\ndefine render half LEFT sticky (x) (y)\nset pen color to (#ff06c9)\nset pen size to (5)\npen up\ngo to x: ((x) - (12.5)) y: ((y) + (15.5))\npen down\ngo to x: (x) y: ((y) + (15.5))\n\ndefine render half RIGHT sticky (x) (y)\nset pen color to (#ff06c9)\nset pen size to (5)\npen up\ngo to x: ((x) + (12.5)) y: ((y) + (15.5))\npen down\ngo to x: (x) y: ((y) + (15.5))\n\nwhen I receive [render v]\nchange [coins on level v] by (1)\nremove spaces\nreplace item (LEVEL #) of [level codes v] with (CODE)\n\nwhen flag clicked\nset [i6 v] to [1]\ndelete all of [level codes v]\nrepeat (length of [storage \(do not edit\) v])\n    add (item (i3) of [storage \(do not edit\) v]) to [level codes v]\n    change [i3 v] by (1)\nend\n\ndefine remove spaces\nset [i4 v] to [1]\nset [code v] to []\nrepeat (239)\n    set [code v] to (join (CODE) (item (i4) of [tile grid v]))\n    change [i4 v] by (1)\nend\n\nwhen [r v] key pressed\nreplace item (LEVEL #) of [level codes v] with (item (LEVEL #) of [storage \(do not edit\) v])\n\nwhen I receive [die v]\nreplace item (LEVEL #) of [level codes v] with (item (LEVEL #) of [storage \(do not edit\) v])\n\n@player\n\ndefine touch ground <up?>\nchange [falling v] by (1)\nrepeat until <not <touching color (#0000ff)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\ndefine walk (d) (s)\npoint in direction (d)\nchange x by (s)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching color (#0000ff)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (s))\n    change y by ((0) - (slope))\nend\n\nwhen I receive [spawn player v]\nshow\ngo to x: (-150) y: (0)\nset [speed y v] to [-1]\nset [falling v] to [12]\nforever\n    change [speed y v] by (-1)\n    change y by (speed y)\n    touch ground <(speed y) > [0]>\n    set rotation style [left-right v]\n    if  then\n        walk [-90] [-4]\n    end\n    if  then\n        walk [90] [4]\n    end\n    if <<not <touching color (#ff06c9)?>> and <<<key (up arrow v) pressed?> or > and <(falling) < [3]>>> then\n        set [speed y v] to [15]\n    end\nend\n\nwhen I receive [die v]\nchange [deaths v] by (1)\nbroadcast (spawn player v)\n\nwhen I receive [switch - play mode v]\nshow\nwait (0) seconds\ngo to x: (-150) y: (0)\n\nwhen I receive [_test edited v]\ngo to x: (-150) y: (0)\n\nwhen I receive [spawn player v]\nforever\n    if <touching color (#ff8800)?> then\n        set [speed y v] to [20]\n    end\n    if <touching color (#ff0000)?> then\n        broadcast (die v)\n    end\n    if <(x position) > [239]> then\n        if <not <(LEVEL #) = (length of [storage \(do not edit\) v])>> then\n            hide\n            go to x: (0) y: (0)\n            reset timer\n            change [level # v] by (1)\n            ​​log​​ (join [level successfully changed ] (timer))\n            if <[] = []> then\n                broadcast (load v) and wait\n            end\n            show\n            broadcast (spawn player v)\n            set [coins on level v] to [0]\n        else\n            if <(mode) = [EDITOR]> then\n                hide\n                go to x: (0) y: (0)\n                reset timer\n                change [level # v] by (1)\n                ​​log​​ (join [level successfully changed ] (timer))\n                if <[] = []> then\n                    broadcast (load v) and wait\n                end\n                show\n                broadcast (spawn player v)\n                set [coins on level v] to [0]\n            end\n        end\n    end\n    if <<<(mode) = [EDITOR]> or <(PLAY) = [EDIT]>> and <not <(mode) = [PLAY]>>> then\n        hide\n    end\n    if <(PLAY) = [TEST]> then\n        show\n    end\n    if <touching color (#eeff00)?> then\n        broadcast (coin v)\n    end\n    if <(y position) < [-175]> then\n        broadcast (die v)\n    end\n    if <key (r v) pressed?> then\n        broadcast (spawn player v)\n        wait (0.01) seconds\n    end\nend\n\nwhen flag clicked\nhide\nbroadcast (load v)\nshow\nset [coins on level v] to [0]\nforever\n    if <(speed y) < [-10]> then\n        set [speed y v] to [-10]\n    end\nend\n\nwhen I receive [coin v]\nget tile at ([x position v] of [player v]) ([y position v] of [player v])\nreplace item (tile index) of [tile grid v] with [0]\nbroadcast (RENDER v)\n\nset [level # v] to [17]\n\nwhen I receive [hide player v]\nhide\n\nwhen I receive [show player v]\nshow\n\nwhen I receive [drag-non v]\nset drag mode [not draggable v]\n\nwhen I receive [drag-on v]\nset drag mode [draggable v]\n\n@EDITOR\n\ndefine get tile at (x) (y)\nset [tile index v] to ((((([floor v] of (([abs v] of ((y) - (180)) ) / (25)) ) - (1)) * (18)) * <(([floor v] of (([abs v] of ((y) - (180)) ) / (25)) ) - (1)) > [0]>) + ([floor v] of (([abs v] of ((-240) - (x)) ) / (25)) ))\n\nwhen [space v] key pressed\nif <(mode) = [EDITOR]> then\n    set [mode v] to [PLAY]\n    broadcast (switch - play mode v)\nelse\n    broadcast (editor v)\nend\n\nwhen I receive [editor v]\nset [code load v] to [n]\nset [play v] to [EDIT]\nerase all\nset [mode v] to [EDITOR]\nset [brush v] to [1]\nhandle - setup \nforever\n    get tile at (mouse x) (mouse y)\n    handle - paint block\n    broadcast (render - editor v)\nend\n\nwhen I receive [switch - play mode v]\nwait (0) seconds\nstop [other scripts in sprite v]\n\nwhen [1 v] key pressed\nset [brush v] to [1]\n\nwhen [2 v] key pressed\nset [brush v] to [2]\n\nwhen [3 v] key pressed\nset [brush v] to [3]\n\nwhen [0 v] key pressed\nset [brush v] to [0]\n\nwhen [d v] key pressed\nif <(mode) = [EDITOR]> then\n    set [brush v] to (item (tile index) of [edit tile grid v])\nend\n\nwhen [s v] key pressed\nset [brush v] to [S]\n\ndefine handle - setup \ndelete all of [edit tile grid v]\nrepeat (234)\n    add [0] to [edit tile grid v]\nend\n\ndefine handle - paint block\nif <<mouse down?> and <(PLAY) = [EDIT]>> then\n    replace item (tile index) of [edit tile grid v] with (brush)\nend\n\nwhen [c v] key pressed\nif <(save shown) = [1]> then\n    set [save shown v] to [0]\n    show list [save code v]\nelse\n    set [save shown v] to [1]\n    hide list [save code v]\n    if <(mode) = [EDITOR]> then\n        delete all of [save code v]\n        add (EDIT TILE GRID) to [save code v]\n    end\nend\n\nwhen flag clicked\nset [save shown v] to [0]\n\nwhen [p v] key pressed\nif <(PLAY) = [EDIT]> then\n    if <(mode) = [EDITOR]> then\n        set [play v] to [TEST]\n        broadcast (_test edited v)\n    end\nelse\n    set [play v] to [EDIT]\nend\n\nwhen flag clicked\nset [mode v] to [PLAY]\nforever\n    get tile at ([x position v] of [player v]) ([y position v] of [player v])\nend\n\nwhen [5 v] key pressed\nset [brush v] to [5]\n\nwhen [6 v] key pressed\nset [brush v] to [6]\n\nwhen [e v] key pressed\nhide\nask [Edit existing level? What is the code?] and wait\nshow\nif <(length of (answer)) = [234]> then\n    EDIT EXISTING LEVEL\nend\n\ndefine EDIT EXISTING LEVEL\ndelete all of [edit tile grid v]\nset [newi v] to [0]\nrepeat (234)\n    change [newi v] by (1)\n    add (letter (NEWI) of (answer)) to [edit tile grid v]\nend\nset [newi v] to [1]\n\nwhen [7 v] key pressed\nset [brush v] to [7]\n\nwhen I receive [coin v]\nget tile at ([x position v] of [player v]) ([y position v] of [player v])\nreplace item (tile index) of [debug length v] with [0]\nbroadcast (RENDER v)\n\n@music\n\nwhen flag clicked\nforever\n    play sound [Hot Diggity Dog  v] until done\nend\n\nset [level # v] to [6]\n\n@thumbnail\n\nwhen flag clicked\nhide\n\nshow\ngo to [front v] layer\n\n@loading\n\nwhen flag clicked\nhide\n\nwhen I receive [load v]\nshow\nwait (1.5) seconds\nhide\n\nset [loading? v] to [1]\n\nset [loading? v] to [0]\n\nwhen I receive [load v]\nreset timer\nrepeat until <(timer) > [1.49999999999999999999]>\n    broadcast (HIDE PLAYER v)\nend\nbroadcast (SHOW PLAYER v)\n\n@admin controls\n\ndefine Decode (code)\ndelete (all) of [decodedcode v]\ndelete (all) of [tobedecoded v]\nset [tobedecodedcount v] to [1]\nrepeat until <(length of [tobedecoded v]) = ((length of (code)) / (2))>\n    add (join (letter (tobedecodedcount) of (code)) (letter ((tobedecodedcount) + (1)) of (code))) to [tobedecoded v]\n    change [tobedecodedcount v] by (2)\nend\nset [codecount v] to [1]\nrepeat until <(codecount) > (length of [tobedecoded v])>\n    if <(item (codecount) of [tobedecoded v]) = [31]> then\n        add [a] to [decodedcode v]\n    else\n        if <(item (codecount) of [tobedecoded v]) = [32]> then\n            add [b] to [decodedcode v]\n        else\n            if <(item (codecount) of [tobedecoded v]) = [33]> then\n                add [c] to [decodedcode v]\n            else\n                if <(item (codecount) of [tobedecoded v]) = [34]> then\n                    add [d] to [decodedcode v]\n                else\n                    if <(item (codecount) of [tobedecoded v]) = [35]> then\n                        add [e] to [decodedcode v]\n                    else\n                        if <(item (codecount) of [tobedecoded v]) = [36]> then\n                            add [f] to [decodedcode v]\n                        else\n                            if <(item (codecount) of [tobedecoded v]) = [37]> then\n                                add [g] to [decodedcode v]\n                            else\n                                if <(item (codecount) of [tobedecoded v]) = [38]> then\n                                    add [h] to [decodedcode v]\n                                else\n                                    if <(item (codecount) of [tobedecoded v]) = [39]> then\n                                        add [i] to [decodedcode v]\n                                    else\n                                        if <(item (codecount) of [tobedecoded v]) = [10]> then\n                                            add [j] to [decodedcode v]\n                                        else\n                                            if <(item (codecount) of [tobedecoded v]) = [11]> then\n                                                add [k] to [decodedcode v]\n                                            else\n                                                if <(item (codecount) of [tobedecoded v]) = [12]> then\n                                                    add [l] to [decodedcode v]\n                                                else\n                                                    if <(item (codecount) of [tobedecoded v]) = [13]> then\n                                                        add [m] to [decodedcode v]\n                                                    else\n                                                        if <(item (codecount) of [tobedecoded v]) = [14]> then\n                                                            add [n] to [decodedcode v]\n                                                        else\n                                                            if <(item (codecount) of [tobedecoded v]) = [15]> then\n                                                                add [o] to [decodedcode v]\n                                                            else\n                                                                if <(item (codecount) of [tobedecoded v]) = [16]> then\n                                                                    add [p] to [decodedcode v]\n                                                                else\n                                                                    if <(item (codecount) of [tobedecoded v]) = [17]> then\n                                                                        add [q] to [decodedcode v]\n                                                                    else\n                                                                        if <(item (codecount) of [tobedecoded v]) = [18]> then\n                                                                            add [r] to [decodedcode v]\n                                                                        else\n                                                                            if <(item (codecount) of [tobedecoded v]) = [19]> then\n                                                                                add [s] to [decodedcode v]\n                                                                            else\n                                                                                if <(item (codecount) of [tobedecoded v]) = [20]> then\n                                                                                    add [t] to [decodedcode v]\n                                                                                else\n                                                                                    if <(item (codecount) of [tobedecoded v]) = [21]> then\n                                                                                        add [u] to [decodedcode v]\n                                                                                    else\n                                                                                        if <(item (codecount) of [tobedecoded v]) = [22]> then\n                                                                                            add [v] to [decodedcode v]\n                                                                                        else\n                                                                                            if <(item (codecount) of [tobedecoded v]) = [23]> then\n                                                                                                add [w] to [decodedcode v]\n                                                                                            else\n                                                                                                if <(item (codecount) of [tobedecoded v]) = [24]> then\n                                                                                                    add [x] to [decodedcode v]\n                                                                                                else\n                                                                                                    if <(item (codecount) of [tobedecoded v]) = [25]> then\n                                                                                                        add [y] to [decodedcode v]\n                                                                                                    else\n                                                                                                        if <(item (codecount) of [tobedecoded v]) = [26]> then\n                                                                                                            add [z] to [decodedcode v]\n                                                                                                        else\n                                                                                                            if <(item (codecount) of [tobedecoded v]) = [40]> then\n                                                                                                                add [:] to [decodedcode v]\n                                                                                                            else\n                                                                                                                if <(item (codecount) of [tobedecoded v]) = [41]> then\n                                                                                                                    add [.] to [decodedcode v]\n                                                                                                                else\n                                                                                                                    if <(item (codecount) of [tobedecoded v]) = [42]> then\n                                                                                                                        add [!] to [decodedcode v]\n                                                                                                                    else\n                                                                                                                        if <(item (codecount) of [tobedecoded v]) = [43]> then\n                                                                                                                            add [?] to [decodedcode v]\n                                                                                                                        else\n                                                                                                                            if <(item (codecount) of [tobedecoded v]) = [51]> then\n                                                                                                                                add [1] to [decodedcode v]\n                                                                                                                            else\n                                                                                                                                if <(item (codecount) of [tobedecoded v]) = [52]> then\n                                                                                                                                    add [2] to [decodedcode v]\n                                                                                                                                else\n                                                                                                                                    if <(item (codecount) of [tobedecoded v]) = [53]> then\n                                                                                                                                        add [3] to [decodedcode v]\n                                                                                                                                    else\n                                                                                                                                        if <(item (codecount) of [tobedecoded v]) = [54]> then\n                                                                                                                                            add [4] to [decodedcode v]\n                                                                                                                                        else\n                                                                                                                                            if <(item (codecount) of [tobedecoded v]) = [55]> then\n                                                                                                                                                add [5] to [decodedcode v]\n                                                                                                                                            else\n                                                                                                                                                if <(item (codecount) of [tobedecoded v]) = [56]> then\n                                                                                                                                                    add [6] to [decodedcode v]\n                                                                                                                                                else\n                                                                                                                                                    if <(item (codecount) of [tobedecoded v]) = [57]> then\n                                                                                                                                                        add [7] to [decodedcode v]\n                                                                                                                                                    else\n                                                                                                                                                        if <(item (codecount) of [tobedecoded v]) = [58]> then\n                                                                                                                                                            add [8] to [decodedcode v]\n                                                                                                                                                        else\n                                                                                                                                                            if <(item (codecount) of [tobedecoded v]) = [59]> then\n                                                                                                                                                                add [9] to [decodedcode v]\n                                                                                                                                                            else\n                                                                                                                                                                if <(item (codecount) of [tobedecoded v]) = [60]> then\n                                                                                                                                                                    add [0] to [decodedcode v]\n                                                                                                                                                                else\n                                                                                                                                                                    if <(item (codecount) of [tobedecoded v]) = [44]> then\n                                                                                                                                                                        add [_] to [decodedcode v]\n                                                                                                                                                                    else\n                                                                                                                                                                        if <(item (codecount) of [tobedecoded v]) = [00]> then\n                                                                                                                                                                            add [ ] to [decodedcode v]\n                                                                                                                                                                        end\n                                                                                                                                                                    end\n                                                                                                                                                                end\n                                                                                                                                                            end\n                                                                                                                                                        end\n                                                                                                                                                    end\n                                                                                                                                                end\n                                                                                                                                            end\n                                                                                                                                        end\n                                                                                                                                    end\n                                                                                                                                end\n                                                                                                                            end\n                                                                                                                        end\n                                                                                                                    end\n                                                                                                                end\n                                                                                                            end\n                                                                                                        end\n                                                                                                    end\n                                                                                                end\n                                                                                            end\n                                                                                        end\n                                                                                    end\n                                                                                end\n                                                                            end\n                                                                        end\n                                                                    end\n                                                                end\n                                                            end\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [codecount v] by (1)\nend\nset [fulldecoded v] to (item (1) of [decodedcode v])\nset [codeadd v] to [2]\nrepeat ((length of [decodedcode v]) - (1))\n    set [fulldecoded v] to (join (fulldecoded) (item (codeadd) of [decodedcode v]))\n    change [codeadd v] by (1)\nend\n\ndefine Encode (words)\ndelete (all) of [encodedtext v]\nset [wordcount v] to [1]\nrepeat until <(wordcount) > (length of (words))>\n    if <(letter (wordcount) of (words)) = [a]> then\n        add [31] to [encodedtext v]\n    else\n        if <(letter (wordcount) of (words)) = [b]> then\n            add [32] to [encodedtext v]\n        else\n            if <(letter (wordcount) of (words)) = [c]> then\n                add [33] to [encodedtext v]\n            else\n                if <(letter (wordcount) of (words)) = [d]> then\n                    add [34] to [encodedtext v]\n                else\n                    if <(letter (wordcount) of (words)) = [e]> then\n                        add [35] to [encodedtext v]\n                    else\n                        if <(letter (wordcount) of (words)) = [f]> then\n                            add [36] to [encodedtext v]\n                        else\n                            if <(letter (wordcount) of (words)) = [g]> then\n                                add [37] to [encodedtext v]\n                            else\n                                if <(letter (wordcount) of (words)) = [h]> then\n                                    add [38] to [encodedtext v]\n                                else\n                                    if <(letter (wordcount) of (words)) = [i]> then\n                                        add [39] to [encodedtext v]\n                                    else\n                                        if <(letter (wordcount) of (words)) = [j]> then\n                                            add [10] to [encodedtext v]\n                                        else\n                                            if <(letter (wordcount) of (words)) = [k]> then\n                                                add [11] to [encodedtext v]\n                                            else\n                                                if <(letter (wordcount) of (words)) = [l]> then\n                                                    add [12] to [encodedtext v]\n                                                else\n                                                    if <(letter (wordcount) of (words)) = [m]> then\n                                                        add [13] to [encodedtext v]\n                                                    else\n                                                        if <(letter (wordcount) of (words)) = [n]> then\n                                                            add [14] to [encodedtext v]\n                                                        else\n                                                            if <(letter (wordcount) of (words)) = [o]> then\n                                                                add [15] to [encodedtext v]\n                                                            else\n                                                                if <(letter (wordcount) of (words)) = [p]> then\n                                                                    add [16] to [encodedtext v]\n                                                                else\n                                                                    if <(letter (wordcount) of (words)) = [q]> then\n                                                                        add [17] to [encodedtext v]\n                                                                    else\n                                                                        if <(letter (wordcount) of (words)) = [r]> then\n                                                                            add [18] to [encodedtext v]\n                                                                        else\n                                                                            if <(letter (wordcount) of (words)) = [s]> then\n                                                                                add [19] to [encodedtext v]\n                                                                            else\n                                                                                if <(letter (wordcount) of (words)) = [t]> then\n                                                                                    add [20] to [encodedtext v]\n                                                                                else\n                                                                                    if <(letter (wordcount) of (words)) = [u]> then\n                                                                                        add [21] to [encodedtext v]\n                                                                                    else\n                                                                                        if <(letter (wordcount) of (words)) = [v]> then\n                                                                                            add [22] to [encodedtext v]\n                                                                                        else\n                                                                                            if <(letter (wordcount) of (words)) = [w]> then\n                                                                                                add [23] to [encodedtext v]\n                                                                                            else\n                                                                                                if <(letter (wordcount) of (words)) = [x]> then\n                                                                                                    add [24] to [encodedtext v]\n                                                                                                else\n                                                                                                    if <(letter (wordcount) of (words)) = [y]> then\n                                                                                                        add [25] to [encodedtext v]\n                                                                                                    else\n                                                                                                        if <(letter (wordcount) of (words)) = [z]> then\n                                                                                                            add [26] to [encodedtext v]\n                                                                                                        else\n                                                                                                            if <(letter (wordcount) of (words)) = [:]> then\n                                                                                                                add [40] to [encodedtext v]\n                                                                                                            else\n                                                                                                                if <(letter (wordcount) of (words)) = [.]> then\n                                                                                                                    add [41] to [encodedtext v]\n                                                                                                                else\n                                                                                                                    if <(letter (wordcount) of (words)) = [!]> then\n                                                                                                                        add [42] to [encodedtext v]\n                                                                                                                    else\n                                                                                                                        if <(letter (wordcount) of (words)) = [?]> then\n                                                                                                                            add [43] to [encodedtext v]\n                                                                                                                        else\n                                                                                                                            if <(letter (wordcount) of (words)) = [1]> then\n                                                                                                                                add [51] to [encodedtext v]\n                                                                                                                            else\n                                                                                                                                if <(letter (wordcount) of (words)) = [2]> then\n                                                                                                                                    add [52] to [encodedtext v]\n                                                                                                                                else\n                                                                                                                                    if <(letter (wordcount) of (words)) = [3]> then\n                                                                                                                                        add [53] to [encodedtext v]\n                                                                                                                                    else\n                                                                                                                                        if <(letter (wordcount) of (words)) = [4]> then\n                                                                                                                                            add [54] to [encodedtext v]\n                                                                                                                                        else\n                                                                                                                                            if <(letter (wordcount) of (words)) = [5]> then\n                                                                                                                                                add [55] to [encodedtext v]\n                                                                                                                                            else\n                                                                                                                                                if <(letter (wordcount) of (words)) = [6]> then\n                                                                                                                                                    add [56] to [encodedtext v]\n                                                                                                                                                else\n                                                                                                                                                    if <(letter (wordcount) of (words)) = [7]> then\n                                                                                                                                                        add [57] to [encodedtext v]\n                                                                                                                                                    else\n                                                                                                                                                        if <(letter (wordcount) of (words)) = [8]> then\n                                                                                                                                                            add [58] to [encodedtext v]\n                                                                                                                                                        else\n                                                                                                                                                            if <(letter (wordcount) of (words)) = [9]> then\n                                                                                                                                                                add [59] to [encodedtext v]\n                                                                                                                                                            else\n                                                                                                                                                                if <(letter (wordcount) of (words)) = [0]> then\n                                                                                                                                                                    add [60] to [encodedtext v]\n                                                                                                                                                                else\n                                                                                                                                                                    if <(letter (wordcount) of (words)) = [_]> then\n                                                                                                                                                                        add [44] to [encodedtext v]\n                                                                                                                                                                    else\n                                                                                                                                                                        if <(letter (wordcount) of (words)) = [ ]> then\n                                                                                                                                                                            add [00] to [encodedtext v]\n                                                                                                                                                                        end\n                                                                                                                                                                    end\n                                                                                                                                                                end\n                                                                                                                                                            end\n                                                                                                                                                        end\n                                                                                                                                                    end\n                                                                                                                                                end\n                                                                                                                                            end\n                                                                                                                                        end\n                                                                                                                                    end\n                                                                                                                                end\n                                                                                                                            end\n                                                                                                                        end\n                                                                                                                    end\n                                                                                                                end\n                                                                                                            end\n                                                                                                        end\n                                                                                                    end\n                                                                                                end\n                                                                                            end\n                                                                                        end\n                                                                                    end\n                                                                                end\n                                                                            end\n                                                                        end\n                                                                    end\n                                                                end\n                                                            end\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [wordcount v] by (1)\nend\nset [fullencoded v] to (item (1) of [encodedtext v])\nset [wordadd v] to [2]\nrepeat ((length of [encodedtext v]) - (1))\n    set [fullencoded v] to (join (fullencoded) (item (wordadd) of [encodedtext v]))\n    change [wordadd v] by (1)\nend\n\nwhen flag clicked\nhide variable [loc decoded last viewer v]\nhide variable [brush v]\nhide variable [code v]\nhide variable [mode v]\nhide variable [coins on level v]\nhide variable [deaths v]\nhide variable [level # v]\nset [toggle v] to [1]\nset [toggle2 v] to [1]\nbroadcast (DRAG-NON v)\nif <[admins lvl 2 v] contains (username)?> then\n    forever\n        if <<key (j v) pressed?> and <not <(LEVEL #) = (length of [level codes v])>>> then\n            if <[admins lvl 2 v] contains (username)?> then\n                wait until <not <key (j v) pressed?>>\n                change [level # v] by (1)\n            end\n        end\n        if <<key (h v) pressed?> and <not <(LEVEL #) = [1]>>> then\n            if <[admins lvl 2 v] contains (username)?> then\n                wait until <not <key (h v) pressed?>>\n                change [level # v] by (-1)\n            end\n        end\n        if <key (y v) pressed?> then\n            if <[admins lvl 1 v] contains (username)?> then\n                wait until <not <key (y v) pressed?>>\n                change [toggle v] by (1)\n                show/hide vars <((toggle) mod (2)) = [0]>\n            end\n        end\n        if <key (t v) pressed?> then\n            if <[admins lvl 1 v] contains (username)?> then\n                wait until <not <key (t v) pressed?>>\n                change [toggle2 v] by (1)\n                if <((toggle2) mod (2)) = [0]> then\n                    show variable [loc decoded last viewer v]\n                else\n                    hide variable [loc decoded last viewer v]\n                end\n            end\n        end\n        if <not <[admins lvl 1 v] contains (username)?>> then\n            broadcast (DRAG-NON v)\n        end\n        if <[admins lvl 1 v] contains (username)?> then\n            broadcast (DRAG-ON v)\n        end\n    end\nend\n\ndefine show/hide vars <show?>\nif <show?> then\n    show variable [brush v]\n    show variable [code v]\n    show variable [coins on level v]\n    show variable [deaths v]\n    show variable [level # v]\n    show variable [mode v]\nelse\n    hide variable [brush v]\n    hide variable [code v]\n    hide variable [coins on level v]\n    hide variable [deaths v]\n    hide variable [level # v]\n    hide variable [mode v]\nend\n\nwhen flag clicked\nEncode (username)\nset [☁ last viewer v] to (fullencoded)\n\nwhen flag clicked\nforever\n    Decode (☁ Last Viewer)\n    set [loc decoded last viewer v] to (fulldecoded)\nend\n\nwhen flag clicked\nforever\n    hide variable [notice v]\n    wait until <key (u v) pressed?>\n    wait until <not <key (u v) pressed?>>\n    show variable [notice v]\n    if <[owners v] contains (username)?> then\n        set [notice v] to [Hello! You are considered a lead manager of this game. You have max permissions, see the admin section of the instructions for info \(you have all permissions listed\). \(Press \[U\] to toggle this dialog\)]\n    else\n        if <[admins lvl 1 v] contains (username)?> then\n            set [notice v] to [Hello! You are considered a Level 1 Admin \(highest admin level, only below manager\) of this game. You don't have max permissions, still more than a normal users, see section in instructions marked "A1+" or "A2+" for your permissions. \(Press \[U\] to toggle this dialog\)]\n        else\n            if <[admins lvl 2 v] contains (username)?> then\n                set [notice v] to [Hello! You are considered a Level 2 Admin \(lowest admin level\) of this game. You have minimum permissions, but still more than a normal users, see section in instructions marked "A2+" for your permissions. \(Press \[U\] to toggle this dialog\)]\n            else\n                hide variable [notice v]\n            end\n        end\n    end\n    wait until <key (u v) pressed?>\n    hide variable [notice v]\nend\n\n