Multiplayer Platformer Engine 2.6

Instructions: --- Multiplayer Engine ---\nChanging my Multiplayer Engine to work well with platformers.\nIt can have up to 8 players at a time.\n\n--- instructions ---\n(Up Arrow) to jump.\n(Left Arrow) to go left.\n(Right Arrow) to go right.\n(R Key) to spectate.\n(T key) to see what you can chat\n(1 through 5) to chat\n\n\n\nAll code and art created by me, @SirBuildsALot

@Stage\n\nwhen flag clicked\nforever\n    Time\n    set [brightness v] effect to (((Cam_Y) / (100)) - (day))\nend\n\ndefine Time\nset [day v] to (((current [minute v]) + ((current [hour v]) * (60))) - (1130))\nif <(day) < [-729]> then\n    set [day v] to [80]\nend\nif <(day) < [-649]> then\n    set [day v] to [80]\n    change [day v] by ((((current [minute v]) + ((current [hour v]) * (60))) - (400)) * (-1))\nend\nif <(day) < [0]> then\n    set [day v] to [0]\nend\nset [day v] to (([abs v] of (day) ) * (1))\nif <[80] < (day)> then\n    set [day v] to [80]\nend\n\n@Settings\n\nset [start with all players v] to [false]\n\nset [start with all players v] to [true]\n\nset [download could data time v] to [2.5]\n\nset [max number of players v] to [8]\n\n@players\n\ndefine Change Player x by (sx)\n\nchange [playerx v] by (speed)\nPosition\nif <touching (hitbox v)?> then\n    repeat (12)\n        change [playery v] by (1)\n        Position\n        if <not <touching (hitbox v)?>> then\n            stop [this script v]\n        end\n    end\n    change [playery v] by (-12)\n    repeat until <not <touching (hitbox v)?>>\n        if <(speed) > [0]> then\n            change [playerx v] by (-1)\n        else\n            change [playerx v] by (1)\n        end\n        Position\n    end\nend\n\nif <key (up arrow v) pressed?> then\n    change y by (2)\n    if <touching (hitbox v)?> then\n        set [speed v] to [0]\n    else\n        set [speed v] to (((sx) / ([abs v] of (sx) )) * (-18))\n        set [gravity v] to [15]\n    end\nelse\n    set [speed v] to [0]\nend\n\nset [in air v] to [0]\n\ndefine Create Players\nset [player? v] to [1]\nrepeat ((Max Number of Players) - (1))\n    create clone of (_myself_ v)\n    change [player? v] by (1)\nend\n\nwhen I receive [startplayers v]\nset [talk v] to []\nset [color v] effect to (((player?) * (30)) - (30))\nset [ghost v] effect to (100)\nshow\n\n    go to [back v] layer\n    go [forward v] (18) layers\n    Tic\n    broadcast (tic v)\n    Position\n    Player (player?) _Pos\nend\n\ndefine cloudUpload # (number)\nkeysPressed <key (up arrow v) pressed?> <key (down arrow v) pressed?> <key (left arrow v) pressed?> <key (right arrow v) pressed?>\nEncode (round (playerX)) reset? [true]\nEncode (round (playerY)) reset? [false]\nEncode (round (direction)) reset? [false]\nEncode (Costume #) reset? [false]\nEncode (round (slope)) reset? [false]\nEncode (round (speed)) reset? [false]\nEncode (round (Gravity)) reset? [false]\nEncode (jumpKey) reset? [false]\nEncode (IsOnGround?) reset? [false]\nEncode (username) reset? [false]\nEncode (talk) reset? [false]\nset [@player data upload v] to (join (Encoded) (keysPressed))\nSync Cloud Data\nBegin Encode Of Player_ (number)\nusername upload (number)\n\ndefine Set player_ (#) to (value)\nif <(#) = [1]> then\n    set [☁ player_1 v] to (value)\nelse\n    if <(#) = [2]> then\n        set [☁ player_2 v] to (value)\n    else\n        if <(#) = [3]> then\n            set [☁ player_3 v] to (value)\n        else\n            if <(#) = [4]> then\n                set [☁ player_4 v] to (value)\n            else\n                if <(#) = [5]> then\n                    set [☁ player_5 v] to (value)\n                else\n                    if <(#) = [6]> then\n                        set [☁ player_6 v] to (value)\n                    else\n                        if <(#) = [7]> then\n                            set [☁ player_7 v] to (value)\n                        else\n                            set [☁ player_8 v] to (value)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine username upload (number)\nreplace item (number) of [username v] with (item (10) of [value v])\n\ndefine getCloudData (#)\nif <(#) = [1]> then\n    set [@clouddata v] to (☁ player_1)\nelse\n    if <(#) = [2]> then\n        set [@clouddata v] to (☁ player_2)\n    else\n        if <(#) = [3]> then\n            set [@clouddata v] to (☁ player_3)\n        else\n            if <(#) = [4]> then\n                set [@clouddata v] to (☁ player_4)\n            else\n                if <(#) = [5]> then\n                    set [@clouddata v] to (☁ player_5)\n                else\n                    if <(#) = [6]> then\n                        set [@clouddata v] to (☁ player_6)\n                    else\n                        if <(#) = [7]> then\n                            set [@clouddata v] to (☁ player_7)\n                        else\n                            set [@clouddata v] to (☁ player_8)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Online (#) ?\nset [@isonline? v] to (item (#) of [isonline v])\n\nwhen I start as a clone\nhide\n\ndefine Player (#) _Pos\nset [encoded v] to []\nEncode (x position) reset? [true]\nEncode (y position) reset? [false]\nreplace item (#) of [player_pos v] with (Encoded)\n\ndefine Movement\npoint in direction (90)\nset [costume # v] to [2]\nif <<key (up arrow v) pressed?> and <(IsOnGround?) = [true]>> then\n    if <<(jumpKey) = [0]> and <(Gravity) < [4]>> then\n        set [jumpkey v] to [1]\n        set [gravity v] to ((Zoom) * (-0.25))\n    end\nelse\n    set [jumpkey v] to [0]\nend\nif <key (left arrow v) pressed?> then\n    if <[-10] < (speed)> then\n        change [speed v] by (-2)\n    end\n    Walk (speed)\nelse\n    if <key (right arrow v) pressed?> then\n        if <(speed) < [10]> then\n            change [speed v] by (2)\n        end\n        Walk (speed)\n    else\n        if <(IsOnGround?) = [true]> then\n            if <[2] < (speed)> then\n                change [speed v] by (-2)\n            else\n                if <(speed) < [-2]> then\n                    change [speed v] by (2)\n                else\n                    set [speed v] to [0]\n                end\n            end\n        else\n            if <[2] < (speed)> then\n                change [speed v] by (-0.5)\n            else\n                if <(speed) < [-2]> then\n                    change [speed v] by (0.5)\n                else\n                    set [speed v] to [0]\n                end\n            end\n        end\n        Walk (speed)\n    end\nend\nGravity <(Gravity) < [0]>\nif <key (any v) pressed?> then\n    switch costume to (Costume #)\nelse\n    switch costume to (neutral v)\nend\nset [cam_x v] to (playerX)\nchange [cam_y v] by (round (((playerY) - (Cam_Y)) / (6)))\nif <((playerY) - (Cam_Y)) < [-100]> then\n    set [cam_y v] to ((playerY) + (100))\nend\nif <(Cam_Y) < [-800]> then\n    set [cam_y v] to [0]\n    if <(playerY) < [-1000]> then\n        set [playerx v] to [0]\n        set [playery v] to [0]\n    end\nend\n\ndefine keysPressed <up> <down> <left> <right>\nset [keyspressed v] to [00]\nif <up> then\n    set [keyspressed v] to (join (keysPressed) [1])\nelse\n    set [keyspressed v] to (join (keysPressed) [0])\nend\nif <down> then\n    set [keyspressed v] to (join (keysPressed) [1])\nelse\n    set [keyspressed v] to (join (keysPressed) [0])\nend\nif <left> then\n    set [keyspressed v] to (join (keysPressed) [1])\nelse\n    set [keyspressed v] to (join (keysPressed) [0])\nend\nif <right> then\n    set [keyspressed v] to (join (keysPressed) [1])\nelse\n    set [keyspressed v] to (join (keysPressed) [0])\nend\n\ndefine Begin Encode Of Player_ (#)\nif <(#) = [1]> then\n    Decode (☁ player_1)\nelse\n    if <(#) = [2]> then\n        Decode (☁ player_2)\n    else\n        if <(#) = [3]> then\n            Decode (☁ player_3)\n        else\n            if <(#) = [4]> then\n                Decode (☁ player_4)\n            else\n                if <(#) = [5]> then\n                    Decode (☁ player_5)\n                else\n                    if <(#) = [6]> then\n                        Decode (☁ player_6)\n                    else\n                        if <(#) = [7]> then\n                            Decode (☁ player_7)\n                        else\n                            Decode (☁ player_8)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine online?\nchange [player_online v] by (1)\nif <(player_online) < [10]> then\n    set [player_online v] to (join [0] (player_online))\nend\nif <(player_online) = [100]> then\n    set [player_online v] to [00]\nend\n\ndefine cloud movement for player (#)\ngetCloudData (#)\nset [keyspressed v] to (join (letter ((length of (@CloudData)) - (3)) of (@CloudData)) (join (letter ((length of (@CloudData)) - (2)) of (@CloudData)) (join (letter ((length of (@CloudData)) - (1)) of (@CloudData)) (letter (length of (@CloudData)) of (@CloudData)))))\nset [costume # v] to [2]\nif <<(letter (1) of (keysPressed)) = [1]> and <(IsOnGround?) = [true]>> then\n    if <<(jumpKey) = [0]> and <(Gravity) < [4]>> then\n        set [jumpkey v] to [1]\n        set [gravity v] to ((Zoom) * (-0.25))\n    end\nelse\n    set [jumpkey v] to [0]\nend\nif <(letter (3) of (keysPressed)) = [1]> then\n    if <[-10] < (speed)> then\n        change [speed v] by (-2)\n    end\n    Walk (speed)\nelse\n    if <(letter (4) of (keysPressed)) = [1]> then\n        if <(speed) < [10]> then\n            change [speed v] by (2)\n        end\n        Walk (speed)\n    else\n        if <(IsOnGround?) = [true]> then\n            if <[2] < (speed)> then\n                change [speed v] by (-2)\n            else\n                if <(speed) < [-2]> then\n                    change [speed v] by (2)\n                else\n                    set [speed v] to [0]\n                end\n            end\n        else\n            if <[2] < (speed)> then\n                change [speed v] by (-0.5)\n            else\n                if <(speed) < [-2]> then\n                    change [speed v] by (0.5)\n                else\n                    set [speed v] to [0]\n                end\n            end\n        end\n        Walk (speed)\n    end\nend\nGravity <(Gravity) < [0]>\nif <<(letter (4) of (keysPressed)) = [1]> or <<(letter (3) of (keysPressed)) = [1]> or <<(letter (2) of (keysPressed)) = [1]> or <(letter (1) of (keysPressed)) = [1]>>>> then\n    switch costume to (Costume #)\nelse\n    switch costume to (neutral v)\nend\n\ndefine Encode (value) reset? (bool)\nif <(bool) = [true]> then\n    set [encoded v] to []\nend\nset [# v] to [0]\nrepeat (length of (value))\n    change [# v] by (1)\n    if <(letter (#) of (value)) = [ ]> then\n        set [encoded v] to (join (Encoded) [78])\n    else\n        set [encoded v] to (join (Encoded) (item # of (letter (#) of (value)) in [code v]))\n    end\nend\nset [encoded v] to (join (Encoded) [00])\n\ndefine Decode (value)\ndelete all of [value v]\nset [value v] to []\nset [# v] to [2]\nrepeat (((length of (value)) / (2)) - (4))\n    change [# v] by (2)\n    if <(join (letter ((#) - (1)) of (value)) (letter (#) of (value))) < [10]> then\n        add (value) to [value v]\n        set [value v] to []\n    end\n    if <(join (letter ((#) - (1)) of (value)) (letter (#) of (value))) = [78]> then\n        set [value v] to (join (value) [ ])\n    else\n        set [value v] to (join (value) (item (join (letter ((#) - (1)) of (value)) (letter (#) of (value))) of [code v]))\n    end\nend\n\ndefine Setup Code\ndelete all of [code v]\nset [code v] to [abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*\(\)_+-=|}{":?><,./;'\[\]\`~]\nset [# v] to [0]\nrepeat (9)\n    add [] to [code v]\nend\nrepeat (length of (Code))\n    change [# v] by (1)\n    add (letter (#) of (Code)) to [code v]\nend\ndelete all of [letters v]\nset [code v] to [abcdefghijklmnopqrstuvwxyz]\nset [# v] to [0]\nrepeat (length of (Code))\n    change [# v] by (1)\n    add (letter (#) of (Code)) to [letters v]\nend\ndelete all of [username v]\nrepeat (Max Number of Players)\n    add [] to [username v]\nend\ndelete all of [isonline v]\nrepeat (Max Number of Players)\n    add [offline] to [isonline v]\nend\ndelete all of [chat v]\nadd [Hello] to [chat v]\nadd [Bye] to [chat v]\nadd [Follow Me] to [chat v]\nadd [Nice] to [chat v]\nadd [Yay] to [chat v]\n\ndefine Gravity <up?>\nif <(Gravity) < ((Zoom) * (0.25))> then\n    change [gravity v] by ((Zoom) * (0.02))\nend\nchange [playery v] by ((Gravity) * (-1))\nPosition\nif <touching (hitbox v)?> then\n    if <[6] < (Gravity)> then\n        Create grass particle at (playerX) ((playerY) + (4))\n    end\n    set [isonground? v] to [true]\nelse\n    set [isonground? v] to [false]\nend\nrepeat until <not <touching (hitbox v)?>>\n    if <up?> then\n        change [playery v] by ((Zoom) * (-0.02))\n        Position\n        if <touching (hitbox v)?> then\n            set [gravity v] to [0]\n        end\n    else\n        change [playery v] by ((Zoom) * (0.02))\n        Position\n        set [gravity v] to [0]\n    end\nend\n\ndefine Walk (speed)\nset [x check v] to [0]\nrepeat until <<(x check) = [10]> or <touching (hitbox v)?>>\n    change [playerx v] by ((((speed) * (Zoom)) * (0.012)) / (10))\n    Position\n    change [x check v] by (1)\nend\nset [slope v] to [0]\nrepeat until <<(slope) = [4]> or <not <touching (hitbox v)?>>>\n    change [playery v] by (0.5)\n    Position\n    change [slope v] by (1)\nend\nif <(slope) = [4]> then\n    change [playerx v] by ((0) - (((((speed) * (Zoom)) * (0.012)) / (10)) * (x check)))\n    change [playery v] by ((0) - ((slope) / (2)))\n    if <key (up arrow v) pressed?> then\n        set [jumpkey v] to [1]\n        set [gravity v] to ((Zoom) * (-0.25))\n        if <[0] < (speed)> then\n            set [speed v] to [-10]\n        else\n            if <(speed) < [0]> then\n                set [speed v] to [10]\n            end\n        end\n    else\n        set [speed v] to [0]\n    end\n    Position\nend\n\ndefine Position\nset size to (600) %\ngo to x: ((playerX) - (Cam_X)) y: ((playerY) - (Cam_Y))\nset size to ((Zoom) * (0.6)) %\n\ndefine Tic\nOnline (player?) ?\nif <(@isOnline?) = [online]> then\n    if <(player?) = (Player #)> then\n        Movement\n        cloudUpload # (player?)\n        say (talk)\n    else\n        getCloudData (player?)\n        if <not <(oldCloud) = (@CloudData)>> then\n            Begin Encode Of Player_ (player?)\n            set [playerx v] to (item (1) of [value v])\n            set [playery v] to (item (2) of [value v])\n            set [direction v] to (item (3) of [value v])\n            set [cloud_costume # v] to (item (4) of [value v])\n            set [slope v] to (item (5) of [value v])\n            set [speed v] to (item (6) of [value v])\n            set [gravity v] to (item (7) of [value v])\n            set [jumpkey v] to (item (8) of [value v])\n            set [isonground? v] to (item (9) of [value v])\n            username upload (player?)\n            point in direction (Direction)\n            set size to (500) %\n            go to x: ((playerX) - (Cam_X)) y: ((playerY) - (Cam_Y))\n            set size to (90) %\n            switch costume to (cloud_costume #)\n            set [oldcloud v] to (@CloudData)\n            say (item (11) of [value v])\n        else\n            cloud movement for player (player?)\n        end\n    end\nend\nif <(@isOnline?) = [online]> then\n    change [ghost v] effect by (-5)\nelse\n    change [ghost v] effect by (5)\nend\n\nwhen I receive [flag v]\ngo to x: (0) y: (0)\npoint in direction (90)\nhide\nif <(Max Number of Players) < [2]> then\n    set [max number of players v] to [2]\nelse\n    if <[8] < (Max Number of Players)> then\n        set [max number of players v] to [8]\n    end\nend\nwait (Download Could Data Time) seconds\nCreate Players\nif <(Start With All Players) = [true]> then\n    wait until <not <(Player #) = [0]>>\n    repeat until <(-NumberOfPlayers-) = (Max Number of Players)>\n        online?\n        Set player_ (Player #) to (player_online)\n    end\nend\nbroadcast (startPlayers v)\n\nwhen I receive [startplayers v]\nset [@timer v] to [0]\nset [@timepass v] to (timer)\nforever\n    change [@timer v] by ((timer) - (@TimePass))\n    set [@timepass v] to (timer)\nend\n\ndefine Sync Cloud Data\nif <(Player #) = (player?)> then\n    if <[0.1] < (@Timer)> then\n        online?\n        Set player_ (Player #) to (join (player_online) (@Player Data Upload))\n        set [@timer v] to [0]\n    end\nend\n\nwhen I receive [startplayers v]\nif <(player?) = [1]> then\n    forever\n        if <(Player #) = [9]> then\n            if <key (up arrow v) pressed?> then\n                change [cam_y v] by (5)\n            end\n            if <key (down arrow v) pressed?> then\n                change [cam_y v] by (-5)\n            end\n            if <key (left arrow v) pressed?> then\n                change [cam_x v] by (-5)\n            end\n            if <key (right arrow v) pressed?> then\n                change [cam_x v] by (5)\n            end\n            if <key (space v) pressed?> then\n                set [cam_x v] to [0]\n                set [cam_y v] to [-80]\n            end\n        end\n    end\nend\n\nwhen [r v] key pressed\nset [player # v] to [9]\n\nwhen I receive [startplayers v]\nset [@talktimer v] to [0]\nforever\n    if <(Player #) = (player?)> then\n        if <(@talkTimer) < [70]> then\n            change [@talktimer v] by (0.5)\n        end\n        Key Check\n        if <(@#) = (length of [chat v])> then\n            if <[60] < (@talkTimer)> then\n                set [talk v] to []\n            end\n        end\n    end\nend\n\ndefine Key Check\nset [@# v] to [0]\nrepeat (length of [chat v])\n    change [@# v] by (1)\n    if <key ((join (@#) []) v) pressed?> then\n        set [@talktimer v] to [0]\n        set [talk v] to (item (@#) of [chat v])\n        set [@# v] to [0]\n        stop [this script v]\n    end\nend\n\ndefine Create grass particle at (x) (y)\nset [particle x v] to (x)\nset [particle y v] to (y)\nbroadcast (GrassParticle v)\n\nwhen flag clicked\nSetup Code\n\nwhen I receive [flag v]\nset [camspeed v] to [0]\nset [cam_y v] to [0]\nset [cam_x v] to [0]\n\nwhen flag clicked\nbroadcast (flag v) and wait\n\nwhen flag clicked\nforever\n    wait until <key (m v) pressed?>\n    wait until <not <key (m v) pressed?>>\n    show variable [@mxy v]\n    repeat until <key (m v) pressed?>\n        set [@mxy v] to (join [Mouse X: ] (join (mouse x) (join [, Mouse Y: ] (mouse y))))\n    end\n    hide variable [@mxy v]\n    wait until <not <key (m v) pressed?>>\nend\n\n\n\nif <not <touching (hitbox v)?>> then\n\nif <not <touching (hitbox v)?>> then\n\n@items\n\ndefine setup items\nset [@item v] to [1]\nrepeat ((itemNumber) - (1))\n    create clone of (_myself_ v)\n    change [@item v] by (1)\nend\n\nwhen I receive [flag v]\nsetupData\nsetup items\n\nwhen flag clicked\nset [itemnumber v] to [1]\nhide\n\nwhen I receive [startplayers v]\nset [x v] to [0]\nset [y v] to [-125]\nforever\n    set size to (1000) %\n    go to x: ((x) - (Cam_X)) y: ((y) - (Cam_Y))\n    set size to (Zoom) %\nend\n\nshow\n\ndefine setupData\ndelete all of [item data v]\nrepeat ((itemNumber) * (3))\n    add [] to [item data v]\nend\n\n@Multiplayer\n\nwhen I receive [scan for game v]\nset [encoded v] to []\nEncode (username)\nswitch costume to (downloading cloud data... v)\nshow\nset [player # v] to [0]\nreplace item (1) of [player_open? v] with [0]\nreplace item (2) of [player_open? v] with [0]\nreplace item (3) of [player_open? v] with [0]\nreplace item (4) of [player_open? v] with [0]\nreplace item (5) of [player_open? v] with [0]\nreplace item (6) of [player_open? v] with [0]\nreplace item (7) of [player_open? v] with [0]\nreplace item (8) of [player_open? v] with [0]\nwait (Download Could Data Time) seconds\nswitch costume to (looking for players v)\nrepeat until <not <(Player #) = [0]>>\n    Check for open slot\n    wait (0.15) seconds\n    Take Open Slot\n    switch costume to (looking for game2 v)\nend\nif <(Start With All Players) = [true]> then\n    switch costume to (you timed out2 v)\n    wait until <(Max Number of Players) = (-NumberOfPlayers-)>\nend\nif <(Player #) = [1]> then\n    switch costume to (creating new game v)\nelse\n    switch costume to (joining game v)\nend\nwait (1) seconds\nrepeat (10)\n    go to [front v] layer\n    change [ghost v] effect by (10)\nend\nhide\n\ndefine is player (#) open?\ngetCloudData (#)\nset [player_online? v] to (item (#) of [player_online? v])\nset [player_open? v] to (item (#) of [player_open? v])\nif <(player_online?) = (join (letter (1) of (@CloudData)) (letter (2) of (@CloudData)))> then\n    change [player_open? v] by (1)\nelse\n    if <not <(@CloudData) = [2425142300]>> then\n        set [player_open? v] to [0]\n    end\nend\nset [player_online? v] to (join (letter (1) of (@CloudData)) (letter (2) of (@CloudData)))\nif <[15] < (player_open?)> then\n    Set player_ (#) to [2425142300]\nend\nreplace item (#) of [player_online? v] with (player_online?)\nreplace item (#) of [player_open? v] with (player_open?)\n\ndefine CheakOnline\nset [-numberofplayers- v] to [0]\nif <(☁ player_1) = [2425142300]> then\n    replace item (1) of [isonline v] with [offline]\nelse\n    change [-numberofplayers- v] by (1)\n    replace item (1) of [isonline v] with [online]\nend\nif <(☁ player_2) = [2425142300]> then\n    replace item (2) of [isonline v] with [offline]\nelse\n    change [-numberofplayers- v] by (1)\n    replace item (2) of [isonline v] with [online]\nend\nif <(☁ player_3) = [2425142300]> then\n    replace item (3) of [isonline v] with [offline]\nelse\n    change [-numberofplayers- v] by (1)\n    replace item (3) of [isonline v] with [online]\nend\nif <(☁ player_4) = [2425142300]> then\n    replace item (4) of [isonline v] with [offline]\nelse\n    change [-numberofplayers- v] by (1)\n    replace item (4) of [isonline v] with [online]\nend\nif <(☁ player_5) = [2425142300]> then\n    replace item (5) of [isonline v] with [offline]\nelse\n    change [-numberofplayers- v] by (1)\n    replace item (5) of [isonline v] with [online]\nend\nif <(☁ player_6) = [2425142300]> then\n    replace item (6) of [isonline v] with [offline]\nelse\n    change [-numberofplayers- v] by (1)\n    replace item (6) of [isonline v] with [online]\nend\nif <(☁ player_7) = [2425142300]> then\n    replace item (7) of [isonline v] with [offline]\nelse\n    change [-numberofplayers- v] by (1)\n    replace item (7) of [isonline v] with [online]\nend\nif <(☁ player_8) = [2425142300]> then\n    replace item (8) of [isonline v] with [offline]\nelse\n    change [-numberofplayers- v] by (1)\n    replace item (8) of [isonline v] with [online]\nend\n\ndefine Check for open slot\nreplace item (1) of [name? v] with <(☁ player_1) = (encoded)>\nreplace item (2) of [name? v] with <(☁ player_2) = (encoded)>\nreplace item (3) of [name? v] with <(☁ player_3) = (encoded)>\nreplace item (4) of [name? v] with <(☁ player_4) = (encoded)>\nreplace item (5) of [name? v] with <(☁ player_5) = (encoded)>\nreplace item (6) of [name? v] with <(☁ player_6) = (encoded)>\nreplace item (7) of [name? v] with <(☁ player_7) = (encoded)>\nif <(☁ player_1) = [2425142300]> then\n    set [☁ player_1 v] to (encoded)\nelse\n    if <<(☁ player_2) = [2425142300]> and <(item (1) of [name? v]) = [false]>> then\n        set [☁ player_2 v] to (encoded)\n    else\n        if <<<(☁ player_3) = [2425142300]> and <<(item (1) of [name? v]) = [false]> and <(item (2) of [name? v]) = [false]>>> and <[2] < (Max Number of Players)>> then\n            set [☁ player_3 v] to (encoded)\n        else\n            if <<<(☁ player_4) = [2425142300]> and <<(item (1) of [name? v]) = [false]> and <<(item (2) of [name? v]) = [false]> and <(item (3) of [name? v]) = [false]>>>> and <[3] < (Max Number of Players)>> then\n                set [☁ player_4 v] to (encoded)\n            else\n                if <<<(☁ player_5) = [2425142300]> and <<(item (1) of [name? v]) = [false]> and <<(item (2) of [name? v]) = [false]> and <<(item (3) of [name? v]) = [false]> and <(item (4) of [name? v]) = [false]>>>>> and <[4] < (Max Number of Players)>> then\n                    set [☁ player_5 v] to (encoded)\n                else\n                    if <<<(☁ player_6) = [2425142300]> and <<(item (1) of [name? v]) = [false]> and <<(item (2) of [name? v]) = [false]> and <<(item (3) of [name? v]) = [false]> and <<(item (4) of [name? v]) = [false]> and <(item (5) of [name? v]) = [false]>>>>>> and <[5] < (Max Number of Players)>> then\n                        set [☁ player_6 v] to (encoded)\n                    else\n                        if <<<(☁ player_7) = [2425142300]> and <<(item (1) of [name? v]) = [false]> and <<(item (2) of [name? v]) = [false]> and <<(item (3) of [name? v]) = [false]> and <<(item (4) of [name? v]) = [false]> and <<(item (5) of [name? v]) = [false]> and <(item (6) of [name? v]) = [false]>>>>>>> and <[6] < (Max Number of Players)>> then\n                            set [☁ player_7 v] to (encoded)\n                        else\n                            if <<<(☁ player_8) = [2425142300]> and <<(item (1) of [name? v]) = [false]> and <<(item (2) of [name? v]) = [false]> and <<(item (3) of [name? v]) = [false]> and <<(item (4) of [name? v]) = [false]> and <<(item (5) of [name? v]) = [false]> and <<(item (6) of [name? v]) = [false]> and <(item (7) of [name? v]) = [false]>>>>>>>> and <[7] < (Max Number of Players)>> then\n                                set [☁ player_8 v] to (encoded)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen [9 v] key pressed\nshow variable [☁ player_1 v]\nshow variable [☁ player_2 v]\nshow variable [☁ player_3 v]\nshow variable [☁ player_4 v]\nshow variable [☁ player_5 v]\nshow variable [☁ player_6 v]\nshow variable [☁ player_7 v]\nshow variable [☁ player_8 v]\n\nwhen [0 v] key pressed\nhide variable [☁ player_1 v]\nhide variable [☁ player_2 v]\nhide variable [☁ player_3 v]\nhide variable [☁ player_4 v]\nhide variable [☁ player_5 v]\nhide variable [☁ player_6 v]\nhide variable [☁ player_7 v]\nhide variable [☁ player_8 v]\n\nwhen [timer v] > ((closed) + (1))\nif <(Player #) = [1]> then\n    set [☁ player_1 v] to [2425142300]\nend\nif <(Player #) = [2]> then\n    set [☁ player_2 v] to [2425142300]\nend\nif <(Player #) = [3]> then\n    set [☁ player_3 v] to [2425142300]\nend\nif <(Player #) = [4]> then\n    set [☁ player_4 v] to [2425142300]\nend\nif <(Player #) = [5]> then\n    set [☁ player_5 v] to [2425142300]\nend\nif <(Player #) = [6]> then\n    set [☁ player_6 v] to [2425142300]\nend\nif <(Player #) = [7]> then\n    set [☁ player_7 v] to [2425142300]\nend\nif <(Player #) = [8]> then\n    set [☁ player_8 v] to [2425142300]\nend\n\ndefine Encode (value)\nset [numb # v] to [1]\nrepeat (length of (value))\n    set [encoded v] to (join (encoded) (item # of (letter (numb #) of (value)) in [code v]))\n    change [numb # v] by (1)\nend\nset [encoded v] to (join (encoded) [00])\n\ndefine Take Open Slot\nif <(☁ player_1) = (encoded)> then\n    set [player # v] to [1]\n    set [☁ player_1 v] to [00]\nelse\n    if <(☁ player_2) = (encoded)> then\n        set [player # v] to [2]\n        set [☁ player_2 v] to [00]\n    else\n        if <(☁ player_3) = (encoded)> then\n            set [player # v] to [3]\n            set [☁ player_3 v] to [00]\n        else\n            if <(☁ player_4) = (encoded)> then\n                set [player # v] to [4]\n                set [☁ player_4 v] to [00]\n            else\n                if <(☁ player_5) = (encoded)> then\n                    set [player # v] to [5]\n                    set [☁ player_5 v] to [00]\n                else\n                    if <(☁ player_6) = (encoded)> then\n                        set [player # v] to [6]\n                        set [☁ player_6 v] to [00]\n                    else\n                        if <(☁ player_7) = (encoded)> then\n                            set [player # v] to [7]\n                            set [☁ player_7 v] to [00]\n                        else\n                            if <(☁ player_8) = (encoded)> then\n                                set [player # v] to [8]\n                                set [☁ player_8 v] to [00]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine TimeOut\nif <<<(☁ player_4) = [2425142300]> and <(Player #) = [4]>> or <<<(☁ player_3) = [2425142300]> and <(Player #) = [3]>> or <<<(☁ player_2) = [2425142300]> and <(Player #) = [2]>> or <<(☁ player_1) = [2425142300]> and <(Player #) = [1]>>>>> then\n    switch costume to (you timed out v)\n    clear graphic effects\n    show\nend\n\ndefine Set player_ (#) to (value)\nif <(#) = [1]> then\n    set [☁ player_1 v] to (value)\nelse\n    if <(#) = [2]> then\n        set [☁ player_2 v] to (value)\n    else\n        if <(#) = [3]> then\n            set [☁ player_3 v] to (value)\n        else\n            if <(#) = [4]> then\n                set [☁ player_4 v] to (value)\n            else\n                if <(#) = [5]> then\n                    set [☁ player_5 v] to (value)\n                else\n                    if <(#) = [6]> then\n                        set [☁ player_6 v] to (value)\n                    else\n                        if <(#) = [7]> then\n                            set [☁ player_7 v] to (value)\n                        else\n                            set [☁ player_8 v] to (value)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine getCloudData (#)\nif <(#) = [1]> then\n    set [@clouddata v] to (☁ player_1)\nelse\n    if <(#) = [2]> then\n        set [@clouddata v] to (☁ player_2)\n    else\n        if <(#) = [3]> then\n            set [@clouddata v] to (☁ player_3)\n        else\n            if <(#) = [4]> then\n                set [@clouddata v] to (☁ player_4)\n            else\n                if <(#) = [5]> then\n                    set [@clouddata v] to (☁ player_5)\n                else\n                    if <(#) = [6]> then\n                        set [@clouddata v] to (☁ player_6)\n                    else\n                        if <(#) = [7]> then\n                            set [@clouddata v] to (☁ player_7)\n                        else\n                            set [@clouddata v] to (☁ player_8)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine playerIsOpen\nset [# v] to [0]\nrepeat (Max Number of Players)\n    change [# v] by (1)\n    is player (#) open?\nend\n\ndefine setup\nif <not <(Player_Pos) = [8]>> then\n    delete all of [player_pos v]\n    repeat (8)\n        add [] to [player_pos v]\n    end\nend\nif <not <(player_open?) = [8]>> then\n    delete all of [player_open? v]\n    repeat (8)\n        add [] to [player_open? v]\n    end\nend\nif <not <(player_online?) = [8]>> then\n    delete all of [player_online? v]\n    repeat (8)\n        add [] to [player_online? v]\n    end\nend\n\nwhen I receive [flag v]\nsetup\nbroadcast (Scan for Game v)\nhide\n\nwhen I receive [flag v]\nif <(Max Number of Players) < [3]> then\n    set [☁ player_3 v] to [2425142300]\nend\nwait (0.1) seconds\nif <(Max Number of Players) < [4]> then\n    set [☁ player_4 v] to [2425142300]\nend\nwait (0.1) seconds\nif <(Max Number of Players) < [5]> then\n    set [☁ player_5 v] to [2425142300]\nend\nwait (0.1) seconds\nif <(Max Number of Players) < [6]> then\n    set [☁ player_6 v] to [2425142300]\nend\nwait (0.1) seconds\nif <(Max Number of Players) < [7]> then\n    set [☁ player_7 v] to [2425142300]\nend\nwait (0.1) seconds\nif <(Max Number of Players) < [8]> then\n    set [☁ player_8 v] to [2425142300]\nend\n\nwhen I receive [flag v]\nforever\n    set [closed v] to (timer)\n    playerIsOpen\n    CheakOnline\n    wait (0.1) seconds\nend\n\n@Text Engine\n\ndefine Type (sentence) , X (x) , Y (y) , between space (s) , size (size) (brightness) (color)\ndelete all of [number of lines v]\ndelete all of [debug v]\nclear graphic effects\nset [brightness v] effect to (brightness)\nset [color v] effect to (color)\nset size to (size) %\nhide\nset [numb v] to [0]\nset [length v] to [0]\nrepeat until <(numb) = (length of (sentence))>\n    change [numb v] by (1)\n    change [length v] by (1)\n    if <(letter (numb) of (sentence)) = [+]> then\n        change [length v] by (-1)\n    end\n    if <<(letter (numb) of (sentence)) = [/]> and <(letter ((numb) + (1)) of (sentence)) = [ ]>> then\n        change [numb v] by (1)\n        change [length v] by (-1)\n        add ((length) - (item ((length of [number of lines v]) - (1)) of [number of lines v])) to [number of lines v]\n    end\nend\nadd ((length) - (item (length of [number of lines v]) of [number of lines v])) to [number of lines v]\nset [number of lines v] to [1]\ngo to x: ((x) - (((item (number of lines) of [number of lines v]) * (s)) / (2))) y: (y)\nset [numb v] to [0]\nrepeat until <(numb) = (length of (sentence))>\n    change [numb v] by (1)\n    if <[letters v] contains (letter (numb) of (sentence))?> then\n        set [text v] to (item (item # of (letter (numb) of (sentence)) in [letters v]) of [letters v])\n    else\n        set [text v] to (letter (numb) of (sentence))\n    end\n    if <<(text) = [+]> and <[letters v] contains (letter ((numb) + (1)) of (sentence))?>> then\n        if <(letter ((numb) + (1)) of (sentence)) = [a]> then\n            switch costume to (a  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [b]> then\n            switch costume to (b  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [c]> then\n            switch costume to (c  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [d]> then\n            switch costume to (d  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [e]> then\n            switch costume to (e  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [f]> then\n            switch costume to (f  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [g]> then\n            switch costume to (g  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [h]> then\n            switch costume to (h  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [i]> then\n            switch costume to (i  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [j]> then\n            switch costume to (j  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [k]> then\n            switch costume to (k  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [l]> then\n            switch costume to (l  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [m]> then\n            switch costume to (m  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [n]> then\n            switch costume to (n  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [o]> then\n            switch costume to (o  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [p]> then\n            switch costume to (p  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [q]> then\n            switch costume to (q  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [r]> then\n            switch costume to (r  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [s]> then\n            switch costume to (s  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [t]> then\n            switch costume to (t  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [u]> then\n            switch costume to (u  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [v]> then\n            switch costume to (v  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [w]> then\n            switch costume to (w  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [x]> then\n            switch costume to (x  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [y]> then\n            switch costume to (y  v)\n        end\n        if <(letter ((numb) + (1)) of (sentence)) = [z]> then\n            switch costume to (z  v)\n        end\n        create clone of (_myself_ v)\n        change x by (s)\n        change [numb v] by (1)\n    else\n        if <<(text) = [/]> and <not <(letter ((numb) + (1)) of (sentence)) = [ ]>>> then\n            change [number of lines v] by (1)\n            set x to ((x) - (((item (number of lines) of [number of lines v]) * (s)) / (2)))\n            change y by ((s) * (-2.2))\n            change [numb v] by (1)\n        else\n            if <(text) = [ ]> then\n                change x by ((s) - (4))\n            else\n                switch costume to (text)\n                create clone of (_myself_ v)\n                change x by (s)\n            end\n        end\n    end\nend\n\nwhen I receive [cleartexted v]\ndelete this clone\n\nwhen I start as a clone\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\n\nwhen I receive [startplayers v]\nforever\n    broadcast (ClearTexted v)\n    Type (join (-NumberOfPlayers-) (join [ / ] (Max Number of Players))) , X [190] , Y [-165] , between space [9] , size [90] [-100] [0]\n    names\nend\n\ndefine names\nset [#2 v] to [0]\nrepeat (Max Number of Players)\n    change [#2 v] by (1)\n    if <(item (#2) of [isonline v]) = [online]> then\n        Decode (item (#2) of [player_pos v])\n        X and Y\n        if <<<[200] > (x)> and <(x) > [-200]>> and <<[200] > ((y) + ((Zoom) * (0.65)))> and <((y) + ((Zoom) * (0.65))) > [-200]>>> then\n            Type (item (#2) of [username v]) , X (x) , Y ((y) + ((Zoom) * (0.65))) , between space [9] , size [50] [-30] (((1) * (30)) - (30))\n            player (x) (y)\n        end\n    end\nend\n\ndefine X and Y\nset [x v] to (item (1) of [value v])\nset [y v] to (item (2) of [value v])\n\ndefine Decode (value)\ndelete all of [value v]\nset [value v] to []\nset [# v] to [0]\nrepeat ((length of (value)) / (2))\n    change [# v] by (2)\n    if <(join (letter ((#) - (1)) of (value)) (letter (#) of (value))) < [10]> then\n        add (value) to [value v]\n        set [value v] to []\n    end\n    if <(join (letter ((#) - (1)) of (value)) (letter (#) of (value))) = [78]> then\n        set [value v] to (join (value) [ ])\n    else\n        set [value v] to (join (value) (item (join (letter ((#) - (1)) of (value)) (letter (#) of (value))) of [code v]))\n    end\nend\n\ndefine player (x) (y)\nswitch costume to (player v)\ngo to x: (x) y: ((y) + ((Zoom) * (0.43)))\ncreate clone of (_myself_ v)\n\n@Thumbnail\n\nwhen flag clicked\ngo to [front v] layer\nrepeat (10)\n    change [brightness v] effect by (10)\n    change [ghost v] effect by (10)\nend\nset [ghost v] effect to (100)\n\n@Level\n\ndefine size (number)\nswitch costume to (costume2 v)\nset size to (number) %\nset [brightness v] effect to (((day) / (3)) * (-1))\nif <(sp) = [1]> then\n    switch costume to (map 1 p2 v)\n    go [forward v] (1) layers\n    go to [back v] layer\nelse\n    if <(sp) = [2]> then\n        switch costume to (map 1 p3 v)\n        go to [back v] layer\n        go [forward v] (3) layers\n    else\n        if <(sp) = [0]> then\n            switch costume to (map 1 p1 v)\n            go to [back v] layer\n            go [forward v] (2) layers\n        else\n            switch costume to (map 1 p4 v)\n            set [brightness v] effect to ((20) - ((day) / (2)))\n            go to [back v] layer\n        end\n    end\nend\n\ndefine go to (x) (y)\nif <<(sp) = [clouds]> or <(sp) = [3]>> then\n    go to x: ((x) / (2)) y: ((y) / (2))\n    if <(sp) = [3]> then\n        if <<not <(x position) = ((x) / (2))>> or <not <(y position) = ((y) / (2))>>> then\n            hide\n        else\n            show\n        end\n    end\nelse\n    go to x: (x) y: (y)\n    if <<not <(x position) = (x)>> or <not <(y position) = (y)>>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I start as a clone\nif <(sp) = [clouds]> then\n    set [x v] to ((Cam_X) + (pick random (-500.0) to (600.0)))\n    set [y v] to (pick random ((Cam_Y) - (900)) to ((Cam_Y) + (900)))\n    set [speed v] to (pick random (1.0) to (6.0))\n    set [size v] to (pick random (80.0) to (160.0))\nend\nforever\n    if <(sp) = [clouds]> then\n        update cloud\n    else\n        size ((Zoom) * (3))\n        go to (round ((0) - (Cam_X))) (round ((0) - (Cam_Y)))\n    end\nend\n\ndefine setup\nset [sp v] to [1]\ncreate clone of (_myself_ v)\nset [sp v] to [2]\ncreate clone of (_myself_ v)\nset [sp v] to [3]\ncreate clone of (_myself_ v)\nrepeat (16)\n    set [sp v] to [clouds]\n    create clone of (_myself_ v)\nend\nset [sp v] to [0]\n\ndefine update cloud\ngo to [back v] layer\nset [brightness v] effect to (((day) / (2)) * (-1))\nif <(x) < ((Cam_X) - (600))> then\n    set [x v] to ((Cam_X) + (600))\n    set [y v] to (pick random ((Cam_Y) - (900)) to ((Cam_Y) + (900)))\n    set [speed v] to (pick random (2) to (5))\nend\nchange [x v] by ((speed) * (-1))\nswitch costume to (costume2 v)\nset size to (100000) %\ngo to ((x) - (Cam_X)) ((y) - (Cam_Y))\nset size to (size) %\nswitch costume to (cloud v)\n\nwhen I receive [flag v]\nsetup\ngo to [back v] layer\nforever\n    size ((Zoom) * (3))\n    go to (round ((0) - (Cam_X))) (round ((0) - (Cam_Y)))\nend\n\n@hitbox\n\ndefine size (number)\nswitch costume to (costume2 v)\nset size to (number) %\nswitch costume to (hitbox v)\ngo to [back v] layer\n\ndefine go to (x) (y)\ngo to x: (x) y: (y)\nif <<not <(x position) = (x)>> or <not <(y position) = (y)>>> then\n    hide\nelse\n    show\nend\n\nwhen I receive [flag v]\ngo to [back v] layer\nset [ghost v] effect to (100)\nforever\n    size ((Zoom) * (3))\n    go to (round ((0) - (Cam_X))) (round ((0) - (Cam_Y)))\nend\n\n@chat\n\nwhen flag clicked\nswitch costume to (costume2 v)\nhide\n\nwhen [t v] key pressed\ngo to [front v] layer\nif <(costume [number v]) = [2]> then\n    set size to (10) %\n    set y to (-60)\n    set size to (100) %\n    switch costume to (costume1 v)\n    show\n    repeat (5)\n        set size to (10) %\n        change y by (10)\n        set size to (100) %\n    end\n    switch costume to (costume1 v)\n    go to x: (0) y: (0)\nelse\n    switch costume to (costume1 v)\n    repeat (5)\n        set size to (10) %\n        change y by (-10)\n        set size to (100) %\n    end\n    switch costume to (costume2 v)\n    set size to (10) %\n    go to x: (0) y: (-60)\n    set size to (100) %\n    hide\nend\n\nwhen [any v] key pressed\nif <<not <key (t v) pressed?>> and <not <(y position) = [-60]>>> then\n    switch costume to (costume1 v)\n    repeat (5)\n        set size to (10) %\n        change y by (-10)\n        set size to (100) %\n    end\n    switch costume to (costume2 v)\n    set size to (10) %\n    go to x: (0) y: (-60)\n    set size to (100) %\n    hide\nend\n\n@Particles\n\nwhen flag clicked\nset [#c? v] to [0]\nhide\n\nwhen I receive [grassparticle v]\nif <(#c?) = [0]> then\n    set [x v] to (Particle X)\n    set [y v] to (Particle Y)\n    set [@particle v] to [Grass_E_]\n    set [#c? v] to [1]\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(@Particle) = [Grass_E_]> then\n    clone\nend\n\nwhen I start as a clone\nif <(@Particle) = [Grass_P_]> then\n    set size to (pick random (20.0) to (40.0)) %\n    set [ghost v] effect to (pick random (40.0) to (60.0))\n    set [brightness v] effect to (pick random (-20.0) to (20.0))\n    show\n    go to x: ((x) - (Cam_X)) y: ((y) - (Cam_Y))\n    set [sy v] to (pick random (2.0) to (4.0))\n    set [sx v] to ((pick random (2.0) to (3.0)) * (item (pick random (1) to (2)) of [-1 v]))\n    repeat until <<touching (hitbox v)?> or <touching (_edge_ v)?>>\n        change [sy v] by (-0.5)\n        if <[0] < (sX)> then\n            change [sx v] by (-0.2)\n        else\n            change [sx v] by (0.2)\n        end\n        change [x v] by (sX)\n        change [y v] by (sY)\n        go to x: ((x) - (Cam_X)) y: ((y) - (Cam_Y))\n    end\n    set [#c? v] to [0]\n    delete this clone\nend\n\ndefine clone\nset [@particle v] to [Grass_P_]\ngo to x: (x) y: (y)\nrepeat (10)\n    create clone of (_myself_ v)\nend\ndelete this clone\n\n