Unfinished 3D Platformer


@Stage\n\n@Empty\n\n@Main\n\nwhen flag clicked\nhide\nwait (0.01) seconds\nbroadcast (mainMenu v)\n\nwhen I receive [gameloop v]\ndelete all of [selectquad v]\ndelete all of [selectvertex v]\nset [levelwon v] to [false]\nbroadcast (initPhysics v) and wait\nbroadcast (initTextEngine v) and wait\nset [menukey v] to [false]\nset [looptask v] to [none]\nset [leveltime v] to [0]\nset [timeprevious v] to (days since 2000)\nrepeat until <(LevelWon) = [true]>\n    if <(LoopTask) = [none]> then\n        if <key ((item (6) of [controls v]) v) pressed?> then\n            set [menukey v] to [true]\n        else\n            if <(menuKey) = [true]> then\n                if <(EditorMode) = [false]> then\n                    broadcast (mainMenu v)\n                end\n                stop [this script v]\n            end\n            set [menukey v] to [false]\n        end\n        set [timenext v] to (days since 2000)\n        set [timeelapsed v] to ((round ((86400000) * ((timeNext) - (timePrevious)))) / (1000))\n        set [fps v] to (round ((1) / (timeElapsed)))\n        change [leveltime v] by (((1) / (30)) / (FrameMultiplier))\n        set [timeprevious v] to (timeNext)\n        broadcast (physics v)\n        if <(LoopTask) = [none]> then\n            broadcast (text v)\n        end\n        if <(LoopTask) = [none]> then\n            broadcast (graphics v)\n        end\n    end\n    wait (0) seconds\nend\nset [leveltime v] to ((round ((100) * (levelTime))) / (100))\nif <(EditorMode) = [false]> then\n    broadcast (winScreen v)\nend\n\ndefine Thumbnail\nset [☁ cloudlock v] to [-1]\nset [currentlevel v] to [1]\ndelete all of [mainlevelscompletion v]\nrepeat (length of [mainlevels v])\n    add [false] to [mainlevelscompletion v]\nend\ndelete all of [controls v]\nadd [W] to [controls v]\nadd [S] to [controls v]\nadd [A] to [controls v]\nadd [D] to [controls v]\nadd [R] to [controls v]\nadd [M] to [controls v]\nset [3dquality v] to [High]\nset [musicenabled v] to [true]\nset [editormode v] to [false]\nstop [all v]\n\nwhen I receive [editorloop v]\nbroadcast (initSoftEditor v) and wait\nbroadcast (initPhysics v) and wait\nbroadcast (initTextEngine v) and wait\nset [menukey v] to [false]\nset [looptask v] to [none]\nset [leveltime v] to [0]\nset [timeprevious v] to (days since 2000)\nforever\n    if <(LoopTask) = [none]> then\n        if <key ((item (6) of [controls v]) v) pressed?> then\n            set [menukey v] to [true]\n        else\n            if <(menuKey) = [true]> then\n                broadcast (editorToPlayMode v) and wait\n            end\n            set [menukey v] to [false]\n        end\n        set [timenext v] to (days since 2000)\n        set [timeelapsed v] to ((round ((86400000) * ((timeNext) - (timePrevious)))) / (1000))\n        set [fps v] to (round ((1) / (timeElapsed)))\n        change [leveltime v] by (((1) / (30)) / (FrameMultiplier))\n        set [timeprevious v] to (timeNext)\n        broadcast (editorMovement v)\n        if <(LoopTask) = [none]> then\n            broadcast (editor v)\n        end\n        if <(LoopTask) = [none]> then\n            broadcast (graphics v)\n        end\n        if <(LoopTask) = [none]> then\n            broadcast (editorText v)\n        end\n    end\n    wait (0) seconds\nend\n\n@Game\n\nwhen flag clicked\nhide\n\nwhen I receive [physics v]\nif <not <(LoopTask) = [none]>> then\n    wait until <(LoopTask) = [none]>\nend\nset [looptask v] to [physics]\nupdate FrameMultiplier\nif <key ((item (5) of [controls v]) v) pressed?> then\n    set [respawnkey v] to [true]\nelse\n    if <(respawnKey) = [true]> then\n        reset <[0] = [0]>\n    end\n    set [respawnkey v] to [false]\nend\nPhysics <key (space v) pressed?> <key ((item (1) of [controls v]) v) pressed?> <key ((item (2) of [controls v]) v) pressed?> <key ((item (4) of [controls v]) v) pressed?> <key ((item (3) of [controls v]) v) pressed?> <key (up arrow v) pressed?> <key (down arrow v) pressed?> <key (right arrow v) pressed?> <key (left arrow v) pressed?>\nchange [frame v] by ((1) / (FrameMultiplier))\nUpdate Camera\nUpdate Text Position\nUpdate Sound\nset [looptask v] to [none]\n\nwhen I receive [initphysics v]\nset [respawnkey v] to [false]\nset [lastupdate v] to (days since 2000)\nset [framemultiplier v] to [1]\nset [physics_steps v] to [4]\nset [physics_friction_h v] to ([e ^ v] of (((1) / (PHYSICS_STEPS)) * ([ln v] of (0.75) )) )\nset [physics_friction_v v] to ([e ^ v] of (((1) / (PHYSICS_STEPS)) * ([ln v] of (0.96) )) )\nset [physics_gravity v] to [-0.6]\nset [physics_bounce v] to [24]\nset [physics_fire_bounce v] to [13]\nset [physics_slipperiness v] to [10]\nset [player_coyote_time v] to [4]\nset [player_fire_time v] to [80]\nset [player_speed v] to [1]\nset [player_jump v] to [11]\nset [player_velocity_limit v] to [30]\nset [player_turn_speed v] to [5]\nset [player_size_v v] to [16]\nset [player_size_h v] to ((PLAYER_SIZE_V) / (2))\nSet Checkpoint (item (1) of [locationspawn v]) (item (2) of [locationspawn v]) (item (3) of [locationspawn v]) (item (4) of [locationspawn v]) [0] (PHYSICS_GRAVITY) [0]\nreset <[1] = [0]>\nset volume to (60) %\n\ndefine reset <death>\nif <death> then\n    change [leveldeaths v] by (1)\n    replace item ((item # of [_checkpoint] in [sounds v]) + (1)) of [_currentsounds v] with [4]\n    Start Sound [death]\nelse\n    set [leveldeaths v] to [0]\n    reset sounds\nend\nset [playerx v] to (item (1) of [locationcheckpoint v])\nset [playery v] to (item (2) of [locationcheckpoint v])\nset [playerz v] to (item (3) of [locationcheckpoint v])\nset [playerrotation v] to (item (4) of [locationcheckpoint v])\nset [playerrotx v] to (item (5) of [locationcheckpoint v])\nset [physics_gravity v] to (item (6) of [locationcheckpoint v])\nset [frame v] to (item (7) of [locationcheckpoint v])\nif <(PHYSICS_GRAVITY) < [0]> then\n    set [3dcamrotz v] to [0]\nelse\n    set [3dcamrotz v] to [180]\nend\nset [_i0 v] to [0]\nset [playervelx v] to [0]\nset [playervely v] to [0]\nset [playervelz v] to [0]\nset [playerjumptime v] to [-1]\nset [playerlastjumptime v] to [-100]\nset [playermovingplattime v] to [-1]\nset [slopevely v] to [0]\nset [_platmovex v] to [0]\nset [_platmovey v] to [0]\nset [_platmovez v] to [0]\nset [playergravityfliptime v] to [-1]\nset [playerfire v] to [-21]\nset [isstuck v] to [0]\n\ndefine Physics <jump> <forward> <backward> <right> <left> <lookup> <lookdown> <lookright> <lookleft>\nset [_i0 v] to ((((PLAYER_VELOCITY_LIMIT) / (FrameMultiplier)) + (([sqrt v] of (2) ) * (PLAYER_SIZE_V))) + (30))\n_getQuads ((playerX) - (_i0)) ((playerX) + (_i0)) ((playerY) - (_i0)) ((playerY) + (_i0)) ((playerZ) - (_i0)) ((playerZ) + (_i0))\nset [framesub v] to [0]\nset [isdead v] to [false]\nrepeat ((PHYSICS_STEPS) / (FrameMultiplier))\n    change [framesub v] by (1)\n    change [playerjumptime v] by ((-1) / (PHYSICS_STEPS))\n    change [playermovingplattime v] by ((-1) / (PHYSICS_STEPS))\n    change [playergravityfliptime v] by ((-1) / (PHYSICS_STEPS))\n    change [playerfire v] by ((-1) / (PHYSICS_STEPS))\n    if <lookup> then\n        change [playerrotx v] by ((PLAYER_TURN_SPEED) / (PHYSICS_STEPS))\n    end\n    if <lookdown> then\n        change [playerrotx v] by ((-1) * ((PLAYER_TURN_SPEED) / (PHYSICS_STEPS)))\n    end\n    if <(playerRotX) > [90]> then\n        set [playerrotx v] to [90]\n    else\n        if <(playerRotX) < [-90]> then\n            set [playerrotx v] to [-90]\n        end\n    end\n    if <lookright> then\n        if <(PHYSICS_GRAVITY) < [0]> then\n            change [playerrotation v] by ((PLAYER_TURN_SPEED) / (PHYSICS_STEPS))\n        else\n            change [playerrotation v] by ((-1) * ((PLAYER_TURN_SPEED) / (PHYSICS_STEPS)))\n        end\n    end\n    if <lookleft> then\n        if <(PHYSICS_GRAVITY) < [0]> then\n            change [playerrotation v] by ((-1) * ((PLAYER_TURN_SPEED) / (PHYSICS_STEPS)))\n        else\n            change [playerrotation v] by ((PLAYER_TURN_SPEED) / (PHYSICS_STEPS))\n        end\n    end\n    set [playerrotation v] to ((playerRotation) mod (360))\n    if <forward> then\n        change [playervelz v] by (((PLAYER_SPEED) * ([cos v] of (playerRotation) )) / (PHYSICS_STEPS))\n        change [playervelx v] by (((PLAYER_SPEED) * ([sin v] of (playerRotation) )) / (PHYSICS_STEPS))\n    end\n    if <backward> then\n        change [playervelz v] by (((-1) * ((PLAYER_SPEED) * ([cos v] of (playerRotation) ))) / (PHYSICS_STEPS))\n        change [playervelx v] by (((-1) * ((PLAYER_SPEED) * ([sin v] of (playerRotation) ))) / (PHYSICS_STEPS))\n    end\n    if <right> then\n        if <(PHYSICS_GRAVITY) < [0]> then\n            change [playervelx v] by (((PLAYER_SPEED) * ([cos v] of (playerRotation) )) / (PHYSICS_STEPS))\n            change [playervelz v] by ((-1) * (((PLAYER_SPEED) * ([sin v] of (playerRotation) )) / (PHYSICS_STEPS)))\n        else\n            change [playervelx v] by (((-1) * ((PLAYER_SPEED) * ([cos v] of (playerRotation) ))) / (PHYSICS_STEPS))\n            change [playervelz v] by (((PLAYER_SPEED) * ([sin v] of (playerRotation) )) / (PHYSICS_STEPS))\n        end\n    end\n    if <left> then\n        if <(PHYSICS_GRAVITY) < [0]> then\n            change [playervelx v] by (((-1) * ((PLAYER_SPEED) * ([cos v] of (playerRotation) ))) / (PHYSICS_STEPS))\n            change [playervelz v] by (((PLAYER_SPEED) * ([sin v] of (playerRotation) )) / (PHYSICS_STEPS))\n        else\n            change [playervelx v] by (((PLAYER_SPEED) * ([cos v] of (playerRotation) )) / (PHYSICS_STEPS))\n            change [playervelz v] by ((-1) * (((PLAYER_SPEED) * ([sin v] of (playerRotation) )) / (PHYSICS_STEPS)))\n        end\n    end\n    if <jump> then\n        set [playerlastjumptime v] to ((frame) + ((frameSub) / (PHYSICS_STEPS)))\n    end\n    if <(((frame) + ((frameSub) / (PHYSICS_STEPS))) - (playerLastJumpTime)) < (PLAYER_COYOTE_TIME)> then\n        if <(playerJumpTime) > [-1e-3]> then\n            if <(PHYSICS_GRAVITY) < [0]> then\n                set [playervely v] to (PLAYER_JUMP)\n            else\n                set [playervely v] to ((-1) * (PLAYER_JUMP))\n            end\n            set [playerjumptime v] to [-1]\n        end\n    end\n    set [playervelx v] to ((PHYSICS_FRICTION_H) * (playerVelX))\n    if <([abs v] of (playerVelX) ) < [0.05]> then\n        set [playervelx v] to [0]\n    end\n    set [playervely v] to ((PHYSICS_FRICTION_V) * (playerVelY))\n    if <([abs v] of (playerVelY) ) < [0.05]> then\n        set [playervely v] to [0]\n    end\n    set [playervelz v] to ((PHYSICS_FRICTION_H) * (playerVelZ))\n    if <([abs v] of (playerVelZ) ) < [0.05]> then\n        set [playervelz v] to [0]\n    end\n    if <<not <(playerJumpTime) > [-1e-3]>> and <(slopeVelY) = [0]>> then\n        change [playervely v] by ((PHYSICS_GRAVITY) / (PHYSICS_STEPS))\n    end\n    if <not <(isStuck) = [0]>> then\n        set [playervely v] to (isStuck)\n        set [playerjumptime v] to [-1]\n    end\n    if <(playerMovingPlatTime) < [-1e-3]> then\n        change [playervelx v] by (_platMoveX)\n        change [playervely v] by (_platMoveY)\n        change [playervelz v] by (_platMoveZ)\n        set [_platmovex v] to [0]\n        set [_platmovey v] to [0]\n        set [_platmovez v] to [0]\n    end\n    set [_move v] to (((playerVelY) + (slopeVelY)) + (_platMoveY))\n    if <([abs v] of (_move) ) > (PLAYER_VELOCITY_LIMIT)> then\n        if <(_move) > [0]> then\n            set [_move v] to (PLAYER_VELOCITY_LIMIT)\n        else\n            set [_move v] to ((-1) * (PLAYER_VELOCITY_LIMIT))\n        end\n    end\n    set [isstuck v] to [0]\n    _moveY ((_move) / (PHYSICS_STEPS))\n    set [slopevely v] to [0]\n    if <(isDead) = [true]> then\n        reset <[0] = [0]>\n        stop [this script v]\n    end\n    if <(PHYSICS_GRAVITY) < [0]> then\n        if <(playerY) < (DeathBarrierBottom)> then\n            reset <[0] = [0]>\n            stop [this script v]\n        end\n    else\n        if <(playerY) > (DeathBarrierTop)> then\n            reset <[0] = [0]>\n            stop [this script v]\n        end\n    end\n    if <(LevelWon) = [true]> then\n        Start Sound [goal]\n        stop [this script v]\n    end\n    set [_move v] to ((playerVelZ) + (_platMoveZ))\n    if <([abs v] of (_move) ) > (PLAYER_VELOCITY_LIMIT)> then\n        if <(_move) > [0]> then\n            set [_move v] to (PLAYER_VELOCITY_LIMIT)\n        else\n            set [_move v] to ((-1) * (PLAYER_VELOCITY_LIMIT))\n        end\n    end\n    _moveZ ((_move) / (PHYSICS_STEPS))\n    if <(isDead) = [true]> then\n        reset <[0] = [0]>\n        stop [this script v]\n    end\n    if <(LevelWon) = [true]> then\n        Start Sound [goal]\n        stop [this script v]\n    end\n    set [_move v] to ((playerVelX) + (_platMoveX))\n    if <([abs v] of (_move) ) > (PLAYER_VELOCITY_LIMIT)> then\n        if <(_move) > [0]> then\n            set [_move v] to (PLAYER_VELOCITY_LIMIT)\n        else\n            set [_move v] to ((-1) * (PLAYER_VELOCITY_LIMIT))\n        end\n    end\n    _moveX ((_move) / (PHYSICS_STEPS))\n    if <(isDead) = [true]> then\n        reset <[0] = [0]>\n        stop [this script v]\n    end\n    if <(LevelWon) = [true]> then\n        Start Sound [goal]\n        stop [this script v]\n    end\nend\n\ndefine Update Camera\nset [3dcamx v] to (playerX)\nset [3dcamy v] to ((playerY) + (((PLAYER_SIZE_V) / (2)) * ((([abs v] of ((180) - ((3DCamRotZ) mod (360))) ) - (90)) / (90))))\nset [3dcamrotx v] to ((playerRotX) * ((([abs v] of ((180) - ((3DCamRotZ) mod (360))) ) - (90)) / (90)))\nset [3dcamz v] to (playerZ)\nset [3dcamroty v] to (playerRotation)\nset [_lerp0 v] to ([e ^ v] of (((1) / (FrameMultiplier)) * (-0.6931471805599453)) )\nif <(PHYSICS_GRAVITY) < [0]> then\n    set [3dcamrotz v] to ((3DCamRotZ) mod (360))\n    if <<([abs v] of (3DCamRotZ) ) < [0.5]> or <([abs v] of ((360) - (3DCamRotZ)) ) < [0.5]>> then\n        set [3dcamrotz v] to [0]\n    else\n        set [3dcamrotz v] to (((_lerp0) * (3DCamRotZ)) + (((1) - (_lerp0)) * (360)))\n    end\nelse\n    if <([abs v] of ((180) - (3DCamRotZ)) ) < [0.5]> then\n        set [3dcamrotz v] to [180]\n    else\n        set [3dcamrotz v] to (((_lerp0) * (3DCamRotZ)) + (((1) - (_lerp0)) * (180)))\n    end\nend\n\ndefine _getQuads (xmin) (xmax) (ymin) (ymax) (zmin) (zmax)\ndelete all of [_currentquads v]\nset [_i0 v] to [1]\nrepeat (length of [3dquadtype v])\n    set [_id0 v] to (((4) * (_i0)) - (2))\n    if <not <<(item (_id0) of [3dquadboundx v]) < (xmin)> or <(item ((_id0) - (1)) of [3dquadboundx v]) > (xmax)>>> then\n        if <not <<(item (_id0) of [3dquadboundy v]) < (ymin)> or <(item ((_id0) - (1)) of [3dquadboundy v]) > (ymax)>>> then\n            if <not <<(item (_id0) of [3dquadboundz v]) < (zmin)> or <(item ((_id0) - (1)) of [3dquadboundz v]) > (zmax)>>> then\n                add (_i0) to [_currentquads v]\n            end\n        end\n    end\n    change [_i0 v] by (1)\nend\n\ndefine _quadFindNearest (id) (xmin) (xmax) (ymin) (ymax) <minslope>\nif <not <<(item (1) of [_clip v]) > (xmin)> or <<(item (4) of [_clip v]) > (xmin)> or <(item (7) of [_clip v]) > (xmin)>>>> then\n    if <<(length of [_clip v]) < [12]> or <not <(item (10) of [_clip v]) > (xmin)>>> then\n        stop [this script v]\n    end\nend\nif <not <<(item (1) of [_clip v]) < (xmax)> or <<(item (4) of [_clip v]) < (xmax)> or <(item (7) of [_clip v]) < (xmax)>>>> then\n    if <<(length of [_clip v]) < [12]> or <not <(item (10) of [_clip v]) < (xmax)>>> then\n        stop [this script v]\n    end\nend\nif <not <<(item (2) of [_clip v]) > (ymin)> or <<(item (5) of [_clip v]) > (ymin)> or <(item (8) of [_clip v]) > (ymin)>>>> then\n    if <<(length of [_clip v]) < [12]> or <not <(item (11) of [_clip v]) > (ymin)>>> then\n        stop [this script v]\n    end\nend\nif <not <<(item (2) of [_clip v]) < (ymax)> or <<(item (5) of [_clip v]) < (ymax)> or <(item (8) of [_clip v]) < (ymax)>>>> then\n    if <<(length of [_clip v]) < [12]> or <not <(item (11) of [_clip v]) < (ymax)>>> then\n        stop [this script v]\n    end\nend\nadd (item (1) of [_clip v]) to [_clip v]\nadd (item (2) of [_clip v]) to [_clip v]\nadd (item (3) of [_clip v]) to [_clip v]\nset [_i1 v] to [1]\nrepeat (((length of [_clip v]) / (3)) - (1))\n    set [_i2 v] to (item (_i1) of [_clip v])\n    if <not <(_i2) < (xmin)>> then\n        add (_i2) to [_clip v]\n        add (item ((_i1) + (1)) of [_clip v]) to [_clip v]\n        add (item ((_i1) + (2)) of [_clip v]) to [_clip v]\n    end\n    set [_lerp0 v] to (((xmin) - (_i2)) / ((item ((_i1) + (3)) of [_clip v]) - (_i2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add (xmin) to [_clip v]\n        add ((((1) - (_lerp0)) * (item ((_i1) + (1)) of [_clip v])) + ((_lerp0) * (item ((_i1) + (4)) of [_clip v]))) to [_clip v]\n        add ((((1) - (_lerp0)) * (item ((_i1) + (2)) of [_clip v])) + ((_lerp0) * (item ((_i1) + (5)) of [_clip v]))) to [_clip v]\n    end\n    change [_i1 v] by (3)\nend\nchange [_i1 v] by (3)\nadd (item (_i1) of [_clip v]) to [_clip v]\nadd (item ((_i1) + (1)) of [_clip v]) to [_clip v]\nadd (item ((_i1) + (2)) of [_clip v]) to [_clip v]\nrepeat ((((length of [_clip v]) - ((_i1) - (1))) / (3)) - (1))\n    set [_i2 v] to (item (_i1) of [_clip v])\n    if <not <(_i2) > (xmax)>> then\n        add (_i2) to [_clip v]\n        add (item ((_i1) + (1)) of [_clip v]) to [_clip v]\n        add (item ((_i1) + (2)) of [_clip v]) to [_clip v]\n    end\n    set [_lerp0 v] to (((xmax) - (_i2)) / ((item ((_i1) + (3)) of [_clip v]) - (_i2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add (xmax) to [_clip v]\n        add ((((1) - (_lerp0)) * (item ((_i1) + (1)) of [_clip v])) + ((_lerp0) * (item ((_i1) + (4)) of [_clip v]))) to [_clip v]\n        add ((((1) - (_lerp0)) * (item ((_i1) + (2)) of [_clip v])) + ((_lerp0) * (item ((_i1) + (5)) of [_clip v]))) to [_clip v]\n    end\n    change [_i1 v] by (3)\nend\nchange [_i1 v] by (4)\nadd (item ((_i1) - (1)) of [_clip v]) to [_clip v]\nadd (item (_i1) of [_clip v]) to [_clip v]\nadd (item ((_i1) + (1)) of [_clip v]) to [_clip v]\nrepeat ((((length of [_clip v]) - ((_i1) - (2))) / (3)) - (1))\n    set [_i2 v] to (item (_i1) of [_clip v])\n    if <not <(_i2) < (ymin)>> then\n        add (item ((_i1) - (1)) of [_clip v]) to [_clip v]\n        add (_i2) to [_clip v]\n        add (item ((_i1) + (1)) of [_clip v]) to [_clip v]\n    end\n    set [_lerp0 v] to (((ymin) - (_i2)) / ((item ((_i1) + (3)) of [_clip v]) - (_i2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add ((((1) - (_lerp0)) * (item ((_i1) - (1)) of [_clip v])) + ((_lerp0) * (item ((_i1) + (2)) of [_clip v]))) to [_clip v]\n        add (ymin) to [_clip v]\n        add ((((1) - (_lerp0)) * (item ((_i1) + (1)) of [_clip v])) + ((_lerp0) * (item ((_i1) + (4)) of [_clip v]))) to [_clip v]\n    end\n    change [_i1 v] by (3)\nend\nchange [_i1 v] by (3)\nadd (item ((_i1) - (1)) of [_clip v]) to [_clip v]\nadd (item (_i1) of [_clip v]) to [_clip v]\nadd (item ((_i1) + (1)) of [_clip v]) to [_clip v]\nrepeat ((((length of [_clip v]) - ((_i1) - (2))) / (3)) - (1))\n    set [_i2 v] to (item (_i1) of [_clip v])\n    if <not <(_i2) > (ymax)>> then\n        add (item ((_i1) - (1)) of [_clip v]) to [_clip v]\n        add (_i2) to [_clip v]\n        add (item ((_i1) + (1)) of [_clip v]) to [_clip v]\n    end\n    set [_lerp0 v] to (((ymax) - (_i2)) / ((item ((_i1) + (3)) of [_clip v]) - (_i2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add ((((1) - (_lerp0)) * (item ((_i1) - (1)) of [_clip v])) + ((_lerp0) * (item ((_i1) + (2)) of [_clip v]))) to [_clip v]\n        add (ymax) to [_clip v]\n        add ((((1) - (_lerp0)) * (item ((_i1) + (1)) of [_clip v])) + ((_lerp0) * (item ((_i1) + (4)) of [_clip v]))) to [_clip v]\n    end\n    change [_i1 v] by (3)\nend\nchange [_i1 v] by (4)\nset [_min v] to [-1e10]\nset [_max v] to [1e10]\nrepeat (((length of [_clip v]) - ((_i1) - (3))) / (3))\n    set [_i2 v] to (item (_i1) of [_clip v])\n    if <(_i2) < [0]> then\n        if <(_i2) > (_min)> then\n            set [_min v] to (_i2)\n        end\n    else\n        if <(_i2) < (_max)> then\n            set [_max v] to (_i2)\n        end\n    end\n    change [_i1 v] by (3)\nend\nset [_min v] to ((round ((1e8) * (_min))) / (1e8))\nset [_max v] to ((round ((1e8) * (_max))) / (1e8))\nif <(_max) < (_nearPosDist)> then\n    set [_nearposdist v] to (_max)\n    set [_nearposid v] to (id)\nelse\n    if <(_max) = (_nearPosDist)> then\n        set [_i1 v] to (item (id) of [3dquadtype v])\n        set [_i2 v] to (item (_nearPosID) of [3dquadtype v])\n        if <not <(item (((4) * (id)) - (3)) of [3dquadmovement v]) = [_]>> then\n            set [_i1 v] to ((-1) * (_i1))\n        end\n        if <minslope> then\n            if <<<([abs v] of (_i1) ) > ([abs v] of (_i2) )> or <<(_i1) < [0]> and <(_i2) > [0]>>> or <<(_i1) = (_i2)> and <(item ((4) * (id)) of [3dquadslope v]) < (item (_nearPosID) of [3dquadslope v])>>> then\n                set [_nearposdist v] to (_max)\n                set [_nearposid v] to (id)\n            end\n        else\n            if <<<([abs v] of (_i1) ) > ([abs v] of (_i2) )> or <<(_i1) < [0]> and <(_i2) > [0]>>> or <<(_i1) = (_i2)> and <(item ((4) * (id)) of [3dquadslope v]) > (item (_nearPosID) of [3dquadslope v])>>> then\n                set [_nearposdist v] to (_max)\n                set [_nearposid v] to (id)\n            end\n        end\n    end\nend\nif <(_min) > (_nearNegDist)> then\n    set [_nearnegdist v] to (_min)\n    set [_nearnegid v] to (id)\nelse\n    if <(_min) = (_nearNegDist)> then\n        set [_i1 v] to (item (id) of [3dquadtype v])\n        set [_i2 v] to (item (_nearNegID) of [3dquadtype v])\n        if <not <(item (((4) * (id)) - (3)) of [3dquadmovement v]) = [_]>> then\n            set [_i1 v] to ((-1) * (_i1))\n        end\n        if <minslope> then\n            if <<<([abs v] of (_i1) ) > ([abs v] of (_i2) )> or <<(_i1) < [0]> and <(_i2) > [0]>>> or <<(_i1) = (_i2)> and <(item ((4) * (id)) of [3dquadslope v]) < (item (_nearNegID) of [3dquadslope v])>>> then\n                set [_nearnegdist v] to (_min)\n                set [_nearnegid v] to (id)\n            end\n        else\n            if <<<([abs v] of (_i1) ) > ([abs v] of (_i2) )> or <<(_i1) < [0]> and <(_i2) > [0]>>> or <<(_i1) = (_i2)> and <(item ((4) * (id)) of [3dquadslope v]) > (item (_nearNegID) of [3dquadslope v])>>> then\n                set [_nearnegdist v] to (_min)\n                set [_nearnegid v] to (id)\n            end\n        end\n    end\nend\n\ndefine _moveY (dist)\nset [movesize v] to (PLAYER_SIZE_V)\n_findNearestQuads (dist) [1] [3] [2] <[0] = [0]> ((-1) * ((PLAYER_SIZE_H) - (1e-5))) ((PLAYER_SIZE_H) - (1e-5)) ((-1) * ((PLAYER_SIZE_H) - (1e-5))) ((PLAYER_SIZE_H) - (1e-5))\nif <<((_nearPosDist) - (_nearNegDist)) < ((2) * (PLAYER_SIZE_V))> and <<(_nearNegID) > [0]> and <(_nearPosID) > [0]>>> then\n    change [playery v] by (((_nearPosDist) + (_nearNegDist)) / (2))\n    set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n    _touchPlatformY (_nearPosID) [0] (dist)\n    _touchPlatformY (_nearNegID) [0] (dist)\nelse\n    set [_i1 v] to [0]\n    if <(dist) > [0]> then\n        set [_i1 v] to ((_nearPosDist) - (PLAYER_SIZE_V))\n        change [_nearnegdist v] by ((-1) * (_i1))\n        change [playery v] by (_i1)\n        if <(_nearPosID) > [0]> then\n            if <(PHYSICS_GRAVITY) > [0]> then\n                set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n            end\n            _touchPlatformY (_nearPosID) [1] (dist)\n        end\n        if <(_nearNegDist) > ((-1) * (PLAYER_SIZE_V))> then\n            change [playery v] by ((_nearNegDist) + (PLAYER_SIZE_V))\n            if <(PHYSICS_GRAVITY) < [0]> then\n                set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n            end\n            _touchPlatformY (_nearNegID) [-1] (dist)\n        end\n    else\n        if <(dist) < [0]> then\n            set [_i1 v] to ((_nearNegDist) + (PLAYER_SIZE_V))\n            change [_nearposdist v] by ((-1) * (_i1))\n            change [playery v] by (_i1)\n            if <(_nearNegID) > [0]> then\n                if <(PHYSICS_GRAVITY) < [0]> then\n                    set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n                end\n                _touchPlatformY (_nearNegID) [-1] (dist)\n            end\n            if <(_nearPosDist) < (PLAYER_SIZE_V)> then\n                change [playery v] by ((_nearPosDist) - (PLAYER_SIZE_V))\n                if <(PHYSICS_GRAVITY) > [0]> then\n                    set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n                end\n                _touchPlatformY (_nearPosID) [1] (dist)\n            end\n        end\n    end\nend\n\ndefine _moveX (dist)\nset [movesize v] to (PLAYER_SIZE_H)\n_findNearestQuads (dist) [3] [2] [1] <[0] = [0]> ((-1) * ((PLAYER_SIZE_H) - (1e-5))) ((PLAYER_SIZE_H) - (1e-5)) ((-1) * ((PLAYER_SIZE_V) - (1e-5))) ((PLAYER_SIZE_V) - (1e-5))\nif <<((_nearPosDist) - (_nearNegDist)) < ((2) * (PLAYER_SIZE_H))> and <<(_nearNegID) > [0]> and <(_nearPosID) > [0]>>> then\n    change [playerx v] by (((_nearPosDist) + (_nearNegDist)) / (2))\n    _touchPlatformX (_nearPosID) [0] (dist)\n    _touchPlatformX (_nearNegID) [0] (dist)\nelse\n    if <(dist) > [0]> then\n        set [_i1 v] to ((_nearPosDist) - (PLAYER_SIZE_H))\n        change [_nearnegdist v] by ((-1) * (_i1))\n        change [playerx v] by (_i1)\n        if <(_nearPosID) > [0]> then\n            _touchPlatformX (_nearPosID) [1] (dist)\n        end\n        if <(_nearNegDist) > ((-1) * (PLAYER_SIZE_H))> then\n            change [playerx v] by ((_nearNegDist) + (PLAYER_SIZE_H))\n            _touchPlatformX (_nearNegID) [-1] (dist)\n        end\n    else\n        if <(dist) < [0]> then\n            set [_i1 v] to ((_nearNegDist) + (PLAYER_SIZE_H))\n            change [_nearposdist v] by ((-1) * (_i1))\n            change [playerx v] by (_i1)\n            if <(_nearNegID) > [0]> then\n                _touchPlatformX (_nearNegID) [-1] (dist)\n            end\n            if <(_nearPosDist) < (PLAYER_SIZE_H)> then\n                change [playerx v] by ((_nearPosDist) - (PLAYER_SIZE_H))\n                _touchPlatformX (_nearPosID) [1] (dist)\n            end\n        end\n    end\nend\n\ndefine _moveZ (dist)\nset [movesize v] to (PLAYER_SIZE_H)\n_findNearestQuads (dist) [1] [2] [3] <[0] = [0]> ((-1) * ((PLAYER_SIZE_H) - (1e-5))) ((PLAYER_SIZE_H) - (1e-5)) ((-1) * ((PLAYER_SIZE_V) - (1e-5))) ((PLAYER_SIZE_V) - (1e-5))\nif <<((_nearPosDist) - (_nearNegDist)) < ((2) * (PLAYER_SIZE_H))> and <<(_nearNegID) > [0]> and <(_nearPosID) > [0]>>> then\n    change [playerz v] by (((_nearPosDist) + (_nearNegDist)) / (2))\n    _touchPlatformZ (_nearPosID) [0] (dist)\n    _touchPlatformZ (_nearNegID) [0] (dist)\nelse\n    if <(dist) > [0]> then\n        set [_i1 v] to ((_nearPosDist) - (PLAYER_SIZE_H))\n        change [_nearnegdist v] by ((-1) * (_i1))\n        change [playerz v] by (_i1)\n        if <(_nearPosID) > [0]> then\n            _touchPlatformZ (_nearPosID) [1] (dist)\n        end\n        if <(_nearNegDist) > ((-1) * (PLAYER_SIZE_H))> then\n            change [playerz v] by ((_nearNegDist) + (PLAYER_SIZE_H))\n            _touchPlatformZ (_nearNegID) [-1] (dist)\n        end\n    else\n        if <(dist) < [0]> then\n            set [_i1 v] to ((_nearNegDist) + (PLAYER_SIZE_H))\n            change [_nearposdist v] by ((-1) * (_i1))\n            change [playerz v] by (_i1)\n            if <(_nearNegID) > [0]> then\n                _touchPlatformZ (_nearNegID) [-1] (dist)\n            end\n            if <(_nearPosDist) < (PLAYER_SIZE_H)> then\n                change [playerz v] by ((_nearPosDist) - (PLAYER_SIZE_H))\n                _touchPlatformZ (_nearPosID) [1] (dist)\n            end\n        end\n    end\nend\n\ndefine _findNearestQuads (dist) (1) (2) (3) <minslope> (xmin) (xmax) (ymin) (ymax)\nif <(dist) < [0]> then\n    set [_nearnegdist v] to ((round ((1e8) * ((dist) - (moveSize)))) / (1e8))\nelse\n    set [_nearnegdist v] to [-1e9]\nend\nset [_nearnegid v] to [0]\nif <(dist) > [0]> then\n    set [_nearposdist v] to ((round ((1e8) * ((dist) + (moveSize)))) / (1e8))\nelse\n    set [_nearposdist v] to [1e9]\nend\nset [_nearposid v] to [0]\nset [_i0 v] to [1]\nrepeat (length of [_currentquads v])\n    set [_i1 v] to (item (_i0) of [_currentquads v])\n    delete all of [_clip v]\n    set [_i2 v] to (((4) * (_i1)) - (3))\n    if <(item (_i2) of [3dquadmovement v]) = [_]> then\n        set [_rotatedx v] to [0]\n        set [_rotatedy v] to [0]\n        set [_rotatedz v] to [0]\n    else\n        set [_i3 v] to ((((frame) + ((frameSub) / (PHYSICS_STEPS))) mod ((2) * (item (_i2) of [3dquadmovement v]))) / (item (_i2) of [3dquadmovement v]))\n        if <(_i3) > [1]> then\n            set [_i3 v] to ((2) - (_i3))\n        end\n        set [_rotatedx v] to ((_i3) * (item ((_i2) + (1)) of [3dquadmovement v]))\n        set [_rotatedy v] to ((_i3) * (item ((_i2) + (2)) of [3dquadmovement v]))\n        set [_rotatedz v] to ((_i3) * (item ((_i2) + (3)) of [3dquadmovement v]))\n    end\n    repeat (4)\n        set [_i3 v] to (length of [_clip v])\n        if <not <(item (_i2) of [3dquadx v]) = [_]>> then\n            add [] to [_clip v]\n            add [] to [_clip v]\n            add [] to [_clip v]\n            replace item ((_i3) + (1)) of [_clip v] with (((item (_i2) of [3dquadx v]) + (_rotatedX)) - (playerX))\n            replace item ((_i3) + (2)) of [_clip v] with (((item (_i2) of [3dquady v]) + (_rotatedY)) - (playerY))\n            replace item ((_i3) + (3)) of [_clip v] with (((item (_i2) of [3dquadz v]) + (_rotatedZ)) - (playerZ))\n        end\n        change [_i2 v] by (1)\n    end\n    _quadFindNearest (_i1) (xmin) (xmax) (ymin) (ymax) <minslope>\n    change [_i0 v] by (1)\nend\n\ndefine _touchPlatformY (id) (dir) (dist)\nif <not <(id) > [0]>> then\n    stop [this script v]\nend\nif <not <(item (((4) * (id)) - (3)) of [3dquadmovement v]) = [_]>> then\n    if <(PHYSICS_GRAVITY) < [0]> then\n        if <<(dir) < [0]> or <(item (item (id) of [3dquadtype v]) of [platform_types v]) = [sticky]>> then\n            set [_i2 v] to (((4) * (id)) - (3))\n            set [_i3 v] to ((((frame) + ((frameSub) / (PHYSICS_STEPS))) mod ((2) * (item (_i2) of [3dquadmovement v]))) / (item (_i2) of [3dquadmovement v]))\n            if <(_i3) > [1]> then\n                set [_i3 v] to ((2) - (_i3))\n            end\n            set [_rotatedx v] to ((_i3) * (item ((_i2) + (1)) of [3dquadmovement v]))\n            set [_rotatedy v] to ((_i3) * (item ((_i2) + (2)) of [3dquadmovement v]))\n            set [_rotatedz v] to ((_i3) * (item ((_i2) + (3)) of [3dquadmovement v]))\n            set [_i3 v] to ((((frame) + (((frameSub) + (1)) / (PHYSICS_STEPS))) mod ((2) * (item (_i2) of [3dquadmovement v]))) / (item (_i2) of [3dquadmovement v]))\n            if <(_i3) > [1]> then\n                set [_i3 v] to ((2) - (_i3))\n            end\n            set [_platmovex v] to ((PHYSICS_STEPS) * (((_i3) * (item ((_i2) + (1)) of [3dquadmovement v])) - (_rotatedX)))\n            set [_platmovey v] to ((PHYSICS_STEPS) * ((((_i3) * (item ((_i2) + (2)) of [3dquadmovement v])) - (_rotatedY)) - (1e-5)))\n            set [_platmovez v] to ((PHYSICS_STEPS) * (((_i3) * (item ((_i2) + (3)) of [3dquadmovement v])) - (_rotatedZ)))\n            set [playermovingplattime v] to [5]\n            set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n            set [playervely v] to [0]\n        end\n    else\n        if <<(dir) > [0]> or <(item (item (id) of [3dquadtype v]) of [platform_types v]) = [sticky]>> then\n            set [_i2 v] to (((4) * (id)) - (3))\n            set [_i3 v] to ((((frame) + ((frameSub) / (PHYSICS_STEPS))) mod ((2) * (item (_i2) of [3dquadmovement v]))) / (item (_i2) of [3dquadmovement v]))\n            if <(_i3) > [1]> then\n                set [_i3 v] to ((2) - (_i3))\n            end\n            set [_rotatedx v] to ((_i3) * (item ((_i2) + (1)) of [3dquadmovement v]))\n            set [_rotatedy v] to ((_i3) * (item ((_i2) + (2)) of [3dquadmovement v]))\n            set [_rotatedz v] to ((_i3) * (item ((_i2) + (3)) of [3dquadmovement v]))\n            set [_i3 v] to ((((frame) + (((frameSub) + (1)) / (PHYSICS_STEPS))) mod ((2) * (item (_i2) of [3dquadmovement v]))) / (item (_i2) of [3dquadmovement v]))\n            if <(_i3) > [1]> then\n                set [_i3 v] to ((2) - (_i3))\n            end\n            set [_platmovex v] to ((PHYSICS_STEPS) * (((_i3) * (item ((_i2) + (1)) of [3dquadmovement v])) - (_rotatedX)))\n            set [_platmovey v] to ((PHYSICS_STEPS) * ((((_i3) * (item ((_i2) + (2)) of [3dquadmovement v])) - (_rotatedY)) + (1e-5)))\n            set [_platmovez v] to ((PHYSICS_STEPS) * (((_i3) * (item ((_i2) + (3)) of [3dquadmovement v])) - (_rotatedZ)))\n            set [playermovingplattime v] to [5]\n            set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n            set [playervely v] to [0]\n        end\n    end\nend\nset [_i1 v] to (item ((4) * (id)) of [3dquadslope v])\nif <<not <(dir) = [0]>> and <<(_i1) > [1.2]> and <(_i1) < [1e8]>>> then\n    if <(PHYSICS_GRAVITY) < [0]> then\n        set [_i1 v] to (item (((4) * (id)) - (3)) of [3dquadslope v])\n        if <<([abs v] of (_i1) ) > [0.8]> and <([abs v] of (_i1) ) < [1e8]>> then\n            change [playervelx v] by ((((-1) * (PHYSICS_SLIPPERINESS)) * ((([sqrt v] of (((playerVelY) * (playerVelY)) + (36)) ) * ([sqrt v] of ((((1) / (_i1)) * ((1) / (_i1))) + (1)) )) / (_i1))) / (PHYSICS_STEPS))\n        end\n        set [_i1 v] to (item (((4) * (id)) - (1)) of [3dquadslope v])\n        if <<([abs v] of (_i1) ) > [0.8]> and <([abs v] of (_i1) ) < [1e8]>> then\n            change [playervelz v] by ((((-1) * (PHYSICS_SLIPPERINESS)) * ((([sqrt v] of (((playerVelY) * (playerVelY)) + (36)) ) * ([sqrt v] of ((((1) / (_i1)) * ((1) / (_i1))) + (1)) )) / (_i1))) / (PHYSICS_STEPS))\n        end\n    else\n        set [_i1 v] to (item (((4) * (id)) - (3)) of [3dquadslope v])\n        if <<([abs v] of (_i1) ) > [0.8]> and <([abs v] of (_i1) ) < [1e8]>> then\n            change [playervelx v] by (((PHYSICS_SLIPPERINESS) * ((([sqrt v] of (((playerVelY) * (playerVelY)) + (36)) ) * ([sqrt v] of ((((1) / (_i1)) * ((1) / (_i1))) + (1)) )) / (_i1))) / (PHYSICS_STEPS))\n        end\n        set [_i1 v] to (item (((4) * (id)) - (1)) of [3dquadslope v])\n        if <<([abs v] of (_i1) ) > [0.8]> and <([abs v] of (_i1) ) < [1e8]>> then\n            change [playervelz v] by (((PHYSICS_SLIPPERINESS) * ((([sqrt v] of (((playerVelY) * (playerVelY)) + (36)) ) * ([sqrt v] of ((((1) / (_i1)) * ((1) / (_i1))) + (1)) )) / (_i1))) / (PHYSICS_STEPS))\n        end\n    end\n    set [playerjumptime v] to [-1]\nend\nset [playervely v] to [0]\nset [_i1 v] to (item (item (id) of [3dquadtype v]) of [platform_types v])\nif <(_i1) = [regular]> then\n    Start Sound [bumpY]\nelse\n    if <(_i1) = [sticky]> then\n        if <(dir) > [0]> then\n            set [isstuck v] to [1e-3]\n            Start Sound [sticky]\n        else\n            set [isstuck v] to [-1e-3]\n            Start Sound [sticky]\n        end\n    else\n        if <(_i1) = [bounce]> then\n            if <(dir) > [0]> then\n                set [playervely v] to ((-1) * (PHYSICS_BOUNCE))\n                Start Sound [bounce]\n            else\n                if <(dir) < [0]> then\n                    set [playervely v] to (PHYSICS_BOUNCE)\n                    Start Sound [bounce]\n                end\n            end\n        else\n            if <(_i1) = [flip]> then\n                if <(playerGravityFlipTime) < [-1e-3]> then\n                    _flipGravity\n                end\n            else\n                if <(_i1) = [checkpoint]> then\n                    if <(playerJumpTime) = (PLAYER_COYOTE_TIME)> then\n                        Set Checkpoint (playerX) (playerY) (playerZ) (playerRotation) (3DCamRotX) (PHYSICS_GRAVITY) (frame)\n                        Start Sound [checkpoint]\n                    end\n                else\n                    if <(_i1) = [goal]> then\n                        set [levelwon v] to [true]\n                    else\n                        if <(_i1) = [fire]> then\n                            if <(dir) > [0]> then\n                                set [playervely v] to ((-1) * (PHYSICS_FIRE_BOUNCE))\n                            else\n                                if <(dir) < [0]> then\n                                    set [playervely v] to (PHYSICS_FIRE_BOUNCE)\n                                end\n                            end\n                            if <(playerFire) < ((PLAYER_FIRE_TIME) - (6))> then\n                                if <(playerFire) > [-1e-3]> then\n                                    set [isdead v] to [true]\n                                else\n                                    Start Sound [fire]\n                                end\n                                set [playerfire v] to (PLAYER_FIRE_TIME)\n                            end\n                        else\n                            if <(_i1) = [hazard]> then\n                                set [isdead v] to [true]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <(dir) = [0]> then\n    set [playervely v] to [0]\nend\n\ndefine _touchPlatformX (id) (dir) (dist)\nif <not <(id) > [0]>> then\n    stop [this script v]\nend\nset [_i1 v] to (item ((4) * (id)) of [3dquadslope v])\nset [isslope v] to [false]\nif <<(_i1) > [0]> and <(_i1) < [0.9]>> then\n    set [_i1 v] to (item (((4) * (id)) - (3)) of [3dquadslope v])\n    if <<([abs v] of (_i1) ) > [0]> and <([abs v] of (_i1) ) < [0.9]>> then\n        if <(PHYSICS_GRAVITY) < [0]> then\n            if <<(dir) > [0]> and <(_i1) > [0]>> then\n                change [slopevely v] by ((PHYSICS_STEPS) * ((_i1) * (dist)))\n                set [isslope v] to [true]\n            else\n                if <<(dir) < [0]> and <(_i1) < [0]>> then\n                    change [slopevely v] by ((PHYSICS_STEPS) * ((_i1) * (dist)))\n                    set [isslope v] to [true]\n                end\n            end\n        else\n            if <<(dir) > [0]> and <(_i1) < [0]>> then\n                change [slopevely v] by ((PHYSICS_STEPS) * ((_i1) * (dist)))\n                set [isslope v] to [true]\n            else\n                if <<(dir) < [0]> and <(_i1) > [0]>> then\n                    change [slopevely v] by ((PHYSICS_STEPS) * ((_i1) * (dist)))\n                    set [isslope v] to [true]\n                end\n            end\n        end\n    end\nend\nif <(isSlope) = [true]> then\n    set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n    set [playervely v] to [0]\nelse\n    set [playervelx v] to [0]\nend\nset [_i1 v] to (item (item (id) of [3dquadtype v]) of [platform_types v])\nif <(_i1) = [regular]> then\n    Start Sound [bumpX]\nelse\n    if <(_i1) = [bounce]> then\n        if <(dir) > [0]> then\n            set [playervelx v] to ((-2.25) * (PHYSICS_BOUNCE))\n            Start Sound [bounce]\n        else\n            if <(dir) < [0]> then\n                set [playervelx v] to ((2.25) * (PHYSICS_BOUNCE))\n                Start Sound [bounce]\n            end\n        end\n    else\n        if <(_i1) = [flip]> then\n            if <(playerGravityFlipTime) < [-1e-3]> then\n                _flipGravity\n            end\n        else\n            if <(_i1) = [checkpoint]> then\n                if <(playerJumpTime) = (PLAYER_COYOTE_TIME)> then\n                    Set Checkpoint (playerX) (playerY) (playerZ) (playerRotation) (3DCamRotX) (PHYSICS_GRAVITY) (frame)\n                    Start Sound [checkpoint]\n                end\n            else\n                if <(_i1) = [goal]> then\n                    set [levelwon v] to [true]\n                else\n                    if <(_i1) = [fire]> then\n                        if <(dir) > [0]> then\n                            set [playervelx v] to ((-1.75) * (PHYSICS_FIRE_BOUNCE))\n                        else\n                            if <(dir) < [0]> then\n                                set [playervelx v] to ((1.75) * (PHYSICS_FIRE_BOUNCE))\n                            end\n                        end\n                        if <(playerFire) < ((PLAYER_FIRE_TIME) - (6))> then\n                            if <(playerFire) > [-1e-3]> then\n                                set [isdead v] to [true]\n                            else\n                                Start Sound [fire]\n                            end\n                            set [playerfire v] to (PLAYER_FIRE_TIME)\n                        end\n                    else\n                        if <(_i1) = [hazard]> then\n                            set [isdead v] to [true]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <(dir) = [0]> then\n    set [playervelx v] to [0]\nend\n\ndefine _touchPlatformZ (id) (dir) (dist)\nif <not <(id) > [0]>> then\n    stop [this script v]\nend\nset [_i1 v] to (item ((4) * (id)) of [3dquadslope v])\nset [isslope v] to [false]\nif <<(_i1) > [0]> and <(_i1) < [0.9]>> then\n    set [_i1 v] to (item (((4) * (id)) - (1)) of [3dquadslope v])\n    if <<([abs v] of (_i1) ) > [0]> and <([abs v] of (_i1) ) < [0.9]>> then\n        if <(PHYSICS_GRAVITY) < [0]> then\n            if <<(dir) > [0]> and <(_i1) > [0]>> then\n                change [slopevely v] by ((PHYSICS_STEPS) * ((_i1) * (dist)))\n                set [isslope v] to [true]\n            else\n                if <<(dir) < [0]> and <(_i1) < [0]>> then\n                    change [slopevely v] by ((PHYSICS_STEPS) * ((_i1) * (dist)))\n                    set [isslope v] to [true]\n                end\n            end\n        else\n            if <<(dir) > [0]> and <(_i1) < [0]>> then\n                change [slopevely v] by ((PHYSICS_STEPS) * ((_i1) * (dist)))\n                set [isslope v] to [true]\n            else\n                if <<(dir) < [0]> and <(_i1) > [0]>> then\n                    change [slopevely v] by ((PHYSICS_STEPS) * ((_i1) * (dist)))\n                    set [isslope v] to [true]\n                end\n            end\n        end\n    end\nend\nif <(isSlope) = [true]> then\n    set [playerjumptime v] to (PLAYER_COYOTE_TIME)\n    set [playervely v] to [0]\nelse\n    set [playervelz v] to [0]\nend\nset [_i1 v] to (item (item (id) of [3dquadtype v]) of [platform_types v])\nif <(_i1) = [regular]> then\n    Start Sound [bumpZ]\nelse\n    if <(_i1) = [bounce]> then\n        if <(dir) > [0]> then\n            set [playervelz v] to ((-2.25) * (PHYSICS_BOUNCE))\n            Start Sound [bounce]\n        else\n            if <(dir) < [0]> then\n                set [playervelz v] to ((2.25) * (PHYSICS_BOUNCE))\n                Start Sound [bounce]\n            end\n        end\n    else\n        if <(_i1) = [flip]> then\n            if <(playerGravityFlipTime) < [-1e-3]> then\n                _flipGravity\n            end\n        else\n            if <(_i1) = [checkpoint]> then\n                if <(playerJumpTime) = (PLAYER_COYOTE_TIME)> then\n                    Set Checkpoint (playerX) (playerY) (playerZ) (playerRotation) (3DCamRotX) (PHYSICS_GRAVITY) (frame)\n                    Start Sound [checkpoint]\n                end\n            else\n                if <(_i1) = [goal]> then\n                    set [levelwon v] to [true]\n                else\n                    if <(_i1) = [fire]> then\n                        if <(dir) > [0]> then\n                            set [playervelz v] to ((-1.75) * (PHYSICS_FIRE_BOUNCE))\n                        else\n                            if <(dir) < [0]> then\n                                set [playervelz v] to ((1.75) * (PHYSICS_FIRE_BOUNCE))\n                            end\n                        end\n                        if <(playerFire) < ((PLAYER_FIRE_TIME) - (6))> then\n                            if <(playerFire) > [-1e-3]> then\n                                set [isdead v] to [true]\n                            else\n                                Start Sound [fire]\n                            end\n                            set [playerfire v] to (PLAYER_FIRE_TIME)\n                        end\n                    else\n                        if <(_i1) = [hazard]> then\n                            set [isdead v] to [true]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <(dir) = [0]> then\n    set [playervelz v] to [0]\nend\n\ndefine Set Checkpoint (x) (y) (z) (rot) (xrot) (gravity) (frame)\nif <(length of [locationcheckpoint v]) = [7]> then\n    replace item (1) of [locationcheckpoint v] with (x)\n    replace item (2) of [locationcheckpoint v] with (y)\n    replace item (3) of [locationcheckpoint v] with (z)\n    replace item (4) of [locationcheckpoint v] with ((1) * (rot))\n    replace item (5) of [locationcheckpoint v] with ((1) * (xrot))\n    replace item (6) of [locationcheckpoint v] with (gravity)\n    replace item (7) of [locationcheckpoint v] with (frame)\nelse\n    delete all of [locationcheckpoint v]\n    add (x) to [locationcheckpoint v]\n    add (y) to [locationcheckpoint v]\n    add (z) to [locationcheckpoint v]\n    add ((1) * (rot)) to [locationcheckpoint v]\n    add ((1) * (xrot)) to [locationcheckpoint v]\n    add (gravity) to [locationcheckpoint v]\n    add (frame) to [locationcheckpoint v]\nend\n\ndefine Update Text Position\nreplace item (1) of [textareas v] with (playerX)\nreplace item (2) of [textareas v] with (playerY)\nreplace item (3) of [textareas v] with (playerZ)\n\ndefine reset sounds\ndelete all of [_currentsounds v]\nrepeat ((length of [sounds v]) / (2))\n    add [false] to [_currentsounds v]\n    add [-1] to [_currentsounds v]\nend\n\ndefine Update Sound\nset [_i0 v] to [1]\nrepeat ((length of [_currentsounds v]) / (2))\n    if <(item (_i0) of [_currentsounds v]) = [true]> then\n        replace item (_i0) of [_currentsounds v] with [false]\n        if <(item ((_i0) + (1)) of [_currentsounds v]) < [-1e-3]> then\n            start sound (item (_i0) of [sounds v])\n        end\n        replace item ((_i0) + (1)) of [_currentsounds v] with (item ((_i0) + (1)) of [sounds v])\n    else\n        replace item ((_i0) + (1)) of [_currentsounds v] with ((item ((_i0) + (1)) of [_currentsounds v]) - ((1) / (FrameMultiplier)))\n    end\n    change [_i0 v] by (2)\nend\n\ndefine Start Sound (sound)\nreplace item (item # of (join [_] (sound)) in [sounds v]) of [_currentsounds v] with [true]\n\ndefine _flipGravity\nset [physics_gravity v] to ((-1) * (PHYSICS_GRAVITY))\nset [playergravityfliptime v] to [30]\nStart Sound [gravityFlip]\n\nwhen I receive [editormovement v]\nif <not <(LoopTask) = [none]>> then\n    wait until <(LoopTask) = [none]>\nend\nset [looptask v] to [editorMovement]\nupdate FrameMultiplier\nset [physics_gravity v] to [-1]\nset [player_size_h v] to [0]\nset [player_size_v v] to [0]\nset [frame v] to [0]\nEditor Movement <key ((item (1) of [controls v]) v) pressed?> <key ((item (2) of [controls v]) v) pressed?> <key ((item (4) of [controls v]) v) pressed?> <key ((item (3) of [controls v]) v) pressed?> <key (up arrow v) pressed?> <key (down arrow v) pressed?> <key (right arrow v) pressed?> <key (left arrow v) pressed?> <key (q v) pressed?> <key (e v) pressed?>\nUpdate Camera\nset [playerfire v] to [-100]\nset [textindex v] to [0]\nset [lastupdate v] to (days since 2000)\nset [looptask v] to [none]\n\ndefine Editor Movement <forward> <backward> <right> <left> <lookup> <lookdown> <lookright> <lookleft> <up> <down>\nif <<lookup> or <<key (space v) pressed?> and <forward>>> then\n    change [playerrotx v] by ((5) / (FrameMultiplier))\nend\nif <<lookdown> or <<key (space v) pressed?> and <backward>>> then\n    change [playerrotx v] by ((-5) / (FrameMultiplier))\nend\nif <(playerRotX) > [90]> then\n    set [playerrotx v] to [90]\nelse\n    if <(playerRotX) < [-90]> then\n        set [playerrotx v] to [-90]\n    end\nend\nif <<lookright> or <<key (space v) pressed?> and <right>>> then\n    if <(PHYSICS_GRAVITY) < [0]> then\n        change [playerrotation v] by ((5) / (FrameMultiplier))\n    else\n        change [playerrotation v] by ((-5) / (FrameMultiplier))\n    end\nend\nif <<lookleft> or <<key (space v) pressed?> and <left>>> then\n    if <(PHYSICS_GRAVITY) < [0]> then\n        change [playerrotation v] by ((-5) / (FrameMultiplier))\n    else\n        change [playerrotation v] by ((5) / (FrameMultiplier))\n    end\nend\nset [playerrotation v] to ((playerRotation) mod (360))\nif <not <key (space v) pressed?>> then\n    if <forward> then\n        if <key (f v) pressed?> then\n            change [playerz v] by (((10) / (30)) / (FrameMultiplier))\n        else\n            change [playerz v] by (((6) * ([cos v] of (playerRotation) )) / (FrameMultiplier))\n            change [playerx v] by (((6) * ([sin v] of (playerRotation) )) / (FrameMultiplier))\n        end\n    end\n    if <backward> then\n        if <key (f v) pressed?> then\n            change [playerz v] by (((-10) / (30)) / (FrameMultiplier))\n        else\n            change [playerz v] by (((-6) * ([cos v] of (playerRotation) )) / (FrameMultiplier))\n            change [playerx v] by (((-6) * ([sin v] of (playerRotation) )) / (FrameMultiplier))\n        end\n    end\n    if <right> then\n        if <key (f v) pressed?> then\n            change [playerx v] by (((10) / (30)) / (FrameMultiplier))\n        else\n            if <(PHYSICS_GRAVITY) < [0]> then\n                change [playerx v] by (((6) * ([cos v] of (playerRotation) )) / (FrameMultiplier))\n                change [playerz v] by (((-6) * ([sin v] of (playerRotation) )) / (FrameMultiplier))\n            else\n                change [playerx v] by (((-6) * ([cos v] of (playerRotation) )) / (FrameMultiplier))\n                change [playerz v] by (((6) * ([sin v] of (playerRotation) )) / (FrameMultiplier))\n            end\n        end\n    end\n    if <left> then\n        if <key (f v) pressed?> then\n            change [playerx v] by (((-10) / (30)) / (FrameMultiplier))\n        else\n            if <(PHYSICS_GRAVITY) < [0]> then\n                change [playerx v] by (((-6) * ([cos v] of (playerRotation) )) / (FrameMultiplier))\n                change [playerz v] by (((6) * ([sin v] of (playerRotation) )) / (FrameMultiplier))\n            else\n                change [playerx v] by (((6) * ([cos v] of (playerRotation) )) / (FrameMultiplier))\n                change [playerz v] by (((-6) * ([sin v] of (playerRotation) )) / (FrameMultiplier))\n            end\n        end\n    end\nend\nif <up> then\n    if <key (f v) pressed?> then\n        change [playery v] by (((10) / (30)) / (FrameMultiplier))\n    else\n        if <(PHYSICS_GRAVITY) < [0]> then\n            change [playery v] by ((6) / (FrameMultiplier))\n        else\n            change [playery v] by ((-6) / (FrameMultiplier))\n        end\n    end\nend\nif <down> then\n    if <key (f v) pressed?> then\n        change [playery v] by (((-10) / (30)) / (FrameMultiplier))\n    else\n        if <(PHYSICS_GRAVITY) < [0]> then\n            change [playery v] by ((-6) / (FrameMultiplier))\n        else\n            change [playery v] by ((6) / (FrameMultiplier))\n        end\n    end\nend\n\ndefine update FrameMultiplier\nset [lastupdateelapsed v] to ((round ((86400000) * ((days since 2000) - (lastUpdate)))) / (1000))\nset [lastupdate v] to (days since 2000)\nif <(lastUpdateElapsed) < ((1) / (10))> then\n    if <(lastUpdateElapsed) < ((1) / (20))> then\n        if <(lastUpdateElapsed) < ((1) / (50))> then\n            if <(lastUpdateElapsed) < ((1) / (100))> then\n                set [framemultiplier v] to [4]\n            else\n                set [framemultiplier v] to [2]\n            end\n        else\n            set [framemultiplier v] to [1]\n        end\n    else\n        set [framemultiplier v] to [0.5]\n    end\nelse\n    set [framemultiplier v] to [0.25]\nend\n\n@Graphics\n\ndefine _sortAndRenderOrderEqual (lo) (hi)\nif <(hi) > (lo)> then\n    set [_sort0 v] to (lo)\n    repeat ((hi) - ((lo) - (1)))\n        set [_sort1 v] to ((4) * (item (_sort0) of [_orderequal v]))\n        if <(item (_sort1) of [_qdz v]) = [_]> then\n            replace item (_sort0) of [_orderequaldepth v] with ((((1) / (item ((_sort1) - (3)) of [_qdz v])) + (((1) / (item ((_sort1) - (2)) of [_qdz v])) + ((1) / (item ((_sort1) - (1)) of [_qdz v])))) / (-3))\n        else\n            replace item (_sort0) of [_orderequaldepth v] with (((((1) / (item ((_sort1) - (3)) of [_qdz v])) + ((1) / (item ((_sort1) - (2)) of [_qdz v]))) + (((1) / (item ((_sort1) - (1)) of [_qdz v])) + ((1) / (item (_sort1) of [_qdz v])))) / (-4))\n        end\n        change [_sort0 v] by (1)\n    end\n    _sort (lo) (hi)\nend\nset [_sort0 v] to (lo)\nrepeat ((hi) - ((lo) - (1)))\n    _drawQuad (item (_sort0) of [_orderequal v])\n    change [_sort0 v] by (1)\nend\n\nwhen flag clicked\nhide\nswitch costume to (small v)\nset size to (100000) %\nswitch costume to (large v)\npoint in direction (90)\nset rotation style [don't rotate v]\n\ndefine Render 3D\nGet Quads (3DCamX) (3DCamY) (3DCamZ) ((-1) * (3DCamRotX)) ((-1) * (3DCamRotY)) ((-1) * (3DCamRotZ)) (3DCamFOV) (3DCamNearZ) (3DCamFarZ) (3DLightAmbientLevel) ((3DLightSourceLevel) / (90)) (3DScreenWidth)\npen up\nset pen color to (3DSkyColor)\nset pen size to (182)\ngo to x: (-400) y: (-90)\nif <not <(TextIndex) = [0]>> then\n    change y by ((TEXTBOX_Y) - (180))\nend\npen down\nset x to (400)\nchange y by (180)\nset x to (-400)\nchange y by (-180)\npen up\nRender Quads <not <(3DSortMethod) = [fast]>>\nif <(playerFire) > [-20]> then\n    set pen size to (152)\n    set pen color to (item (7) of [platform_colors v])\n    set pen (transparency v) to ((100) - ((100) * (((playerFire) + (20)) / (120))))\n    go to x: (-600) y: (-105)\n    pen down\n    set x to (600)\n    pen up\nend\nif <not <(TextIndex) = [0]>> then\n    set pen size to (4)\n    set pen color to ((31) + ((256) * ((31) + ((256) * (31)))))\n    set pen (transparency v) to (0)\n    go to x: (-400) y: (TEXTBOX_Y)\n    pen down\n    set x to (400)\n    pen up\nend\n\ndefine _copyTmpToQd\ndelete all of [_qdx v]\nset [_i0 v] to [1]\nrepeat (length of [_tmpx v])\n    add (item (_i0) of [_tmpx v]) to [_qdx v]\n    change [_i0 v] by (1)\nend\ndelete all of [_qdy v]\nset [_i0 v] to [1]\nrepeat (length of [_tmpy v])\n    add (item (_i0) of [_tmpy v]) to [_qdy v]\n    change [_i0 v] by (1)\nend\ndelete all of [_qdz v]\nset [_i0 v] to [1]\nrepeat (length of [_tmpz v])\n    add (item (_i0) of [_tmpz v]) to [_qdz v]\n    change [_i0 v] by (1)\nend\ndelete all of [_qdparent v]\nset [_i0 v] to [1]\nrepeat (length of [_tmpparent v])\n    add (item (_i0) of [_tmpparent v]) to [_qdparent v]\n    change [_i0 v] by (1)\nend\n\ndefine Render Quads <highquality>\nif <highquality> then\n    delete all of [_orderbehind v]\n    delete all of [_orderahead v]\n    delete all of [_orderequal v]\n    delete all of [_orderequaldepth v]\n    set [_i0 v] to [1]\n    repeat (length of [_qdparent v])\n        add (_i0) to [_orderbehind v]\n        change [_i0 v] by (1)\n    end\n    set [_trisrendered v] to [0]\n    _bspBehind [1] [1] (length of [_orderbehind v]) (length of [_orderahead v]) (length of [_orderequal v])\nelse\n    delete all of [_orderequal v]\n    delete all of [_orderequaldepth v]\n    set [_i0 v] to [1]\n    repeat (length of [_qdparent v])\n        add (_i0) to [_orderequal v]\n        add [] to [_orderequaldepth v]\n        change [_i0 v] by (1)\n    end\n    set [_trisrendered v] to [0]\n    _sortAndRenderOrderEqual [1] (length of [_orderequal v])\nend\n\ndefine Rotate Point (x) (y) (z) Angle (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\nset [_rot0 v] to (((cosy) * (x)) + ((siny) * (z)))\nset [_rotatedz v] to (((cosy) * (z)) - ((siny) * (x)))\nset [_rotatedy v] to (((cosx) * (y)) + ((sinx) * (_rotatedZ)))\nset [_rotatedz v] to (((cosx) * (_rotatedZ)) - ((sinx) * (y)))\nset [_rotatedx v] to (((cosz) * (_rot0)) + ((sinz) * (_rotatedY)))\nset [_rotatedy v] to (((cosz) * (_rotatedY)) - ((sinz) * (_rot0)))\n\ndefine _getPlaneOfTri (x0) (y0) (z0) (x1) (y1) (z1) (x2) (y2) (z2)\nset [_planetype v] to [perp]\nif <<([abs v] of ((x0) - (x1)) ) < [1e-7]> and <([abs v] of ((x1) - (x2)) ) < [1e-7]>> then\n    stop [this script v]\nend\nif <<([abs v] of ((y0) - (y1)) ) < [1e-7]> and <([abs v] of ((y1) - (y2)) ) < [1e-7]>> then\n    stop [this script v]\nend\nif <([abs v] of ((((x2) - (x0)) / ((x1) - (x0))) - (((y2) - (y0)) / ((y1) - (y0)))) ) < [1e-7]> then\n    stop [this script v]\nend\nset [_planetype v] to [regular]\nset [_sys0 v] to ((round ((134217728) * ((x1) - (x0)))) / (134217728))\nset [_sys1 v] to ((round ((134217728) * ((y1) - (y0)))) / (134217728))\nset [_sys2 v] to ((round ((134217728) * ((z1) - (z0)))) / (134217728))\nset [_sys3 v] to ((round ((134217728) * ((x2) - (x0)))) / (134217728))\nset [_sys4 v] to ((round ((134217728) * ((y2) - (y0)))) / (134217728))\nset [_sys5 v] to ((round ((134217728) * ((z2) - (z0)))) / (134217728))\nif <<(_sys0) = [0]> or <(_sys3) = [0]>> then\n    if <(_sys0) = [0]> then\n        set [_planeyslope v] to ((_sys2) / (_sys1))\n        set [_planexslope v] to (((_sys5) - ((_planeYSlope) * (_sys4))) / (_sys3))\n    else\n        set [_planeyslope v] to ((_sys5) / (_sys4))\n        set [_planexslope v] to (((_sys2) - ((_planeYSlope) * (_sys1))) / (_sys0))\n    end\nelse\n    set [_planeorigin v] to ((-1) * ((_sys0) / (_sys3)))\n    set [_sys3 v] to ((_planeOrigin) * (_sys3))\n    set [_sys4 v] to ((_planeOrigin) * (_sys4))\n    set [_sys5 v] to ((_planeOrigin) * (_sys5))\n    set [_planeyslope v] to (((_sys2) + (_sys5)) / ((_sys1) + (_sys4)))\n    set [_planexslope v] to (((_sys2) - ((_planeYSlope) * (_sys1))) / (_sys0))\nend\nset [_planeorigin v] to ((z0) - (((_planeXSlope) * (x0)) + ((_planeYSlope) * (y0))))\n\ndefine _splitQuad (x0) (y0) (z0) (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) (id)\nset [_tri0 v] to ((z0) - ((_planeOrigin) + (((_planeXSlope) * (x0)) + ((_planeYSlope) * (y0)))))\nif <([abs v] of (_tri0) ) < [1e-6]> then\n    set [_tri0 v] to [0]\nend\nset [_tri1 v] to ((z1) - ((_planeOrigin) + (((_planeXSlope) * (x1)) + ((_planeYSlope) * (y1)))))\nif <([abs v] of (_tri1) ) < [1e-6]> then\n    set [_tri1 v] to [0]\nend\nset [_tri2 v] to ((z2) - ((_planeOrigin) + (((_planeXSlope) * (x2)) + ((_planeYSlope) * (y2)))))\nif <([abs v] of (_tri2) ) < [1e-6]> then\n    set [_tri2 v] to [0]\nend\nif <(x3) = [_]> then\n    set [_tri3 v] to [0]\nelse\n    set [_tri3 v] to ((z3) - ((_planeOrigin) + (((_planeXSlope) * (x3)) + ((_planeYSlope) * (y3)))))\n    if <([abs v] of (_tri3) ) < [1e-6]> then\n        set [_tri3 v] to [0]\n    end\nend\nif <<<(_tri0) = [0]> and <(_tri1) = [0]>> and <<(_tri2) = [0]> and <(_tri3) = [0]>>> then\n    add (id) to [_orderequal v]\n    add [] to [_orderequaldepth v]\n    stop [this script v]\nend\nif <not <<<(_tri0) > [0]> or <(_tri1) > [0]>> or <<(_tri2) > [0]> or <(_tri3) > [0]>>>> then\n    add (id) to [_orderbehind v]\n    stop [this script v]\nend\nif <not <<<(_tri0) < [0]> or <(_tri1) < [0]>> or <<(_tri2) < [0]> or <(_tri3) < [0]>>>> then\n    add (id) to [_orderahead v]\n    stop [this script v]\nend\n_splitQuadInternal (x0) (y0) (z0) (_tri0) (x1) (y1) (z1) (_tri1) (x2) (y2) (z2) (_tri2) (x3) (y3) (z3) (_tri3) (id)\n\ndefine _drawQuad (id)\nif <(_trisRendered) < [2000]> then\n    set [_id0 v] to ((4) * (id))\n    set pen color to (item (item (id) of [_qdparent v]) of [_qdcolor v])\n    _fillTri (item ((_id0) - (3)) of [_qdx v]) (item ((_id0) - (3)) of [_qdy v]) (item ((_id0) - (1)) of [_qdx v]) (item ((_id0) - (1)) of [_qdy v]) (item ((_id0) - (2)) of [_qdx v]) (item ((_id0) - (2)) of [_qdy v])\n    if <not <(item (_id0) of [_qdx v]) = [_]>> then\n        _fillTri (item ((_id0) - (3)) of [_qdx v]) (item ((_id0) - (3)) of [_qdy v]) (item ((_id0) - (1)) of [_qdx v]) (item ((_id0) - (1)) of [_qdy v]) (item (_id0) of [_qdx v]) (item (_id0) of [_qdy v])\n    end\nend\n\ndefine _splitQuadInternal (x0) (y0) (z0) (az0) (x1) (y1) (z1) (az1) (x2) (y2) (z2) (az2) (x3) (y3) (z3) (az3) (id)\ndelete all of [_splitbehind v]\ndelete all of [_splitahead v]\nif <not <(az0) > [0]>> then\n    add (x0) to [_splitbehind v]\n    add (y0) to [_splitbehind v]\n    add (z0) to [_splitbehind v]\nend\nif <not <(az0) < [0]>> then\n    add (x0) to [_splitahead v]\n    add (y0) to [_splitahead v]\n    add (z0) to [_splitahead v]\nend\nset [_lerp0 v] to (((0) - (az0)) / ((az1) - (az0)))\nif <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n    add ((((1) - (_lerp0)) * (x0)) + ((_lerp0) * (x1))) to [_splitbehind v]\n    add (item (last) of [_splitbehind v]) to [_splitahead v]\n    add ((((1) - (_lerp0)) * (y0)) + ((_lerp0) * (y1))) to [_splitbehind v]\n    add (item (last) of [_splitbehind v]) to [_splitahead v]\n    add ((((1) - (_lerp0)) * (z0)) + ((_lerp0) * (z1))) to [_splitbehind v]\n    add (item (last) of [_splitbehind v]) to [_splitahead v]\nend\nif <not <(az1) > [0]>> then\n    add (x1) to [_splitbehind v]\n    add (y1) to [_splitbehind v]\n    add (z1) to [_splitbehind v]\nend\nif <not <(az1) < [0]>> then\n    add (x1) to [_splitahead v]\n    add (y1) to [_splitahead v]\n    add (z1) to [_splitahead v]\nend\nset [_lerp0 v] to (((0) - (az1)) / ((az2) - (az1)))\nif <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n    add ((((1) - (_lerp0)) * (x1)) + ((_lerp0) * (x2))) to [_splitbehind v]\n    add (item (last) of [_splitbehind v]) to [_splitahead v]\n    add ((((1) - (_lerp0)) * (y1)) + ((_lerp0) * (y2))) to [_splitbehind v]\n    add (item (last) of [_splitbehind v]) to [_splitahead v]\n    add ((((1) - (_lerp0)) * (z1)) + ((_lerp0) * (z2))) to [_splitbehind v]\n    add (item (last) of [_splitbehind v]) to [_splitahead v]\nend\nif <not <(az2) > [0]>> then\n    add (x2) to [_splitbehind v]\n    add (y2) to [_splitbehind v]\n    add (z2) to [_splitbehind v]\nend\nif <not <(az2) < [0]>> then\n    add (x2) to [_splitahead v]\n    add (y2) to [_splitahead v]\n    add (z2) to [_splitahead v]\nend\nif <(x3) = [_]> then\n    set [_lerp0 v] to (((0) - (az2)) / ((az0) - (az2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add ((((1) - (_lerp0)) * (x2)) + ((_lerp0) * (x0))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n        add ((((1) - (_lerp0)) * (y2)) + ((_lerp0) * (y0))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n        add ((((1) - (_lerp0)) * (z2)) + ((_lerp0) * (z0))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n    end\nelse\n    set [_lerp0 v] to (((0) - (az2)) / ((az3) - (az2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add ((((1) - (_lerp0)) * (x2)) + ((_lerp0) * (x3))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n        add ((((1) - (_lerp0)) * (y2)) + ((_lerp0) * (y3))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n        add ((((1) - (_lerp0)) * (z2)) + ((_lerp0) * (z3))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n    end\n    if <not <(az3) > [0]>> then\n        add (x3) to [_splitbehind v]\n        add (y3) to [_splitbehind v]\n        add (z3) to [_splitbehind v]\n    end\n    if <not <(az3) < [0]>> then\n        add (x3) to [_splitahead v]\n        add (y3) to [_splitahead v]\n        add (z3) to [_splitahead v]\n    end\n    set [_lerp0 v] to (((0) - (az3)) / ((az0) - (az3)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add ((((1) - (_lerp0)) * (x3)) + ((_lerp0) * (x0))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n        add ((((1) - (_lerp0)) * (y3)) + ((_lerp0) * (y0))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n        add ((((1) - (_lerp0)) * (z3)) + ((_lerp0) * (z0))) to [_splitbehind v]\n        add (item (last) of [_splitbehind v]) to [_splitahead v]\n    end\nend\nset [_id0 v] to (item (id) of [_qdparent v])\nif <(length of [_splitbehind v]) > [8]> then\n    set [_tri1 v] to (item (1) of [_splitbehind v])\n    set [_tri2 v] to (item (2) of [_splitbehind v])\n    set [_tri3 v] to (item (3) of [_splitbehind v])\n    set [_tri0 v] to [7]\n    repeat ([floor v] of (((length of [_splitbehind v]) - (6)) / (6)) )\n        add (_tri1) to [_qdx v]\n        add (_tri2) to [_qdy v]\n        add (_tri3) to [_qdz v]\n        add (item ((_tri0) - (3)) of [_splitbehind v]) to [_qdx v]\n        add (item ((_tri0) - (2)) of [_splitbehind v]) to [_qdy v]\n        add (item ((_tri0) - (1)) of [_splitbehind v]) to [_qdz v]\n        add (item (_tri0) of [_splitbehind v]) to [_qdx v]\n        add (item ((_tri0) + (1)) of [_splitbehind v]) to [_qdy v]\n        add (item ((_tri0) + (2)) of [_splitbehind v]) to [_qdz v]\n        add (item ((_tri0) + (3)) of [_splitbehind v]) to [_qdx v]\n        add (item ((_tri0) + (4)) of [_splitbehind v]) to [_qdy v]\n        add (item ((_tri0) + (5)) of [_splitbehind v]) to [_qdz v]\n        add (_id0) to [_qdparent v]\n        add (length of [_qdparent v]) to [_orderbehind v]\n        change [_tri0 v] by (6)\n    end\n    if <(_tri0) < (length of [_splitbehind v])> then\n        add (_tri1) to [_qdx v]\n        add (_tri2) to [_qdy v]\n        add (_tri3) to [_qdz v]\n        add (item ((_tri0) - (3)) of [_splitbehind v]) to [_qdx v]\n        add (item ((_tri0) - (2)) of [_splitbehind v]) to [_qdy v]\n        add (item ((_tri0) - (1)) of [_splitbehind v]) to [_qdz v]\n        add (item (_tri0) of [_splitbehind v]) to [_qdx v]\n        add (item ((_tri0) + (1)) of [_splitbehind v]) to [_qdy v]\n        add (item ((_tri0) + (2)) of [_splitbehind v]) to [_qdz v]\n        add [_] to [_qdx v]\n        add [_] to [_qdy v]\n        add [_] to [_qdz v]\n        add (_id0) to [_qdparent v]\n        add (length of [_qdparent v]) to [_orderbehind v]\n    end\nend\nif <(length of [_splitahead v]) > [8]> then\n    set [_tri1 v] to (item (1) of [_splitahead v])\n    set [_tri2 v] to (item (2) of [_splitahead v])\n    set [_tri3 v] to (item (3) of [_splitahead v])\n    set [_tri0 v] to [7]\n    repeat ([floor v] of (((length of [_splitahead v]) - (6)) / (6)) )\n        add (_tri1) to [_qdx v]\n        add (_tri2) to [_qdy v]\n        add (_tri3) to [_qdz v]\n        add (item ((_tri0) - (3)) of [_splitahead v]) to [_qdx v]\n        add (item ((_tri0) - (2)) of [_splitahead v]) to [_qdy v]\n        add (item ((_tri0) - (1)) of [_splitahead v]) to [_qdz v]\n        add (item (_tri0) of [_splitahead v]) to [_qdx v]\n        add (item ((_tri0) + (1)) of [_splitahead v]) to [_qdy v]\n        add (item ((_tri0) + (2)) of [_splitahead v]) to [_qdz v]\n        add (item ((_tri0) + (3)) of [_splitahead v]) to [_qdx v]\n        add (item ((_tri0) + (4)) of [_splitahead v]) to [_qdy v]\n        add (item ((_tri0) + (5)) of [_splitahead v]) to [_qdz v]\n        add (_id0) to [_qdparent v]\n        add (length of [_qdparent v]) to [_orderahead v]\n        change [_tri0 v] by (6)\n    end\n    if <(_tri0) < (length of [_splitahead v])> then\n        add (_tri1) to [_qdx v]\n        add (_tri2) to [_qdy v]\n        add (_tri3) to [_qdz v]\n        add (item ((_tri0) - (3)) of [_splitahead v]) to [_qdx v]\n        add (item ((_tri0) - (2)) of [_splitahead v]) to [_qdy v]\n        add (item ((_tri0) - (1)) of [_splitahead v]) to [_qdz v]\n        add (item (_tri0) of [_splitahead v]) to [_qdx v]\n        add (item ((_tri0) + (1)) of [_splitahead v]) to [_qdy v]\n        add (item ((_tri0) + (2)) of [_splitahead v]) to [_qdz v]\n        add [_] to [_qdx v]\n        add [_] to [_qdy v]\n        add [_] to [_qdz v]\n        add (_id0) to [_qdparent v]\n        add (length of [_qdparent v]) to [_orderahead v]\n    end\nend\n\ndefine _bspBehind (blo) (alo) (bhi) (ahi) (ehi)\nif <<not <(bhi) < (blo)>> and <(_trisRendered) < [2000]>> then\n    if <(blo) = (bhi)> then\n        _drawQuad (item (blo) of [_orderbehind v])\n    else\n        set [_id2 v] to (blo)\n        _getPlaneOfQuad (item (_id2) of [_orderbehind v])\n        if <(_planeType) = [perp]> then\n            set [_id2 v] to ((blo) + (1))\n            repeat until <<not <(_planeType) = [perp]>> or <(_id2) > (bhi)>>\n                _getPlaneOfQuad (item (_id2) of [_orderbehind v])\n                change [_id2 v] by (1)\n            end\n            change [_id2 v] by (-1)\n        end\n        if <(_planeType) = [perp]> then\n            set [_i0 v] to (blo)\n            repeat ((bhi) - ((blo) - (1)))\n                add (item (_i0) of [_orderbehind v]) to [_orderequal v]\n                add [] to [_orderequaldepth v]\n                change [_i0 v] by (1)\n            end\n            _sortAndRenderOrderEqual ((ehi) + (1)) (length of [_orderequal v])\n        else\n            set [_i3 v] to ((length of [_orderbehind v]) + (1))\n            set [_i4 v] to ((length of [_orderahead v]) + (1))\n            set [_i0 v] to (blo)\n            repeat ((bhi) - ((blo) - (1)))\n                if <not <(_i0) = (_id2)>> then\n                    set [_id1 v] to (item (_i0) of [_orderbehind v])\n                    set [_id0 v] to ((4) * (_id1))\n                    _splitQuad (item ((_id0) - (3)) of [_qdx v]) (item ((_id0) - (3)) of [_qdy v]) (item ((_id0) - (3)) of [_qdz v]) (item ((_id0) - (2)) of [_qdx v]) (item ((_id0) - (2)) of [_qdy v]) (item ((_id0) - (2)) of [_qdz v]) (item ((_id0) - (1)) of [_qdx v]) (item ((_id0) - (1)) of [_qdy v]) (item ((_id0) - (1)) of [_qdz v]) (item (_id0) of [_qdx v]) (item (_id0) of [_qdy v]) (item (_id0) of [_qdz v]) (_id1)\n                end\n                change [_i0 v] by (1)\n            end\n            add (item (_id2) of [_orderbehind v]) to [_orderequal v]\n            add [] to [_orderequaldepth v]\n            _bspBehind (_i3) (_i4) (length of [_orderbehind v]) (length of [_orderahead v]) (length of [_orderequal v])\n            _sortAndRenderOrderEqual ((ehi) + (1)) (_i5)\n            _bspAhead (_i3) (_i4) (_i1) (_i2) (length of [_orderequal v])\n        end\n    end\nend\nset [_i1 v] to (bhi)\nset [_i2 v] to (ahi)\nset [_i3 v] to (blo)\nset [_i4 v] to (alo)\nset [_i5 v] to (ehi)\n\ndefine _getPlaneOfQuad (id)\nset [_id0 v] to ((4) * (id))\n_getPlaneOfTri (item ((_id0) - (3)) of [_qdx v]) (item ((_id0) - (3)) of [_qdy v]) (item ((_id0) - (3)) of [_qdz v]) (item ((_id0) - (1)) of [_qdx v]) (item ((_id0) - (1)) of [_qdy v]) (item ((_id0) - (1)) of [_qdz v]) (item ((_id0) - (2)) of [_qdx v]) (item ((_id0) - (2)) of [_qdy v]) (item ((_id0) - (2)) of [_qdz v])\nif <<(_planeType) = [perp]> and <not <(item (_id0) of [_qdx v]) = [_]>>> then\n    _getPlaneOfTri (item ((_id0) - (3)) of [_qdx v]) (item ((_id0) - (3)) of [_qdy v]) (item ((_id0) - (3)) of [_qdz v]) (item ((_id0) - (1)) of [_qdx v]) (item ((_id0) - (1)) of [_qdy v]) (item ((_id0) - (1)) of [_qdz v]) (item (_id0) of [_qdx v]) (item (_id0) of [_qdy v]) (item (_id0) of [_qdz v])\nend\n\ndefine _bspAhead (blo) (alo) (bhi) (ahi) (ehi)\nif <<not <(ahi) < (alo)>> and <(_trisRendered) < [2000]>> then\n    if <(alo) = (ahi)> then\n        _drawQuad (item (alo) of [_orderahead v])\n    else\n        set [_id2 v] to (alo)\n        _getPlaneOfQuad (item (_id2) of [_orderahead v])\n        if <(_planeType) = [perp]> then\n            set [_id2 v] to ((alo) + (1))\n            repeat until <<not <(_planeType) = [perp]>> or <(_id2) > (ahi)>>\n                _getPlaneOfQuad (item (_id2) of [_orderahead v])\n                change [_id2 v] by (1)\n            end\n            change [_id2 v] by (-1)\n        end\n        if <(_planeType) = [perp]> then\n            set [_i0 v] to (alo)\n            repeat ((ahi) - ((alo) - (1)))\n                add (item (_i0) of [_orderahead v]) to [_orderequal v]\n                add [] to [_orderequaldepth v]\n                change [_i0 v] by (1)\n            end\n            _sortAndRenderOrderEqual ((ehi) + (1)) (length of [_orderequal v])\n        else\n            set [_i3 v] to ((length of [_orderbehind v]) + (1))\n            set [_i4 v] to ((length of [_orderahead v]) + (1))\n            set [_i0 v] to (alo)\n            repeat ((ahi) - ((alo) - (1)))\n                if <not <(_i0) = (_id2)>> then\n                    set [_id1 v] to (item (_i0) of [_orderahead v])\n                    set [_id0 v] to ((4) * (_id1))\n                    _splitQuad (item ((_id0) - (3)) of [_qdx v]) (item ((_id0) - (3)) of [_qdy v]) (item ((_id0) - (3)) of [_qdz v]) (item ((_id0) - (2)) of [_qdx v]) (item ((_id0) - (2)) of [_qdy v]) (item ((_id0) - (2)) of [_qdz v]) (item ((_id0) - (1)) of [_qdx v]) (item ((_id0) - (1)) of [_qdy v]) (item ((_id0) - (1)) of [_qdz v]) (item (_id0) of [_qdx v]) (item (_id0) of [_qdy v]) (item (_id0) of [_qdz v]) (_id1)\n                end\n                change [_i0 v] by (1)\n            end\n            add (item (_id2) of [_orderahead v]) to [_orderequal v]\n            add [] to [_orderequaldepth v]\n            _bspBehind (_i3) (_i4) (length of [_orderbehind v]) (length of [_orderahead v]) (length of [_orderequal v])\n            _sortAndRenderOrderEqual ((ehi) + (1)) (_i5)\n            _bspAhead (_i3) (_i4) (_i1) (_i2) (length of [_orderequal v])\n        end\n    end\nend\n\ndefine _addSplitBehindToTmp (idx) (parent)\nif <((length of [_splitbehind v]) - ((idx) - (1))) > [8]> then\n    set [_i2 v] to (item (idx) of [_splitbehind v])\n    set [_i3 v] to (item ((idx) + (1)) of [_splitbehind v])\n    set [_i4 v] to (item ((idx) + (2)) of [_splitbehind v])\n    set [_i1 v] to ((idx) + (6))\n    repeat ([floor v] of ((((length of [_splitbehind v]) - ((idx) - (1))) - (6)) / (6)) )\n        add (_i2) to [_tmpx v]\n        add (_i3) to [_tmpy v]\n        add (_i4) to [_tmpz v]\n        add (item ((_i1) - (3)) of [_splitbehind v]) to [_tmpx v]\n        add (item ((_i1) - (2)) of [_splitbehind v]) to [_tmpy v]\n        add (item ((_i1) - (1)) of [_splitbehind v]) to [_tmpz v]\n        add (item (_i1) of [_splitbehind v]) to [_tmpx v]\n        add (item ((_i1) + (1)) of [_splitbehind v]) to [_tmpy v]\n        add (item ((_i1) + (2)) of [_splitbehind v]) to [_tmpz v]\n        add (item ((_i1) + (3)) of [_splitbehind v]) to [_tmpx v]\n        add (item ((_i1) + (4)) of [_splitbehind v]) to [_tmpy v]\n        add (item ((_i1) + (5)) of [_splitbehind v]) to [_tmpz v]\n        add (parent) to [_tmpparent v]\n        change [_i1 v] by (6)\n    end\n    if <(_i1) < (length of [_splitbehind v])> then\n        add (_i2) to [_tmpx v]\n        add (_i3) to [_tmpy v]\n        add (_i4) to [_tmpz v]\n        add (item ((_i1) - (3)) of [_splitbehind v]) to [_tmpx v]\n        add (item ((_i1) - (2)) of [_splitbehind v]) to [_tmpy v]\n        add (item ((_i1) - (1)) of [_splitbehind v]) to [_tmpz v]\n        add (item (_i1) of [_splitbehind v]) to [_tmpx v]\n        add (item ((_i1) + (1)) of [_splitbehind v]) to [_tmpy v]\n        add (item ((_i1) + (2)) of [_splitbehind v]) to [_tmpz v]\n        add [_] to [_tmpx v]\n        add [_] to [_tmpy v]\n        add [_] to [_tmpz v]\n        add (parent) to [_tmpparent v]\n    end\nend\n\ndefine _applyLighting (ambient) (light)\nset [_i0 v] to [1]\nrepeat (length of [_qdcolor v])\n    set [_id0 v] to ((4) * (_i0))\n    set [_tri0 v] to (item ((_id0) - (3)) of [_qdx v])\n    set [_tri1 v] to (item ((_id0) - (3)) of [_qdy v])\n    set [_tri2 v] to (item ((_id0) - (3)) of [_qdz v])\n    set [_rotatedx v] to ((item ((_id0) - (2)) of [_qdx v]) - (_tri0))\n    set [_rotatedy v] to ((item ((_id0) - (2)) of [_qdy v]) - (_tri1))\n    set [_rotatedz v] to ((item ((_id0) - (2)) of [_qdz v]) - (_tri2))\n    set [_i4 v] to ((item ((_id0) - (1)) of [_qdx v]) - (_tri0))\n    set [_i5 v] to ((item ((_id0) - (1)) of [_qdy v]) - (_tri1))\n    set [_i6 v] to ((item ((_id0) - (1)) of [_qdz v]) - (_tri2))\n    set [_i1 v] to (((_rotatedY) * (_i6)) - ((_rotatedZ) * (_i5)))\n    set [_i2 v] to (((_rotatedZ) * (_i4)) - ((_rotatedX) * (_i6)))\n    set [_i3 v] to (((_rotatedX) * (_i5)) - ((_rotatedY) * (_i4)))\n    set [_i4 v] to (([abs v] of (((_i1) * (_tri0)) + (((_i2) * (_tri1)) + ((_i3) * (_tri2)))) ) / ([sqrt v] of (((_i1) * (_i1)) + (((_i2) * (_i2)) + ((_i3) * (_i3)))) ))\n    set [_i5 v] to ((ambient) + ((([floor v] of ((item (_i0) of [_qdreflect v]) / (2)) ) / (8)) * ((-0.35) - (ambient))))\n    set [_i6 v] to ((light) + ((([floor v] of ((item (_i0) of [_qdreflect v]) / (2)) ) / (10)) * ((0.01) - (light))))\n    if <(3DLightQuality) = [low]> then\n        set [_i2 v] to (((_i5) + (0.1)) + ((1200) * ((_i6) / ((_i4) + (25)))))\n    else\n        set [_i4 v] to ((_i5) + ((800) * ((_i6) / ((_i4) + (20)))))\n        set [_i2 v] to ((_i4) + (((0.8) * (_i6)) * (((item (_i0) of [_qdreflect v]) mod (2)) * ([abs v] of (([acos v] of ((_i3) / ([sqrt v] of (((_i1) * (_i1)) + (((_i2) * (_i2)) + ((_i3) * (_i3)))) )) ) - (90)) ))))\n    end\n    set [_i3 v] to (item (_i0) of [_qdcolor v])\n    if <(_i2) < [-1]> then\n        set [_i2 v] to [-1]\n    end\n    if <(_i2) > [1]> then\n        set [_i2 v] to [1]\n    end\n    if <not <(_i2) = [0]>> then\n        if <(_i2) < [0]> then\n            change [_i2 v] by (1)\n            set [_i4 v] to ((_i2) * (((_i3) / (65536)) mod (256)))\n            set [_i5 v] to ((_i2) * (((_i3) / (256)) mod (256)))\n            set [_i6 v] to ((_i2) * ((_i3) mod (256)))\n        else\n            if <(_i2) > [0]> then\n                set [_i2 v] to ((1) - (_i2))\n                set [_i4 v] to ((255) - ((_i2) * ((255) - (((_i3) / (65536)) mod (256)))))\n                set [_i5 v] to ((255) - ((_i2) * ((255) - (((_i3) / (256)) mod (256)))))\n                set [_i6 v] to ((255) - ((_i2) * ((255) - ((_i3) mod (256)))))\n            end\n        end\n        if <(_i4) > [255]> then\n            set [_i4 v] to [255]\n        else\n            if <(_i4) < [0]> then\n                set [_i4 v] to [0]\n            end\n        end\n        if <(_i5) > [255]> then\n            set [_i5 v] to [255]\n        else\n            if <(_i5) < [0]> then\n                set [_i5 v] to [0]\n            end\n        end\n        if <(_i6) > [255]> then\n            set [_i6 v] to [255]\n        else\n            if <(_i6) < [0]> then\n                set [_i6 v] to [0]\n            end\n        end\n        replace item (_i0) of [_qdcolor v] with ((((65536) * (round (_i4))) + ((256) * (round (_i5)))) + (round (_i6)))\n    end\n    change [_i0 v] by (1)\nend\n\ndefine _getBoundsInner (x) (y) (z)\nif <(x) < (_xmin)> then\n    set [_xmin v] to (x)\nelse\n    if <(x) > (_xmax)> then\n        set [_xmax v] to (x)\n    end\nend\nif <(y) < (_ymin)> then\n    set [_ymin v] to (y)\nelse\n    if <(y) > (_ymax)> then\n        set [_ymax v] to (y)\n    end\nend\nif <(z) < (_zmin)> then\n    set [_zmin v] to (z)\nelse\n    if <(z) > (_zmax)> then\n        set [_zmax v] to (z)\n    end\nend\n\ndefine Reverse Rotate (x) (y) (z) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\nset [_rot0 v] to (((cosz) * (x)) - ((sinz) * (y)))\nset [_rotatedy v] to (((cosz) * (y)) + ((sinz) * (x)))\nset [_rotatedz v] to (((cosx) * (z)) + ((sinx) * (_rotatedY)))\nset [_rotatedy v] to (((cosx) * (_rotatedY)) - ((sinx) * (z)))\nset [_rotatedx v] to (((cosy) * (_rot0)) - ((siny) * (_rotatedZ)))\nset [_rotatedz v] to (((cosy) * (_rotatedZ)) + ((siny) * (_rot0)))\n\nwhen I receive [graphics v]\nif <not <(LoopTask) = [none]>> then\n    wait until <(LoopTask) = [none]>\nend\nset [looptask v] to [graphics]\nRender 3D\nset [looptask v] to [none]\n\ndefine _getQuads <bounds> (x) (y) (z) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\ndelete all of [_qdx v]\ndelete all of [_qdy v]\ndelete all of [_qdz v]\ndelete all of [_qdcolor v]\ndelete all of [_qdreflect v]\ndelete all of [_qdparent v]\ndelete all of [_qdoriginal v]\nset [_id1 v] to [1]\nif <bounds> then\n    repeat (length of [3dquadorder v])\n        set [_i0 v] to (((4) * (item (_id1) of [3dquadorder v])) - (3))\n        if <not <<(item (_i0) of [3dquadboundz v]) > (_zmax)> or <(item ((_i0) + (1)) of [3dquadboundz v]) < (_zmin)>>> then\n            if <not <<(item (_i0) of [3dquadboundx v]) > (_xmax)> or <(item ((_i0) + (1)) of [3dquadboundx v]) < (_xmin)>>> then\n                if <not <<(item (_i0) of [3dquadboundy v]) > (_ymax)> or <(item ((_i0) + (1)) of [3dquadboundy v]) < (_ymin)>>> then\n                    _addQuad (x) (y) (z) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n                end\n            end\n        end\n        change [_id1 v] by (1)\n    end\nelse\n    repeat (length of [3dquadorder v])\n        set [_i0 v] to (((4) * (item (_id1) of [3dquadorder v])) - (3))\n        _addQuad (x) (y) (z) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n        change [_id1 v] by (1)\n    end\nend\n\ndefine _addQuad (x) (y) (z) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\nif <(item (_i0) of [3dquadmovement v]) = [_]> then\n    repeat (4)\n        if <(item (_i0) of [3dquadx v]) = [_]> then\n            add [_] to [_qdx v]\n            add [_] to [_qdy v]\n            add [_] to [_qdz v]\n        else\n            Rotate Point ((item (_i0) of [3dquadx v]) - (x)) ((item (_i0) of [3dquady v]) - (y)) ((item (_i0) of [3dquadz v]) - (z)) Angle (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n            add (_rotatedX) to [_qdx v]\n            add (_rotatedY) to [_qdy v]\n            add (_rotatedZ) to [_qdz v]\n        end\n        change [_i0 v] by (1)\n    end\nelse\n    set [_i1 v] to (((frame) mod ((2) * (item (_i0) of [3dquadmovement v]))) / (item (_i0) of [3dquadmovement v]))\n    if <(_i1) > [1]> then\n        set [_i1 v] to ((2) - (_i1))\n    end\n    set [_i2 v] to ((_i1) * (item ((_i0) + (1)) of [3dquadmovement v]))\n    set [_i3 v] to ((_i1) * (item ((_i0) + (2)) of [3dquadmovement v]))\n    set [_i4 v] to ((_i1) * (item ((_i0) + (3)) of [3dquadmovement v]))\n    if <(item ((_i0) + (3)) of [3dquadx v]) = [_]> then\n        repeat (3)\n            Rotate Point (((item (_i0) of [3dquadx v]) + (_i2)) - (x)) (((item (_i0) of [3dquady v]) + (_i3)) - (y)) (((item (_i0) of [3dquadz v]) + (_i4)) - (z)) Angle (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n            add (_rotatedX) to [_qdx v]\n            add (_rotatedY) to [_qdy v]\n            add (_rotatedZ) to [_qdz v]\n            change [_i0 v] by (1)\n        end\n        add [_] to [_qdx v]\n        add [_] to [_qdy v]\n        add [_] to [_qdz v]\n    else\n        repeat (4)\n            Rotate Point (((item (_i0) of [3dquadx v]) + (_i2)) - (x)) (((item (_i0) of [3dquady v]) + (_i3)) - (y)) (((item (_i0) of [3dquadz v]) + (_i4)) - (z)) Angle (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n            add (_rotatedX) to [_qdx v]\n            add (_rotatedY) to [_qdy v]\n            add (_rotatedZ) to [_qdz v]\n            change [_i0 v] by (1)\n        end\n    end\nend\nset [_id0 v] to (item (_id1) of [3dquadorder v])\nif <(item (_id0) of [3dquadbackculling v]) = [true]> then\n    set [_i0 v] to (length of [_qdx v])\n    set [_i1 v] to (item ((_i0) - (3)) of [_qdx v])\n    set [_i2 v] to (item ((_i0) - (3)) of [_qdy v])\n    set [_i3 v] to (item ((_i0) - (3)) of [_qdz v])\n    set [_rotatedx v] to ((item ((_i0) - (2)) of [_qdx v]) - (_i1))\n    set [_rotatedy v] to ((item ((_i0) - (2)) of [_qdy v]) - (_i2))\n    set [_rotatedz v] to ((item ((_i0) - (2)) of [_qdz v]) - (_i3))\n    set [_i4 v] to ((item ((_i0) - (1)) of [_qdx v]) - (_i1))\n    set [_i5 v] to ((item ((_i0) - (1)) of [_qdy v]) - (_i2))\n    set [_i6 v] to ((item ((_i0) - (1)) of [_qdz v]) - (_i3))\n    if <not <(((((_rotatedY) * (_i6)) - ((_rotatedZ) * (_i5))) * (_i1)) + (((((_rotatedZ) * (_i4)) - ((_rotatedX) * (_i6))) * (_i2)) + ((((_rotatedX) * (_i5)) - ((_rotatedY) * (_i4))) * (_i3)))) < [0]>> then\n        delete (last) of [_qdx v]\n        delete (last) of [_qdx v]\n        delete (last) of [_qdx v]\n        delete (last) of [_qdx v]\n        delete (last) of [_qdy v]\n        delete (last) of [_qdy v]\n        delete (last) of [_qdy v]\n        delete (last) of [_qdy v]\n        delete (last) of [_qdz v]\n        delete (last) of [_qdz v]\n        delete (last) of [_qdz v]\n        delete (last) of [_qdz v]\n        stop [this script v]\n    end\nend\nadd ((length of [_qdparent v]) + (1)) to [_qdparent v]\nadd (_id0) to [_qdoriginal v]\nadd (item (_id0) of [3dquadcolor v]) to [_qdcolor v]\nadd (item (_id0) of [3dquadreflectivity v]) to [_qdreflect v]\n\ndefine _fillTri (x0) (y0) (x1) (y1) (x2) (y2)\nchange [_trisrendered v] by (1)\nset [_tri2 v] to ([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + (((y1) - (y2)) * ((y1) - (y2)))) )\nset [_tri3 v] to ([sqrt v] of ((((x0) - (x2)) * ((x0) - (x2))) + (((y0) - (y2)) * ((y0) - (y2)))) )\nset [_tri4 v] to ([sqrt v] of ((((x0) - (x1)) * ((x0) - (x1))) + (((y0) - (y1)) * ((y0) - (y1)))) )\nset [_tri1 v] to (((_tri2) + ((_tri3) + (_tri4))) / (2))\nset [_tri0 v] to ((2) * ([sqrt v] of ((((_tri1) - (_tri2)) * (((_tri1) - (_tri3)) * ((_tri1) - (_tri4)))) / (_tri1)) ))\nchange [_tri1 v] by (_tri1)\ngo to x: (((((_tri2) * (x0)) + ((_tri3) * (x1))) + ((_tri4) * (x2))) / (_tri1)) y: (((((_tri2) * (y0)) + ((_tri3) * (y1))) + ((_tri4) * (y2))) / (_tri1))\nset pen size to ((_tri0) - (0.5))\npen down\nif <(_tri0) > [0]> then\n    if <<(_tri3) < (_tri2)> or <(_tri4) < (_tri2)>> then\n        if <<(_tri2) < (_tri3)> or <(_tri4) < (_tri3)>> then\n            set [_tri1 v] to ((x position) - (x2))\n            set [_tri2 v] to ((y position) - (y2))\n        else\n            set [_tri1 v] to ((x position) - (x1))\n            set [_tri2 v] to ((y position) - (y1))\n        end\n    else\n        set [_tri1 v] to ((x position) - (x0))\n        set [_tri2 v] to ((y position) - (y0))\n    end\n    set [_tri1 v] to (([sqrt v] of (((_tri1) * (_tri1)) + ((_tri2) * (_tri2))) ) / ((_tri0) / (2)))\n    set [_tri8 v] to ((_tri1) / ((_tri1) - (1)))\n    set [_tri1 v] to ((0.5) - ((0.5) / (_tri1)))\n    set [_tri2 v] to (((x position) - (x0)) / (_tri0))\n    set [_tri3 v] to (((y position) - (y0)) / (_tri0))\n    set [_tri4 v] to (((x position) - (x1)) / (_tri0))\n    set [_tri5 v] to (((y position) - (y1)) / (_tri0))\n    set [_tri6 v] to (((x position) - (x2)) / (_tri0))\n    set [_tri7 v] to (((y position) - (y2)) / (_tri0))\n    repeat until <(_tri0) < (_tri8)>\n        set [_tri0 v] to ((_tri1) * (_tri0))\n        set pen size to ((_tri0) + (0.5))\n        go to x: ((x0) + ((_tri0) * (_tri2))) y: ((y0) + ((_tri0) * (_tri3)))\n        go to x: ((x1) + ((_tri0) * (_tri4))) y: ((y1) + ((_tri0) * (_tri5)))\n        go to x: ((x2) + ((_tri0) * (_tri6))) y: ((y2) + ((_tri0) * (_tri7)))\n        go to x: ((x0) + ((_tri0) * (_tri2))) y: ((y0) + ((_tri0) * (_tri3)))\n    end\nend\nset pen size to (1.01)\ngo to x: (x0) y: (y0)\ngo to x: (x1) y: (y1)\ngo to x: (x2) y: (y2)\ngo to x: (x0) y: (y0)\npen up\n\nwhen I receive [simple3d v]\nset [3dcamfarz v] to ((1) / (0))\nset [3dcamfov v] to [75]\nset [3dlightquality v] to [high]\nGet Quads [-120] [90] [-70] [20] [-5] [0] (3DCamFOV) (3DCamNearZ) (3DCamFarZ) (3DLightAmbientLevel) ((3DLightSourceLevel) / (90)) [242]\nRender Quads <[0] = [0]>\n\ndefine _selectVertices (mx) (my) (nearz) (farz) (fov)\ndelete all of [selectvertex v]\nadd ((farz) + (1)) to [selectvertex v]\nadd [none] to [selectvertex v]\nset [_i5 v] to (length of [3dquadtype v])\nset [_i0 v] to [1]\nrepeat (length of [_qdoriginal v])\n    if <not <(item (_i0) of [_qdoriginal v]) > (_i5)>> then\n        set [_id0 v] to (((4) * (_i0)) - (3))\n        set [_i1 v] to [none]\n        set [_i2 v] to ((farz) + (1))\n        set [_id1 v] to [0]\n        _selectVertex (mx) (my) (nearz) (farz) (fov) (item ((_id0) + (_id1)) of [_qdx v]) (item ((_id0) + (_id1)) of [_qdy v]) (item ((_id0) + (_id1)) of [_qdz v])\n        set [_id1 v] to [1]\n        _selectVertex (mx) (my) (nearz) (farz) (fov) (item ((_id0) + (_id1)) of [_qdx v]) (item ((_id0) + (_id1)) of [_qdy v]) (item ((_id0) + (_id1)) of [_qdz v])\n        set [_id1 v] to [2]\n        _selectVertex (mx) (my) (nearz) (farz) (fov) (item ((_id0) + (_id1)) of [_qdx v]) (item ((_id0) + (_id1)) of [_qdy v]) (item ((_id0) + (_id1)) of [_qdz v])\n        set [_id1 v] to [3]\n        _selectVertex (mx) (my) (nearz) (farz) (fov) (item ((_id0) + (_id1)) of [_qdx v]) (item ((_id0) + (_id1)) of [_qdy v]) (item ((_id0) + (_id1)) of [_qdz v])\n        if <not <(_i1) = [none]>> then\n            if <(_i2) < (item (1) of [selectvertex v])> then\n                delete all of [selectvertex v]\n                add (_i2) to [selectvertex v]\n                add ((((4) * (item (_i0) of [_qdoriginal v])) - (3)) + (_i1)) to [selectvertex v]\n            else\n                if <([abs v] of ((_i2) - (item (1) of [selectvertex v])) ) < [1e-7]> then\n                    add ((((4) * (item (_i0) of [_qdoriginal v])) - (3)) + (_i1)) to [selectvertex v]\n                end\n            end\n        end\n    end\n    change [_i0 v] by (1)\nend\n\ndefine _selectVertex (mx) (my) (nearz) (farz) (fov) (x) (y) (z)\nif <not <(x) = [_]>> then\n    if <<(z) > (nearz)> and <(z) < (farz)>> then\n        if <(z) < (_i2)> then\n            set [_i3 v] to ((180) * ((x) / ((fov) * (z))))\n            set [_i4 v] to ((180) * ((y) / ((fov) * (z))))\n            if <((((mx) - (_i3)) * ((mx) - (_i3))) + (((my) - (_i4)) * ((my) - (_i4)))) < [36]> then\n                set [_i1 v] to (_id1)\n                set [_i2 v] to (z)\n            end\n        end\n    end\nend\n\ndefine _selectQuad (mx) (my) (x0) (y0) (z0) (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3)\nset [_ymin v] to [none]\nset [_ymax v] to [none]\nset [_zmin v] to [none]\nset [_zmax v] to [none]\n_selectQuadLine (mx) (my) (x0) (y0) (z0) (x1) (y1) (z1)\n_selectQuadLine (mx) (my) (x1) (y1) (z1) (x2) (y2) (z2)\nif <(x3) = [_]> then\n    _selectQuadLine (mx) (my) (x2) (y2) (z2) (x0) (y0) (z0)\nelse\n    _selectQuadLine (mx) (my) (x2) (y2) (z2) (x3) (y3) (z3)\n    _selectQuadLine (mx) (my) (x3) (y3) (z3) (x0) (y0) (z0)\nend\nif <not <(_ymin) = [none]>> then\n    if <<(_ymin) < (my)> and <(_ymax) > (my)>> then\n        set [_lerp0 v] to (((my) - (_ymin)) / ((_ymax) - (_ymin)))\n        set [_i1 v] to ((((1) - (_lerp0)) * (_zmin)) + ((_lerp0) * (_zmax)))\n        if <(_i1) > (item (1) of [selectquad v])> then\n            delete all of [selectquad v]\n            add (_i1) to [selectquad v]\n            add (item (item (_i0) of [_qdparent v]) of [_qdoriginal v]) to [selectquad v]\n        end\n    end\nend\n\ndefine _selectQuads (mx) (my)\ndelete all of [selectquad v]\nadd ((0) * (0)) to [selectquad v]\nadd [none] to [selectquad v]\nset [_i0 v] to [1]\nrepeat (length of [_qdparent v])\n    set [_id0 v] to (((4) * (_i0)) - (3))\n    _selectQuad (mx) (my) (item (_id0) of [_qdx v]) (item (_id0) of [_qdy v]) (item (_id0) of [_qdz v]) (item ((_id0) + (1)) of [_qdx v]) (item ((_id0) + (1)) of [_qdy v]) (item ((_id0) + (1)) of [_qdz v]) (item ((_id0) + (2)) of [_qdx v]) (item ((_id0) + (2)) of [_qdy v]) (item ((_id0) + (2)) of [_qdz v]) (item ((_id0) + (3)) of [_qdx v]) (item ((_id0) + (3)) of [_qdy v]) (item ((_id0) + (3)) of [_qdz v])\n    change [_i0 v] by (1)\nend\n\ndefine _selectQuadLine (mx) (my) (x0) (y0) (z0) (x1) (y1) (z1)\nset [_lerp0 v] to (((mx) - (x0)) / ((x1) - (x0)))\nif <<[0] < (_lerp0)> and <(_lerp0) < [1]>> then\n    set [_i1 v] to ((((1) - (_lerp0)) * (y0)) + ((_lerp0) * (y1)))\n    set [_i2 v] to ((((1) - (_lerp0)) * (z0)) + ((_lerp0) * (z1)))\n    if <(_ymin) = [none]> then\n        set [_ymin v] to (_i1)\n        set [_zmin v] to (_i2)\n        set [_ymax v] to (_ymin)\n        set [_zmax v] to (_zmin)\n    else\n        if <(_i1) < (_ymin)> then\n            set [_ymin v] to (_i1)\n            set [_zmin v] to (_i2)\n        else\n            if <(_i1) > (_ymax)> then\n                set [_ymax v] to (_i1)\n                set [_zmax v] to (_i2)\n            end\n        end\n    end\nend\n\ndefine _sort (lo) (hi)\nset [_sort0 v] to ((lo) - (1))\nrepeat until <((hi) - (_sort0)) < [17]>\n    set [_sort1 v] to ((((hi) - (_sort0)) mod (3)) + (1))\n    change [_sort0 v] by (1)\n    set [_sort2 v] to (item ((round (((_sort0) + (hi)) / (2))) + ((_sort1) - (2))) of [_orderequaldepth v])\n    set [_sort3 v] to (item ((hi) - (_sort1)) of [_orderequaldepth v])\n    set [_sort1 v] to (item ((_sort0) + (_sort1)) of [_orderequaldepth v])\n    if <not <<(_sort1) > (_sort2)> or <(_sort2) > (_sort3)>>> then\n        set [_sort4 v] to (_sort0)\n        set [_sort5 v] to ((hi) - (1))\n        repeat until <(_sort4) > (_sort5)>\n            if <(item (_sort4) of [_orderequaldepth v]) > (item ((_sort4) + (1)) of [_orderequaldepth v])> then\n                if <<(_sort1) = (_sort2)> and <(_sort2) = (_sort3)>> then\n                    if <(item ((_sort4) + (1)) of [_orderequaldepth v]) = (_sort1)> then\n                        set [_sort1 v] to (item (_sort4) of [_orderequaldepth v])\n                    else\n                        set [_sort1 v] to (item ((_sort4) + (1)) of [_orderequaldepth v])\n                    end\n                end\n                set [_sort4 v] to [0]\n                set [_sort5 v] to [-1]\n            else\n                if <(item (_sort5) of [_orderequaldepth v]) > (item ((_sort5) + (1)) of [_orderequaldepth v])> then\n                    if <<(_sort1) = (_sort2)> and <(_sort2) = (_sort3)>> then\n                        if <(item ((_sort5) + (1)) of [_orderequaldepth v]) = (_sort1)> then\n                            set [_sort1 v] to (item (_sort5) of [_orderequaldepth v])\n                        else\n                            set [_sort1 v] to (item ((_sort5) + (1)) of [_orderequaldepth v])\n                        end\n                    end\n                    set [_sort4 v] to [0]\n                    set [_sort5 v] to [-1]\n                end\n            end\n            change [_sort4 v] by (1)\n            change [_sort5 v] by (-1)\n        end\n        if <(_sort5) > [0]> then\n            set [_sort0 v] to (hi)\n            stop [this script v]\n        end\n    end\n    if <(_sort1) < (_sort2)> then\n        if <(_sort3) < (_sort2)> then\n            if <(_sort3) < (_sort1)> then\n                set [_sort1 v] to (_sort1)\n            else\n                if <(_sort1) < (_sort3)> then\n                    set [_sort1 v] to (_sort3)\n                else\n                    set [_sort1 v] to (_sort2)\n                end\n            end\n        else\n            set [_sort1 v] to (_sort2)\n        end\n    else\n        if <(_sort2) < (_sort1)> then\n            if <(_sort3) < (_sort1)> then\n                if <(_sort3) < (_sort2)> then\n                    set [_sort1 v] to (_sort2)\n                else\n                    if <(_sort2) < (_sort3)> then\n                        set [_sort1 v] to (_sort3)\n                    else\n                        set [_sort1 v] to (_sort1)\n                    end\n                end\n            else\n                set [_sort1 v] to (_sort1)\n            end\n        else\n            if <(_sort3) < (_sort1)> then\n                set [_sort1 v] to (_sort1)\n            else\n                set [_sort1 v] to (_sort3)\n            end\n        end\n    end\n    set [_sort2 v] to (_sort0)\n    repeat until <not <(item (_sort2) of [_orderequaldepth v]) < (_sort1)>>\n        change [_sort2 v] by (1)\n    end\n    set [_sort3 v] to (hi)\n    repeat until <(item (_sort3) of [_orderequaldepth v]) < (_sort1)>\n        change [_sort3 v] by (-1)\n    end\n    repeat until <not <(_sort2) < (_sort3)>>\n        set [_sort4 v] to (item (_sort2) of [_orderequaldepth v])\n        replace item (_sort2) of [_orderequaldepth v] with (item (_sort3) of [_orderequaldepth v])\n        replace item (_sort3) of [_orderequaldepth v] with (_sort4)\n        set [_sort5 v] to (item (_sort2) of [_orderequal v])\n        replace item (_sort2) of [_orderequal v] with (item (_sort3) of [_orderequal v])\n        replace item (_sort3) of [_orderequal v] with (_sort5)\n        change [_sort2 v] by (1)\n        repeat until <not <(item (_sort2) of [_orderequaldepth v]) < (_sort1)>>\n            change [_sort2 v] by (1)\n        end\n        change [_sort3 v] by (-1)\n        repeat until <(item (_sort3) of [_orderequaldepth v]) < (_sort1)>\n            change [_sort3 v] by (-1)\n        end\n    end\n    _sort (_sort0) (_sort3)\nend\nchange [_sort0 v] by (1)\nset [_sort3 v] to (_sort0)\nrepeat ((hi) - (_sort0))\n    set [_sort1 v] to (item ((_sort0) + (1)) of [_orderequaldepth v])\n    set [_sort4 v] to (item ((_sort0) + (1)) of [_orderequal v])\n    set [_sort2 v] to (_sort0)\n    repeat until <<not <(_sort1) < (item (_sort2) of [_orderequaldepth v])>> or <(_sort2) < (_sort3)>>\n        replace item ((_sort2) + (1)) of [_orderequaldepth v] with (item (_sort2) of [_orderequaldepth v])\n        replace item ((_sort2) + (1)) of [_orderequal v] with (item (_sort2) of [_orderequal v])\n        change [_sort2 v] by (-1)\n    end\n    replace item ((_sort2) + (1)) of [_orderequaldepth v] with (_sort1)\n    replace item ((_sort2) + (1)) of [_orderequal v] with (_sort4)\n    change [_sort0 v] by (1)\nend\n\ndefine Get Quads (x) (y) (z) (xrot) (yrot) (zrot) (fov) (nearz) (farz) (ambientlight) (sourcelight) (screenwidth)\nif <<(farz) < ((1) / (0))> and <(farz) > (nearz)>> then\n    _getBounds (x) (y) (z) ([tan v] of (([abs v] of (fov) ) / (2)) ) (farz) ([sin v] of (xrot) ) ([cos v] of (xrot) ) ([sin v] of (yrot) ) ([cos v] of (yrot) ) ([sin v] of (zrot) ) ([cos v] of (zrot) ) (screenwidth)\nend\n_getQuads <<(farz) < ((1) / (0))> and <(farz) > (nearz)>> (x) (y) (z) ([sin v] of (xrot) ) ([cos v] of (xrot) ) ([sin v] of (yrot) ) ([cos v] of (yrot) ) ([sin v] of (zrot) ) ([cos v] of (zrot) )\n_applyLighting (ambientlight) (sourcelight)\nif <(EditorMode) = [true]> then\n    if <(item (1) of [selectvertex v]) = [needSelection]> then\n        _selectVertices (mouse x) (mouse y) (nearz) (farz) ([tan v] of (([abs v] of (fov) ) / (2)) )\n    end\nend\nif <(farz) < ((1) / (0))> then\n    set [_i0 v] to ((1) / (farz))\nelse\n    set [_i0 v] to ((1) * (-1))\nend\nif <(TextIndex) = [0]> then\n    set [_i1 v] to [182]\nelse\n    set [_i1 v] to (TEXTBOX_Y)\nend\n_clipQuads (nearz) (([tan v] of (([abs v] of (fov) ) / (2)) ) / (180)) (_i0) ((-1) * (screenwidth)) ((1) * (screenwidth)) ((1) * (-182)) ((1) * (_i1))\nif <(EditorMode) = [true]> then\n    if <(item (1) of [selectquad v]) = [needSelection]> then\n        _selectQuads (mouse x) (mouse y)\n    end\nend\n\ndefine _getBounds (x) (y) (z) (fov) (farz) (sinx) (cosx) (siny) (cosy) (sinz) (cosz) (screenwidth)\nset [_xmin v] to (x)\nset [_xmax v] to (x)\nset [_ymin v] to (y)\nset [_ymax v] to (y)\nset [_zmin v] to (z)\nset [_zmax v] to (z)\nset [_i0 v] to (((screenwidth) / (180)) * ((fov) * (farz)))\nset [_i1 v] to ((fov) * (farz))\nset [_i2 v] to (farz)\nReverse Rotate (_i0) (_i1) (_i2) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n_getBoundsInner ((x) + (_rotatedX)) ((y) + (_rotatedY)) ((z) + (_rotatedZ))\nReverse Rotate (_i0) ((-1) * (_i1)) (_i2) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n_getBoundsInner ((x) + (_rotatedX)) ((y) + (_rotatedY)) ((z) + (_rotatedZ))\nReverse Rotate ((-1) * (_i0)) (_i1) (_i2) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n_getBoundsInner ((x) + (_rotatedX)) ((y) + (_rotatedY)) ((z) + (_rotatedZ))\nReverse Rotate ((-1) * (_i0)) ((-1) * (_i1)) (_i2) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\n_getBoundsInner ((x) + (_rotatedX)) ((y) + (_rotatedY)) ((z) + (_rotatedZ))\nchange [_xmin v] by (-4)\nchange [_xmax v] by (4)\nchange [_ymin v] by (-4)\nchange [_ymax v] by (4)\nchange [_zmin v] by (-4)\nchange [_zmax v] by (4)\n\ndefine _clipQuads (nearz) (fov) (farz) (xmin) (xmax) (ymin) (ymax)\ndelete all of [_tmpx v]\ndelete all of [_tmpy v]\ndelete all of [_tmpz v]\ndelete all of [_tmpparent v]\nset [_i0 v] to [1]\nrepeat (length of [_qdparent v])\n    set [_id0 v] to ((4) * (_i0))\n    _clipQuadFull (nearz) (fov) (farz) (xmin) (xmax) (ymin) (ymax) (item ((_id0) - (3)) of [_qdx v]) (item ((_id0) - (3)) of [_qdy v]) (item ((_id0) - (3)) of [_qdz v]) (item ((_id0) - (2)) of [_qdx v]) (item ((_id0) - (2)) of [_qdy v]) (item ((_id0) - (2)) of [_qdz v]) (item ((_id0) - (1)) of [_qdx v]) (item ((_id0) - (1)) of [_qdy v]) (item ((_id0) - (1)) of [_qdz v]) (item (_id0) of [_qdx v]) (item (_id0) of [_qdy v]) (item (_id0) of [_qdz v]) (item (_i0) of [_qdparent v])\n    change [_i0 v] by (1)\nend\n_copyTmpToQd\n\ndefine _clipQuadFull (nearz) (fov) (farz) (xmin) (xmax) (ymin) (ymax) (x0) (y0) (z0) (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) (parent)\nif <not <<(z0) > (nearz)> or <<(z1) > (nearz)> or <(z2) > (nearz)>>>> then\n    if <<(x3) = [_]> or <not <(z3) > (nearz)>>> then\n        stop [this script v]\n    end\nend\ndelete all of [_splitbehind v]\nif <not <(z0) < (nearz)>> then\n    add ((x0) / ((fov) * (z0))) to [_splitbehind v]\n    add ((y0) / ((fov) * (z0))) to [_splitbehind v]\n    add ((1) / (z0)) to [_splitbehind v]\nend\nset [_lerp0 v] to (((nearz) - (z0)) / ((z1) - (z0)))\nif <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n    add (((((1) - (_lerp0)) * (x0)) + ((_lerp0) * (x1))) / ((fov) * (nearz))) to [_splitbehind v]\n    add (((((1) - (_lerp0)) * (y0)) + ((_lerp0) * (y1))) / ((fov) * (nearz))) to [_splitbehind v]\n    add ((1) / (nearz)) to [_splitbehind v]\nend\nif <not <(z1) < (nearz)>> then\n    add ((x1) / ((fov) * (z1))) to [_splitbehind v]\n    add ((y1) / ((fov) * (z1))) to [_splitbehind v]\n    add ((1) / (z1)) to [_splitbehind v]\nend\nset [_lerp0 v] to (((nearz) - (z1)) / ((z2) - (z1)))\nif <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n    add (((((1) - (_lerp0)) * (x1)) + ((_lerp0) * (x2))) / ((fov) * (nearz))) to [_splitbehind v]\n    add (((((1) - (_lerp0)) * (y1)) + ((_lerp0) * (y2))) / ((fov) * (nearz))) to [_splitbehind v]\n    add ((1) / (nearz)) to [_splitbehind v]\nend\nif <(x3) = [_]> then\n    if <not <(z2) < (nearz)>> then\n        add ((x2) / ((fov) * (z2))) to [_splitbehind v]\n        add ((y2) / ((fov) * (z2))) to [_splitbehind v]\n        add ((1) / (z2)) to [_splitbehind v]\n    end\n    set [_lerp0 v] to (((nearz) - (z2)) / ((z0) - (z2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add (((((1) - (_lerp0)) * (x2)) + ((_lerp0) * (x0))) / ((fov) * (nearz))) to [_splitbehind v]\n        add (((((1) - (_lerp0)) * (y2)) + ((_lerp0) * (y0))) / ((fov) * (nearz))) to [_splitbehind v]\n        add ((1) / (nearz)) to [_splitbehind v]\n    end\nelse\n    if <not <(z2) < (nearz)>> then\n        add ((x2) / ((fov) * (z2))) to [_splitbehind v]\n        add ((y2) / ((fov) * (z2))) to [_splitbehind v]\n        add ((1) / (z2)) to [_splitbehind v]\n    end\n    set [_lerp0 v] to (((nearz) - (z2)) / ((z3) - (z2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add (((((1) - (_lerp0)) * (x2)) + ((_lerp0) * (x3))) / ((fov) * (nearz))) to [_splitbehind v]\n        add (((((1) - (_lerp0)) * (y2)) + ((_lerp0) * (y3))) / ((fov) * (nearz))) to [_splitbehind v]\n        add ((1) / (nearz)) to [_splitbehind v]\n    end\n    if <not <(z3) < (nearz)>> then\n        add ((x3) / ((fov) * (z3))) to [_splitbehind v]\n        add ((y3) / ((fov) * (z3))) to [_splitbehind v]\n        add ((1) / (z3)) to [_splitbehind v]\n    end\n    set [_lerp0 v] to (((nearz) - (z3)) / ((z0) - (z3)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add (((((1) - (_lerp0)) * (x3)) + ((_lerp0) * (x0))) / ((fov) * (nearz))) to [_splitbehind v]\n        add (((((1) - (_lerp0)) * (y3)) + ((_lerp0) * (y0))) / ((fov) * (nearz))) to [_splitbehind v]\n        add ((1) / (nearz)) to [_splitbehind v]\n    end\nend\nif <(length of [_splitbehind v]) < [9]> then\n    stop [this script v]\nend\nset [_i1 v] to [1]\nif <(farz) > [0]> then\n    set [_tri0 v] to (item (1) of [_splitbehind v])\n    set [_tri1 v] to (item (2) of [_splitbehind v])\n    set [_tri2 v] to (item (3) of [_splitbehind v])\n    repeat (((length of [_splitbehind v]) / (3)) - (1))\n        set [_tri3 v] to (item ((_i1) + (3)) of [_splitbehind v])\n        set [_tri4 v] to (item ((_i1) + (4)) of [_splitbehind v])\n        set [_tri5 v] to (item ((_i1) + (5)) of [_splitbehind v])\n        if <not <(_tri2) < (farz)>> then\n            add (_tri0) to [_splitbehind v]\n            add (_tri1) to [_splitbehind v]\n            add (_tri2) to [_splitbehind v]\n        end\n        set [_lerp0 v] to (((farz) - (_tri2)) / ((_tri5) - (_tri2)))\n        if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n            add ((((1) - (_lerp0)) * (_tri0)) + ((_lerp0) * (_tri3))) to [_splitbehind v]\n            add ((((1) - (_lerp0)) * (_tri1)) + ((_lerp0) * (_tri4))) to [_splitbehind v]\n            add (farz) to [_splitbehind v]\n        end\n        set [_tri0 v] to (_tri3)\n        set [_tri1 v] to (_tri4)\n        set [_tri2 v] to (_tri5)\n        change [_i1 v] by (3)\n    end\n    set [_tri3 v] to (item (1) of [_splitbehind v])\n    set [_tri4 v] to (item (2) of [_splitbehind v])\n    set [_tri5 v] to (item (3) of [_splitbehind v])\n    if <not <(_tri2) < (farz)>> then\n        add (_tri0) to [_splitbehind v]\n        add (_tri1) to [_splitbehind v]\n        add (_tri2) to [_splitbehind v]\n    end\n    set [_lerp0 v] to (((farz) - (_tri2)) / ((_tri5) - (_tri2)))\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add ((((1) - (_lerp0)) * (_tri0)) + ((_lerp0) * (_tri3))) to [_splitbehind v]\n        add ((((1) - (_lerp0)) * (_tri1)) + ((_lerp0) * (_tri4))) to [_splitbehind v]\n        add (farz) to [_splitbehind v]\n    end\n    change [_i1 v] by (3)\nend\nif <((length of [_splitbehind v]) - ((_i1) - (1))) < [9]> then\n    stop [this script v]\nend\nset [_i2 v] to (_i1)\nset [_tri0 v] to (item (_i2) of [_splitbehind v])\nset [_tri1 v] to (item ((_i2) + (1)) of [_splitbehind v])\nset [_tri2 v] to (item ((_i2) + (2)) of [_splitbehind v])\nrepeat ((((length of [_splitbehind v]) - ((_i1) - (1))) / (3)) - (1))\n    set [_tri3 v] to (item ((_i1) + (3)) of [_splitbehind v])\n    set [_tri4 v] to (item ((_i1) + (4)) of [_splitbehind v])\n    set [_tri5 v] to (item ((_i1) + (5)) of [_splitbehind v])\n    if <not <<(_tri0) < (xmin)> or <(_tri0) > (xmax)>>> then\n        add (_tri0) to [_splitbehind v]\n        add (_tri1) to [_splitbehind v]\n        add (_tri2) to [_splitbehind v]\n    end\n    set [_lerp0 v] to (((xmin) - (_tri0)) / ((_tri3) - (_tri0)))\n    set [_lerp1 v] to (((xmax) - (_tri0)) / ((_tri3) - (_tri0)))\n    if <(_lerp0) > (_lerp1)> then\n        set [_i3 v] to (_lerp1)\n        set [_lerp1 v] to (_lerp0)\n        set [_lerp0 v] to (_i3)\n    end\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add ((((1) - (_lerp0)) * (_tri0)) + ((_lerp0) * (_tri3))) to [_splitbehind v]\n        add ((((1) - (_lerp0)) * (_tri1)) + ((_lerp0) * (_tri4))) to [_splitbehind v]\n        add ((((1) - (_lerp0)) * (_tri2)) + ((_lerp0) * (_tri5))) to [_splitbehind v]\n    end\n    if <<(_lerp1) > [0]> and <(_lerp1) < [1]>> then\n        add ((((1) - (_lerp1)) * (_tri0)) + ((_lerp1) * (_tri3))) to [_splitbehind v]\n        add ((((1) - (_lerp1)) * (_tri1)) + ((_lerp1) * (_tri4))) to [_splitbehind v]\n        add ((((1) - (_lerp1)) * (_tri2)) + ((_lerp1) * (_tri5))) to [_splitbehind v]\n    end\n    set [_tri0 v] to (_tri3)\n    set [_tri1 v] to (_tri4)\n    set [_tri2 v] to (_tri5)\n    change [_i1 v] by (3)\nend\nset [_tri3 v] to (item (_i2) of [_splitbehind v])\nset [_tri4 v] to (item ((_i2) + (1)) of [_splitbehind v])\nset [_tri5 v] to (item ((_i2) + (2)) of [_splitbehind v])\nif <not <<(_tri0) < (xmin)> or <(_tri0) > (xmax)>>> then\n    add (_tri0) to [_splitbehind v]\n    add (_tri1) to [_splitbehind v]\n    add (_tri2) to [_splitbehind v]\nend\nset [_lerp0 v] to (((xmin) - (_tri0)) / ((_tri3) - (_tri0)))\nset [_lerp1 v] to (((xmax) - (_tri0)) / ((_tri3) - (_tri0)))\nif <(_lerp0) > (_lerp1)> then\n    set [_i3 v] to (_lerp1)\n    set [_lerp1 v] to (_lerp0)\n    set [_lerp0 v] to (_i3)\nend\nif <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n    add ((((1) - (_lerp0)) * (_tri0)) + ((_lerp0) * (_tri3))) to [_splitbehind v]\n    add ((((1) - (_lerp0)) * (_tri1)) + ((_lerp0) * (_tri4))) to [_splitbehind v]\n    add ((((1) - (_lerp0)) * (_tri2)) + ((_lerp0) * (_tri5))) to [_splitbehind v]\nend\nif <<(_lerp1) > [0]> and <(_lerp1) < [1]>> then\n    add ((((1) - (_lerp1)) * (_tri0)) + ((_lerp1) * (_tri3))) to [_splitbehind v]\n    add ((((1) - (_lerp1)) * (_tri1)) + ((_lerp1) * (_tri4))) to [_splitbehind v]\n    add ((((1) - (_lerp1)) * (_tri2)) + ((_lerp1) * (_tri5))) to [_splitbehind v]\nend\nchange [_i1 v] by (3)\nif <((length of [_splitbehind v]) - ((_i1) - (1))) < [9]> then\n    stop [this script v]\nend\nset [_i2 v] to (_i1)\nset [_tri0 v] to (item (_i2) of [_splitbehind v])\nset [_tri1 v] to (item ((_i2) + (1)) of [_splitbehind v])\nset [_tri2 v] to (item ((_i2) + (2)) of [_splitbehind v])\nrepeat ((((length of [_splitbehind v]) - ((_i1) - (1))) / (3)) - (1))\n    set [_tri3 v] to (item ((_i1) + (3)) of [_splitbehind v])\n    set [_tri4 v] to (item ((_i1) + (4)) of [_splitbehind v])\n    set [_tri5 v] to (item ((_i1) + (5)) of [_splitbehind v])\n    if <not <<(_tri1) < (ymin)> or <(_tri1) > (ymax)>>> then\n        add (_tri0) to [_splitbehind v]\n        add (_tri1) to [_splitbehind v]\n        add (_tri2) to [_splitbehind v]\n    end\n    set [_lerp0 v] to (((ymin) - (_tri1)) / ((_tri4) - (_tri1)))\n    set [_lerp1 v] to (((ymax) - (_tri1)) / ((_tri4) - (_tri1)))\n    if <(_lerp0) > (_lerp1)> then\n        set [_i3 v] to (_lerp1)\n        set [_lerp1 v] to (_lerp0)\n        set [_lerp0 v] to (_i3)\n    end\n    if <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n        add ((((1) - (_lerp0)) * (_tri0)) + ((_lerp0) * (_tri3))) to [_splitbehind v]\n        add ((((1) - (_lerp0)) * (_tri1)) + ((_lerp0) * (_tri4))) to [_splitbehind v]\n        add ((((1) - (_lerp0)) * (_tri2)) + ((_lerp0) * (_tri5))) to [_splitbehind v]\n    end\n    if <<(_lerp1) > [0]> and <(_lerp1) < [1]>> then\n        add ((((1) - (_lerp1)) * (_tri0)) + ((_lerp1) * (_tri3))) to [_splitbehind v]\n        add ((((1) - (_lerp1)) * (_tri1)) + ((_lerp1) * (_tri4))) to [_splitbehind v]\n        add ((((1) - (_lerp1)) * (_tri2)) + ((_lerp1) * (_tri5))) to [_splitbehind v]\n    end\n    set [_tri0 v] to (_tri3)\n    set [_tri1 v] to (_tri4)\n    set [_tri2 v] to (_tri5)\n    change [_i1 v] by (3)\nend\nset [_tri3 v] to (item (_i2) of [_splitbehind v])\nset [_tri4 v] to (item ((_i2) + (1)) of [_splitbehind v])\nset [_tri5 v] to (item ((_i2) + (2)) of [_splitbehind v])\nif <not <<(_tri1) < (ymin)> or <(_tri1) > (ymax)>>> then\n    add (_tri0) to [_splitbehind v]\n    add (_tri1) to [_splitbehind v]\n    add (_tri2) to [_splitbehind v]\nend\nset [_lerp0 v] to (((ymin) - (_tri1)) / ((_tri4) - (_tri1)))\nset [_lerp1 v] to (((ymax) - (_tri1)) / ((_tri4) - (_tri1)))\nif <(_lerp0) > (_lerp1)> then\n    set [_i3 v] to (_lerp1)\n    set [_lerp1 v] to (_lerp0)\n    set [_lerp0 v] to (_i3)\nend\nif <<(_lerp0) > [0]> and <(_lerp0) < [1]>> then\n    add ((((1) - (_lerp0)) * (_tri0)) + ((_lerp0) * (_tri3))) to [_splitbehind v]\n    add ((((1) - (_lerp0)) * (_tri1)) + ((_lerp0) * (_tri4))) to [_splitbehind v]\n    add ((((1) - (_lerp0)) * (_tri2)) + ((_lerp0) * (_tri5))) to [_splitbehind v]\nend\nif <<(_lerp1) > [0]> and <(_lerp1) < [1]>> then\n    add ((((1) - (_lerp1)) * (_tri0)) + ((_lerp1) * (_tri3))) to [_splitbehind v]\n    add ((((1) - (_lerp1)) * (_tri1)) + ((_lerp1) * (_tri4))) to [_splitbehind v]\n    add ((((1) - (_lerp1)) * (_tri2)) + ((_lerp1) * (_tri5))) to [_splitbehind v]\nend\nchange [_i1 v] by (3)\n_addSplitBehindToTmp (_i1) (parent)\n\n@FontEngine\n\ndefine _calcWW (text) (width) (firstwidth) (cspace) (spacewidth)\ndelete all of [_ww0 v]\ndelete all of [_ww1 v]\ndelete all of [_ww2 v]\nset [_i3 v] to [1]\nset [_i4 v] to [0]\nset [_i5 v] to [0]\nset [_i6 v] to [0]\nset [_i7 v] to (firstwidth)\nset [_i8 v] to [0]\nrepeat (length of (text))\n    if <(letter (_i3) of (text)) = [ ]> then\n        if <(_i4) = [0]> then\n            if <((_i7) + ((_i5) - (cspace))) > (width)> then\n                insert [1] at (1) of [_ww0 v] \n                add [0] to [_ww1 v]\n                add [0] to [_ww2 v]\n                set [_i6 v] to [1]\n            end\n            change [_i7 v] by ((_i5) - (cspace))\n        else\n            if <((_i7) + ((spacewidth) + (_i5))) > (width)> then\n                if <(_i4) > (_i6)> then\n                    add (_i7) to [_ww1 v]\n                    add (((_i4) - (_i6)) - (1)) to [_ww2 v]\n                end\n                set [_i6 v] to (_i4)\n                set [_i7 v] to ((_i5) - (cspace))\n            else\n                change [_i7 v] by ((spacewidth) + (_i5))\n            end\n        end\n        add [1] to [_ww0 v]\n        set [_i4 v] to (length of [_ww0 v])\n        set [_i5 v] to [0]\n        set [_i8 v] to [0]\n    else\n        switch costume to (blank v)\n        switch costume to (join (letter (_i3) of (text)) [_])\n        set [_i9 v] to ((costume [number v]) - (1))\n        if <(_i9) > [0]> then\n            set [_ia v] to (item (_i9) of [_chwidth v])\n            set [_ib v] to (item (_i9) of [_chkern v])\n            set [_ib v] to ((join (join (letter ((_i8) - (3)) of (_ib)) (letter ((_i8) - (2)) of (_ib))) (join (letter ((_i8) - (1)) of (_ib)) (letter (_i8) of (_ib)))) / (1000))\n            if <((_i5) + ((_ib) + (_ia))) > (width)> then\n                if <(_i4) > (_i6)> then\n                    add (_i7) to [_ww1 v]\n                    add (((_i4) - (_i6)) - (1)) to [_ww2 v]\n                end\n                add ((_i5) - (cspace)) to [_ww1 v]\n                add ((length of [_ww0 v]) - (_i4)) to [_ww2 v]\n                add [1] to [_ww0 v]\n                set [_i4 v] to (length of [_ww0 v])\n                set [_i5 v] to ((_ia) + (cspace))\n                set [_i6 v] to (_i4)\n                set [_i7 v] to ((-1) * ((cspace) + (spacewidth)))\n            else\n                change [_i5 v] by (((_ib) + (_ia)) + (cspace))\n            end\n            add (_i9) to [_ww0 v]\n        end\n        set [_i8 v] to ((4) * (_i9))\n    end\n    change [_i3 v] by (1)\nend\nif <(length of [_ww0 v]) > (_i6)> then\n    if <(_i4) = [0]> then\n        if <((_i7) + ((_i5) - (cspace))) > (width)> then\n            insert [1] at (1) of [_ww0 v] \n            add [0] to [_ww1 v]\n            add [0] to [_ww2 v]\n            set [_i6 v] to [1]\n        end\n        change [_i7 v] by ((_i5) - (cspace))\n    else\n        if <((_i7) + ((spacewidth) + (_i5))) > (width)> then\n            if <(_i4) > (_i6)> then\n                add (_i7) to [_ww1 v]\n                add (((_i4) - (_i6)) - (1)) to [_ww2 v]\n            end\n            set [_i6 v] to (_i4)\n            set [_i7 v] to ((_i5) - (cspace))\n        else\n            change [_i7 v] by ((spacewidth) + (_i5))\n        end\n    end\n    add (_i7) to [_ww1 v]\n    add ((length of [_ww0 v]) - (_i6)) to [_ww2 v]\nend\n\ndefine _sortRaster (lo) (hi)\nset [_i4 v] to ([ceiling v] of ((((hi) - (lo)) + (1)) / (4)) )\nrepeat until <(_i4) < [1]>\n    set [_i5 v] to ((lo) + (_i4))\n    set [_i4 v] to ((-1) * (_i4))\n    set [_i6 v] to (_i5)\n    repeat (((hi) + (1)) - (_i6))\n        set [_i7 v] to (item (_i6) of [_raster v])\n        set [_i9 v] to (item (_i6) of [_rasterdir v])\n        set [_i8 v] to (_i6)\n        repeat until <<(_i8) < (_i5)> or <not <(item ((_i8) + (_i4)) of [_raster v]) > (_i7)>>>\n            replace item (_i8) of [_raster v] with (item ((_i8) + (_i4)) of [_raster v])\n            replace item (_i8) of [_rasterdir v] with (item ((_i8) + (_i4)) of [_rasterdir v])\n            change [_i8 v] by (_i4)\n        end\n        replace item (_i8) of [_raster v] with (_i7)\n        replace item (_i8) of [_rasterdir v] with (_i9)\n        change [_i6 v] by (1)\n    end\n    if <(_i4) = [-2]> then\n        set [_i4 v] to [1]\n    else\n        set [_i4 v] to ([floor v] of ((_i4) / (-2.25)) )\n    end\nend\n\nwhen flag clicked\npen up\nhide\nswitch costume to (blank v)\nset size to (100000) %\nswitch costume to ( _ v)\ngo to x: (0) y: (0)\npoint in direction (90)\nset rotation style [don't rotate v]\nif <is compiled?> then\n    Set Scaling | Factor [3]\nelse\n    Set Scaling | Factor [auto]\nend\nset [sky_color v] to [4177919]\n\ndefine Clear | Cache\nset [_i0 v] to [1]\nrepeat (length of [_chindex v])\n    set [_i1 v] to ((item (_i0) of [_chindex v]) + (2))\n    repeat (20)\n        replace item (_i1) of [_chdata0 v] with []\n        replace item (_i1) of [_chdata1 v] with []\n        replace item (_i1) of [_chdata2 v] with []\n        replace item (_i1) of [_chdata3 v] with []\n        replace item (_i1) of [_chdata4 v] with []\n        change [_i1 v] by (1)\n    end\n    change [_i0 v] by (1)\nend\ndelete all of [_cacheidx v]\ndelete all of [_cache0 v]\ndelete all of [_cache1 v]\ndelete all of [_raster v]\ndelete all of [_rasterdir v]\nset [_cid v] to [0]\n\ndefine Clear | Character Data\nswitch costume to (blank v)\nswitch costume to ((costume [number v]) - (1))\nif <((costume [number v]) - (1)) > (length of [_chindex v])> then\n    set [_i0 v] to ((costume [number v]) - (1))\nelse\n    set [_i0 v] to (length of [_chindex v])\nend\ndelete all of [_chindex v]\ndelete all of [_chwidth v]\ndelete all of [_chkern v]\ndelete all of [_chdata0 v]\ndelete all of [_chdata1 v]\ndelete all of [_chdata2 v]\ndelete all of [_chdata3 v]\ndelete all of [_chdata4 v]\nrepeat (_i0)\n    add [__] to [_chdata0 v]\n    add [none] to [_chdata1 v]\n    add [] to [_chdata2 v]\n    add [] to [_chdata3 v]\n    add [] to [_chdata4 v]\n    add (length of [_chdata0 v]) to [_chindex v]\n    add ((1) * (0)) to [_chwidth v]\n    add [] to [_chkern v]\n    repeat (110)\n        add [] to [_chdata0 v]\n        add [] to [_chdata1 v]\n        add [] to [_chdata2 v]\n        add [] to [_chdata3 v]\n        add [] to [_chdata4 v]\n    end\nend\nadd [__] to [_chdata0 v]\nadd [none] to [_chdata1 v]\nadd [] to [_chdata2 v]\nadd [] to [_chdata3 v]\nadd [] to [_chdata4 v]\ndelete all of [_cacheidx v]\ndelete all of [_cache0 v]\ndelete all of [_cache1 v]\ndelete all of [_raster v]\ndelete all of [_rasterdir v]\nset [_cid v] to [0]\n\ndefine Load | Font (fontname)\nset [_i0 v] to (item # of (fontname) in [_fontname v])\nif <(_i0) < [1]> then\n    stop [this script v]\nend\nset [_i0 v] to (item (_i0) of [_fontindex v])\nset [_i1 v] to (item (_i0) of [_fontdata v])\nchange [_i0 v] by (2)\nrepeat (item ((_i0) - (1)) of [_fontdata v])\n    set [_i2 v] to (item (_i0) of [_fontdata v])\n    replace item (_i2) of [_chwidth v] with (item ((_i0) + (1)) of [_fontdata v])\n    replace item (_i2) of [_chkern v] with (item ((_i0) + (2)) of [_fontdata v])\n    set [_i2 v] to (item (_i2) of [_chindex v])\n    replace item (_i2) of [_chdata1 v] with (_i1)\n    replace item (_i2) of [_chdata2 v] with (item ((_i0) + (3)) of [_fontdata v])\n    replace item (_i2) of [_chdata3 v] with (item ((_i0) + (4)) of [_fontdata v])\n    replace item ((_i2) + (1)) of [_chdata2 v] with (item ((_i0) + (5)) of [_fontdata v])\n    replace item ((_i2) + (1)) of [_chdata3 v] with (item ((_i0) + (6)) of [_fontdata v])\n    if <([abs v] of (item ((_i2) + (1)) of [_chdata3 v]) ) > ([abs v] of (item ((_i2) + (1)) of [_chdata2 v]) )> then\n        replace item ((_i2) + (1)) of [_chdata4 v] with ((4) * ([abs v] of (item ((_i2) + (1)) of [_chdata3 v]) ))\n    else\n        replace item ((_i2) + (1)) of [_chdata4 v] with ((4) * ([abs v] of (item ((_i2) + (1)) of [_chdata2 v]) ))\n    end\n    replace item ((_i2) + (22)) of [_chdata0 v] with [string]\n    replace item ((_i2) + (22)) of [_chdata1 v] with (item ((_i0) + (7)) of [_fontdata v])\n    change [_i0 v] by (8)\nend\n\ndefine _printChar (id) (x) (y) (size) (min) (max) (new)\nset [_i2 v] to (item (id) of [_chindex v])\nset [_i3 v] to (item (_i2) of [_chdata1 v])\nif <(_i3) = [none]> then\n    stop [this script v]\nend\nif <((y) + ((size) * (item ((_i2) + (1)) of [_chdata3 v]))) < [-184]> then\n    stop [this script v]\nend\nif <((x) + ((size) * (item (_i2) of [_chdata2 v]))) > [244]> then\n    stop [this script v]\nend\nif <((x) + ((size) * (item (_i2) of [_chdata3 v]))) < [-244]> then\n    stop [this script v]\nend\nif <((y) + ((size) * (item ((_i2) + (1)) of [_chdata2 v]))) > [184]> then\n    stop [this script v]\nend\nif <(item ((_i2) + (22)) of [_chdata0 v]) = [0]> then\n    stop [this script v]\nend\nset [_i4 v] to ((_i2) + (2))\nrepeat (20)\n    if <(item (_i4) of [_chdata0 v]) = (_i3)> then\n        set [_i5 v] to (item (_i4) of [_chdata1 v])\n        if <not <(_i5) < (min)>> then\n            if <not <(_i5) > (max)>> then\n                if <(_i4) > ((_i2) + (2))> then\n                    set [_i6 v] to (item (_i4) of [_chdata2 v])\n                    set [_i7 v] to (item (_i4) of [_chdata3 v])\n                    set [_i8 v] to (item (_i4) of [_chdata4 v])\n                    repeat ((_i4) - ((_i2) + (2)))\n                        replace item (_i4) of [_chdata0 v] with (item ((_i4) - (1)) of [_chdata0 v])\n                        replace item (_i4) of [_chdata1 v] with (item ((_i4) - (1)) of [_chdata1 v])\n                        replace item (_i4) of [_chdata2 v] with (item ((_i4) - (1)) of [_chdata2 v])\n                        replace item (_i4) of [_chdata3 v] with (item ((_i4) - (1)) of [_chdata3 v])\n                        replace item (_i4) of [_chdata4 v] with (item ((_i4) - (1)) of [_chdata4 v])\n                        change [_i4 v] by (-1)\n                    end\n                    replace item (_i4) of [_chdata0 v] with (item (_i2) of [_chdata1 v])\n                    replace item (_i4) of [_chdata1 v] with (_i5)\n                    replace item (_i4) of [_chdata2 v] with (_i6)\n                    replace item (_i4) of [_chdata3 v] with (_i7)\n                    replace item (_i4) of [_chdata4 v] with (_i8)\n                end\n                set [_i8 v] to (item ((_i2) + (2)) of [_chdata1 v])\n                set [_i9 v] to (round ((_i8) * (item (_i2) of [_chdata2 v])))\n                set x to ((x) + (((_i9) + (0.5)) * ((size) / (_i8))))\n                set [_i7 v] to (item ((_i2) + (2)) of [_chdata3 v])\n                if <(_i7) = []> then\n                    set [_i4 v] to (item ((_i2) + (2)) of [_chdata2 v])\n                    set [_i5 v] to ((size) / ((4) * (_i8)))\n                    if <(letter (1) of (_i4)) = [3]> then\n                        _drawChar3 (_i4) ((y) - ((500) * (_i5))) ((round ((_i8) * (item (_i2) of [_chdata3 v]))) - (_i9)) ((size) / (_i8)) (_i5)\n                    else\n                        _drawChar4 (_i4) ((y) - ((5000) * (_i5))) ((round ((_i8) * (item (_i2) of [_chdata3 v]))) - (_i9)) ((size) / (_i8)) (_i5)\n                    end\n                else\n                    change [_cid v] by (1)\n                    if <not <(item (_i7) of [_cacheidx v]) = (item ((_i2) + (2)) of [_chdata4 v])>> then\n                        _createCache (item ((_i2) + (2)) of [_chdata2 v]) ((_i2) + (2)) ((round ((_i8) * (item (_i2) of [_chdata3 v]))) - (_i9))\n                        set [_i7 v] to (_i3)\n                    end\n                    replace item ((_i7) + (1)) of [_cacheidx v] with (_cID)\n                    _drawCache (item ((_i7) + (2)) of [_cacheidx v]) (y) ((round ((_i8) * (item (_i2) of [_chdata3 v]))) - (_i9)) ((size) / (_i8)) ((size) / ((4) * (_i8)))\n                end\n                stop [this script v]\n            end\n        end\n    end\n    change [_i4 v] by (1)\nend\nif <((new) * ((item (_i2) of [_chdata3 v]) - (item (_i2) of [_chdata2 v]))) > [4850]> then\n    stop [this script v]\nend\nif <((new) * (item ((_i2) + (1)) of [_chdata4 v])) > [4950]> then\n    stop [this script v]\nend\nrepeat (19)\n    change [_i4 v] by (-1)\n    replace item (_i4) of [_chdata0 v] with (item ((_i4) - (1)) of [_chdata0 v])\n    replace item (_i4) of [_chdata1 v] with (item ((_i4) - (1)) of [_chdata1 v])\n    replace item (_i4) of [_chdata2 v] with (item ((_i4) - (1)) of [_chdata2 v])\n    replace item (_i4) of [_chdata3 v] with (item ((_i4) - (1)) of [_chdata3 v])\n    replace item (_i4) of [_chdata4 v] with (item ((_i4) - (1)) of [_chdata4 v])\nend\nset [_i4 v] to ((_i2) + (22))\nif <(item (_i4) of [_chdata0 v]) = [string]> then\n    _unpackDef (id) (_i4) (item (_i4) of [_chdata1 v])\nend\nif <(item (_i4) of [_chdata0 v]) = [0]> then\n    stop [this script v]\nend\nset [_i5 v] to (round ((new) * (item (_i2) of [_chdata2 v])))\n_rasterizeChar (_i4) (new) ((round ((new) * (item (_i2) of [_chdata3 v]))) - (_i5)) ((0) - (_i5))\nset [_i3 v] to (round ((new) * (item (_i2) of [_chdata2 v])))\nset x to ((x) + (((_i3) + (0.5)) * ((size) / (new))))\nset [_i6 v] to (item ((_i2) + (2)) of [_chdata3 v])\nif <(_i6) = []> then\n    set [_i4 v] to (item ((_i2) + (2)) of [_chdata2 v])\n    set [_i5 v] to ((size) / ((4) * (new)))\n    if <(letter (1) of (_i4)) = [3]> then\n        _drawChar3 (_i4) ((y) - ((500) * (_i5))) ((round ((new) * (item (_i2) of [_chdata3 v]))) - (_i3)) ((size) / (new)) (_i5)\n    else\n        _drawChar4 (_i4) ((y) - ((5000) * (_i5))) ((round ((new) * (item (_i2) of [_chdata3 v]))) - (_i3)) ((size) / (new)) (_i5)\n    end\nelse\n    _drawCache (item ((_i6) + (2)) of [_cacheidx v]) (y) ((round ((new) * (item (_i2) of [_chdata3 v]))) - (_i3)) ((size) / (new)) ((size) / ((4) * (new)))\nend\n\ndefine Set Pen Color | RGBA (r) (g) (b) (a)\nset pen color to ((round (b)) + ((256) * ((round (g)) + ((256) * ((round (r)) + ((256) * (round (a))))))))\n\ndefine _rasterizeChar (idx) (s) (columns) (o)\nrepeat (((41) * (columns)) - (length of [_raster v]))\n    add [] to [_raster v]\nend\nrepeat (((41) * (columns)) - (length of [_rasterdir v]))\n    add [] to [_rasterdir v]\nend\nset [_i3 v] to [1]\nrepeat (columns)\n    replace item (_i3) of [_raster v] with [0]\n    change [_i3 v] by (41)\nend\nset [_i3 v] to ((idx) + (1))\nrepeat (item (idx) of [_chdata0 v])\n    if <(letter (2) of (item (_i3) of [_chdata0 v])) = [+]> then\n        set [_i9 v] to ((1) * (1))\n    else\n        set [_i9 v] to ((1) * (-1))\n    end\n    if <(letter (1) of (item (_i3) of [_chdata0 v])) = [Q]> then\n        set [_i4 v] to (item (_i3) of [_chdata3 v])\n        set [_i5 v] to (round ((s) * (item (_i3) of [_chdata1 v])))\n        set [_i7 v] to (((41) * ((_i5) + (o))) + (1))\n        if <(_i4) = [z]> then\n            _rasterizeCurve [z] ((1) / ((item ((_i3) + (1)) of [_chdata0 v]) * (s))) [] [] ((((_i5) + (0.5)) / (s)) - (item ((_i3) + (1)) of [_chdata1 v])) ((s) * (item ((_i3) + (1)) of [_chdata2 v])) ((s) * (item ((_i3) + (1)) of [_chdata3 v])) ((s) * (item ((_i3) + (1)) of [_chdata4 v])) ((round ((s) * (item (_i3) of [_chdata2 v]))) - (_i5))\n        else\n            set [_i8 v] to (item ((_i3) + (1)) of [_chdata0 v])\n            set [_i6 v] to ((item (_i3) of [_chdata4 v]) / (_i8))\n            _rasterizeCurve (_i4) (_i6) (((_i6) * (_i6)) + (1e-7)) ((4) / ((41) * ((s) * (_i8)))) ((((41) * (s)) * ((item ((_i3) + (1)) of [_chdata1 v]) - (((_i5) + (0.5)) / (s)))) + (_i7)) ((s) * (item ((_i3) + (1)) of [_chdata2 v])) ((s) * (item ((_i3) + (1)) of [_chdata3 v])) ((s) * (item ((_i3) + (1)) of [_chdata4 v])) ((round ((s) * (item (_i3) of [_chdata2 v]))) - (_i5))\n        end\n        change [_i3 v] by (2)\n    else\n        set [_i4 v] to (round ((s) * (item (_i3) of [_chdata1 v])))\n        set [_i5 v] to (item (_i3) of [_chdata4 v])\n        set [_i7 v] to (((41) * ((_i4) + (o))) + (1))\n        if <(_i5) = [0]> then\n            set [_i9 v] to ((0.75) * (_i9))\n            set [_i6 v] to ((s) * (item (_i3) of [_chdata3 v]))\n            repeat ((round ((s) * (item (_i3) of [_chdata2 v]))) - (_i4))\n                set [_i8 v] to ((item (_i7) of [_raster v]) + (1))\n                replace item ((_i7) + (_i8)) of [_rasterdir v] with (_i9)\n                replace item ((_i7) + (_i8)) of [_raster v] with (_i6)\n                replace item (_i7) of [_raster v] with (_i8)\n                change [_i7 v] by (41)\n            end\n        else\n            set [_i6 v] to (((s) * (item (_i3) of [_chdata3 v])) + ((_i5) * (((_i4) + (0.5)) - ((s) * (item (_i3) of [_chdata1 v])))))\n            repeat ((round ((s) * (item (_i3) of [_chdata2 v]))) - (_i4))\n                set [_i8 v] to ((item (_i7) of [_raster v]) + (1))\n                replace item ((_i7) + (_i8)) of [_rasterdir v] with (_i9)\n                replace item ((_i7) + (_i8)) of [_raster v] with (_i6)\n                replace item (_i7) of [_raster v] with (_i8)\n                change [_i7 v] by (41)\n                change [_i6 v] by (_i5)\n            end\n        end\n        change [_i3 v] by (1)\n    end\nend\nset [_i3 v] to [1]\nrepeat (columns)\n    _sortRaster ((_i3) + (1)) ((_i3) + (item (_i3) of [_raster v]))\n    change [_i3 v] by (41)\nend\nset [_i3 v] to ((s) * (item ((_i2) + (1)) of [_chdata4 v]))\nset [_ib v] to [0]\nif <(_i3) < [495]> then\n    set [_i3 v] to [3]\n    set [_i4 v] to [1]\n    repeat (columns)\n        set [_i5 v] to []\n        set [_i6 v] to [0]\n        set [_i7 v] to [0]\n        set [_i8 v] to (_i4)\n        repeat (item (_i8) of [_raster v])\n            change [_i8 v] by (1)\n            if <(_i7) = [0]> then\n                set [_i9 v] to ((item (_i8) of [_raster v]) + (500))\n                if <([abs v] of (item (_i8) of [_rasterdir v]) ) = [0.75]> then\n                    set [_ic v] to [1]\n                else\n                    set [_ic v] to [0]\n                end\n            else\n                if <((_i7) + (round (item (_i8) of [_rasterdir v]))) = [0]> then\n                    set [_ia v] to ((item (_i8) of [_raster v]) + (500))\n                    if <((_ia) - (_i9)) > [4]> then\n                        set [_i9 v] to (round ((_i9) + (2)))\n                        set [_i5 v] to (join (_i5) (join (join ([floor v] of ((_i9) / (100)) ) (([floor v] of ((_i9) / (10)) ) mod (10))) ((_i9) mod (10))))\n                        set [_ia v] to ((round ((_ia) - (2))) - (_i9))\n                        set [_i5 v] to (join (_i5) (join (join ([floor v] of ((_ia) / (100)) ) (([floor v] of ((_ia) / (10)) ) mod (10))) ((_ia) mod (10))))\n                    else\n                        if <([abs v] of (item (_i8) of [_rasterdir v]) ) = [0.75]> then\n                            if <(_ic) = [1]> then\n                                set [_i9 v] to (round (((_i9) + (_ia)) / (2)))\n                            else\n                                set [_i9 v] to (round ((_ia) - (2)))\n                            end\n                        else\n                            if <(_ic) = [1]> then\n                                set [_i9 v] to (round ((_i9) + (2)))\n                            else\n                                set [_i9 v] to (round (((_i9) + (_ia)) / (2)))\n                            end\n                        end\n                        set [_i5 v] to (join (_i5) (join (join (join ([floor v] of ((_i9) / (100)) ) (([floor v] of ((_i9) / (10)) ) mod (10))) ((_i9) mod (10))) [000]))\n                    end\n                    change [_i6 v] by (1)\n                    change [_ib v] by (1)\n                end\n            end\n            change [_i7 v] by (round (item (_i8) of [_rasterdir v]))\n        end\n        set [_i3 v] to (join (_i3) (join (join ([floor v] of ((_i6) / (10)) ) ((_i6) mod (10))) (_i5)))\n        change [_i4 v] by (41)\n        change [_ib v] by (1)\n    end\nelse\n    set [_i3 v] to [4]\n    set [_i4 v] to [1]\n    repeat (columns)\n        set [_i5 v] to []\n        set [_i6 v] to [0]\n        set [_i7 v] to [0]\n        set [_i8 v] to (_i4)\n        repeat (item (_i8) of [_raster v])\n            change [_i8 v] by (1)\n            if <(_i7) = [0]> then\n                set [_i9 v] to ((item (_i8) of [_raster v]) + (5000))\n                if <([abs v] of (item (_i8) of [_rasterdir v]) ) = [0.75]> then\n                    set [_ic v] to [1]\n                else\n                    set [_ic v] to [0]\n                end\n            else\n                if <((_i7) + (round (item (_i8) of [_rasterdir v]))) = [0]> then\n                    set [_ia v] to ((item (_i8) of [_raster v]) + (5000))\n                    if <((_ia) - (_i9)) > [4]> then\n                        set [_i9 v] to (round ((_i9) + (2)))\n                        set [_i5 v] to (join (_i5) (join (join ([floor v] of ((_i9) / (1000)) ) (([floor v] of ((_i9) / (100)) ) mod (10))) (join (([floor v] of ((_i9) / (10)) ) mod (10)) ((_i9) mod (10)))))\n                        set [_ia v] to ((round ((_ia) - (2))) - (_i9))\n                        set [_i5 v] to (join (_i5) (join (join ([floor v] of ((_ia) / (1000)) ) (([floor v] of ((_ia) / (100)) ) mod (10))) (join (([floor v] of ((_ia) / (10)) ) mod (10)) ((_ia) mod (10)))))\n                    else\n                        if <([abs v] of (item (_i8) of [_rasterdir v]) ) = [0.75]> then\n                            if <(_ic) = [1]> then\n                                set [_i9 v] to (round (((_i9) + (_ia)) / (2)))\n                            else\n                                set [_i9 v] to (round ((_ia) - (2)))\n                            end\n                        else\n                            if <(_ic) = [1]> then\n                                set [_i9 v] to (round ((_i9) + (2)))\n                            else\n                                set [_i9 v] to (round (((_i9) + (_ia)) / (2)))\n                            end\n                        end\n                        set [_i5 v] to (join (_i5) (join (join (join ([floor v] of ((_i9) / (1000)) ) (([floor v] of ((_i9) / (100)) ) mod (10))) (join (([floor v] of ((_i9) / (10)) ) mod (10)) ((_i9) mod (10)))) [0000]))\n                    end\n                    change [_i6 v] by (1)\n                    change [_ib v] by (1)\n                end\n            end\n            change [_i7 v] by (round (item (_i8) of [_rasterdir v]))\n        end\n        set [_i3 v] to (join (_i3) (join (join ([floor v] of ((_i6) / (10)) ) ((_i6) mod (10))) (_i5)))\n        change [_i4 v] by (41)\n        change [_ib v] by (1)\n    end\nend\nreplace item ((_i2) + (2)) of [_chdata4 v] with []\nreplace item ((_i2) + (2)) of [_chdata3 v] with []\nreplace item ((_i2) + (2)) of [_chdata2 v] with (_i3)\nreplace item ((_i2) + (2)) of [_chdata1 v] with (s)\nreplace item ((_i2) + (2)) of [_chdata0 v] with (item (_i2) of [_chdata1 v])\nif <not <(_ib) > [109]>> then\n    change [_cid v] by (1)\n    _createCache (_i3) ((_i2) + (2)) (columns)\nend\n\ndefine _unpackDef (id) (idx) (d)\nset [_i5 v] to (length of (d))\nset [_i6 v] to (idx)\nset [_i7 v] to [1]\nset [_i8 v] to [0]\nrepeat until <(_i7) > (_i5)>\n    if <(item (_i6) of [_chdata0 v]) = [__]> then\n        insert [] at (_i6) of [_chdata0 v] \n        insert [] at (_i6) of [_chdata1 v] \n        insert [] at (_i6) of [_chdata2 v] \n        insert [] at (_i6) of [_chdata3 v] \n        insert [] at (_i6) of [_chdata4 v] \n        change [_i8 v] by (1)\n    end\n    set [_i9 v] to []\n    repeat until < [;] contains (letter (_i7) of (d))?>\n        set [_i9 v] to (join (_i9) (letter (_i7) of (d)))\n        change [_i7 v] by (1)\n    end\n    change [_i7 v] by (1)\n    if <(_i9) = ((1) * (_i9))> then\n        replace item (_i6) of [_chdata0 v] with ((1) * (_i9))\n    else\n        replace item (_i6) of [_chdata0 v] with (_i9)\n    end\n    set [_i9 v] to []\n    repeat until < [;] contains (letter (_i7) of (d))?>\n        set [_i9 v] to (join (_i9) (letter (_i7) of (d)))\n        change [_i7 v] by (1)\n    end\n    change [_i7 v] by (1)\n    if <(_i9) = ((1) * (_i9))> then\n        replace item (_i6) of [_chdata1 v] with ((1) * (_i9))\n    else\n        replace item (_i6) of [_chdata1 v] with (_i9)\n    end\n    set [_i9 v] to []\n    repeat until < [;] contains (letter (_i7) of (d))?>\n        set [_i9 v] to (join (_i9) (letter (_i7) of (d)))\n        change [_i7 v] by (1)\n    end\n    change [_i7 v] by (1)\n    if <(_i9) = ((1) * (_i9))> then\n        replace item (_i6) of [_chdata2 v] with ((1) * (_i9))\n    else\n        replace item (_i6) of [_chdata2 v] with (_i9)\n    end\n    set [_i9 v] to []\n    repeat until < [;] contains (letter (_i7) of (d))?>\n        set [_i9 v] to (join (_i9) (letter (_i7) of (d)))\n        change [_i7 v] by (1)\n    end\n    change [_i7 v] by (1)\n    if <(_i9) = ((1) * (_i9))> then\n        replace item (_i6) of [_chdata3 v] with ((1) * (_i9))\n    else\n        replace item (_i6) of [_chdata3 v] with (_i9)\n    end\n    set [_i9 v] to []\n    repeat until < [;] contains (letter (_i7) of (d))?>\n        set [_i9 v] to (join (_i9) (letter (_i7) of (d)))\n        change [_i7 v] by (1)\n    end\n    change [_i7 v] by (1)\n    if <(_i9) = ((1) * (_i9))> then\n        replace item (_i6) of [_chdata4 v] with ((1) * (_i9))\n    else\n        replace item (_i6) of [_chdata4 v] with (_i9)\n    end\n    change [_i6 v] by (1)\nend\nif <(_i8) > [0]> then\n    set [_i5 v] to (id)\n    repeat ((length of [_chindex v]) - (_i5))\n        change [_i5 v] by (1)\n        replace item (_i5) of [_chindex v] with ((item (_i5) of [_chindex v]) + (_i8))\n    end\nend\n\ndefine _rasterizeCurve (type) (bx) (bx2) (ax) (cx) (ay) (by) (cy) (rep)\nif <(type) = [p]> then\n    repeat (rep)\n        set [_i4 v] to ((item (_i7) of [_raster v]) + (1))\n        set [_i5 v] to ((bx) + ([sqrt v] of ((bx2) - ((ax) * ((cx) - (_i7)))) ))\n        replace item ((_i7) + (_i4)) of [_rasterdir v] with (_i9)\n        replace item ((_i7) + (_i4)) of [_raster v] with ((cy) + ((_i5) * ((by) + ((_i5) * (ay)))))\n        replace item (_i7) of [_raster v] with (_i4)\n        change [_i7 v] by (41)\n    end\nelse\n    if <(type) = [m]> then\n        repeat (rep)\n            set [_i4 v] to ((item (_i7) of [_raster v]) + (1))\n            set [_i5 v] to ((bx) - ([sqrt v] of ((bx2) - ((ax) * ((cx) - (_i7)))) ))\n            replace item ((_i7) + (_i4)) of [_rasterdir v] with (_i9)\n            replace item ((_i7) + (_i4)) of [_raster v] with ((cy) + ((_i5) * ((by) + ((_i5) * (ay)))))\n            replace item (_i7) of [_raster v] with (_i4)\n            change [_i7 v] by (41)\n        end\n    else\n        set [_i5 v] to (cx)\n        repeat (rep)\n            set [_i4 v] to ((item (_i7) of [_raster v]) + (1))\n            replace item ((_i7) + (_i4)) of [_rasterdir v] with (_i9)\n            replace item ((_i7) + (_i4)) of [_raster v] with ((cy) + ((_i5) * ((by) + ((_i5) * (ay)))))\n            replace item (_i7) of [_raster v] with (_i4)\n            change [_i7 v] by (41)\n            change [_i5 v] by (bx)\n        end\n    end\nend\n\ndefine _createCache (d) (idx) (c)\nif <(length of [_cacheidx v]) < [5400]> then\n    add (_cID) to [_cacheidx v]\n    set [_i3 v] to (length of [_cacheidx v])\n    add (_cID) to [_cacheidx v]\n    set [_i4 v] to (length of [_cache0 v])\n    add (_i4) to [_cacheidx v]\n    repeat (110)\n        add [] to [_cache0 v]\n        add [] to [_cache1 v]\n    end\nelse\n    set [_i3 v] to ([floor v] of ((length of [_cacheidx v]) / (3)) )\n    set [_i4 v] to [2]\n    set [_i5 v] to (item (2) of [_cacheidx v])\n    repeat (12)\n        set [_i6 v] to (((3) * (pick random (1) to (_i3))) - (1))\n        if <(item (_i6) of [_cacheidx v]) < (_i5)> then\n            set [_i4 v] to (_i6)\n            set [_i5 v] to (item (_i6) of [_cacheidx v])\n        end\n    end\n    replace item ((_i4) - (1)) of [_cacheidx v] with (_cID)\n    replace item (_i4) of [_cacheidx v] with (_cID)\n    set [_i3 v] to ((_i4) - (1))\n    set [_i4 v] to (item ((_i4) + (1)) of [_cacheidx v])\nend\nif <(letter (1) of (d)) = [3]> then\n    set [_i5 v] to [1]\n    repeat (c)\n        change [_i4 v] by (1)\n        change [_i5 v] by (2)\n        replace item (_i4) of [_cache0 v] with ((letter (_i5) of (d)) + ((10) * (letter ((_i5) - (1)) of (d))))\n        replace item (_i4) of [_cache1 v] with []\n        repeat (item (_i4) of [_cache0 v])\n            change [_i4 v] by (1)\n            change [_i5 v] by (6)\n            replace item (_i4) of [_cache0 v] with (((letter ((_i5) - (3)) of (d)) + ((10) * ((letter ((_i5) - (4)) of (d)) + ((10) * (letter ((_i5) - (5)) of (d)))))) - (500))\n            replace item (_i4) of [_cache1 v] with ((letter (_i5) of (d)) + ((10) * ((letter ((_i5) - (1)) of (d)) + ((10) * (letter ((_i5) - (2)) of (d))))))\n        end\n    end\nelse\n    set [_i5 v] to [1]\n    repeat (c)\n        change [_i4 v] by (1)\n        change [_i5 v] by (2)\n        replace item (_i4) of [_cache0 v] with ((letter (_i5) of (d)) + ((10) * (letter ((_i5) - (1)) of (d))))\n        replace item (_i4) of [_cache1 v] with []\n        repeat (item (_i4) of [_cache0 v])\n            change [_i4 v] by (1)\n            change [_i5 v] by (8)\n            replace item (_i4) of [_cache0 v] with (((letter ((_i5) - (4)) of (d)) + ((10) * ((letter ((_i5) - (5)) of (d)) + ((10) * ((letter ((_i5) - (6)) of (d)) + ((10) * (letter ((_i5) - (7)) of (d)))))))) - (5000))\n            replace item (_i4) of [_cache1 v] with ((letter (_i5) of (d)) + ((10) * ((letter ((_i5) - (1)) of (d)) + ((10) * ((letter ((_i5) - (2)) of (d)) + ((10) * (letter ((_i5) - (3)) of (d))))))))\n        end\n    end\nend\nreplace item (idx) of [_chdata4 v] with (_cID)\nreplace item (idx) of [_chdata3 v] with (_i3)\n\ndefine _drawChar3 (d) (y) (c) (xs) (ys)\nif <(xs) > [0.505]> then\n    set pen size to ((2) * (xs))\nelse\n    set pen size to (1.01)\nend\nset [_i3 v] to [1]\nrepeat (c)\n    change [_i3 v] by (2)\n    repeat ((letter (_i3) of (d)) + ((10) * (letter ((_i3) - (1)) of (d))))\n        change [_i3 v] by (6)\n        set y to ((y) + ((ys) * ((letter ((_i3) - (3)) of (d)) + ((10) * ((letter ((_i3) - (4)) of (d)) + ((10) * (letter ((_i3) - (5)) of (d))))))))\n        pen down\n        change y by ((ys) * ((letter (_i3) of (d)) + ((10) * ((letter ((_i3) - (1)) of (d)) + ((10) * (letter ((_i3) - (2)) of (d)))))))\n        pen up\n    end\n    change x by (xs)\nend\n\ndefine _drawChar4 (d) (y) (c) (xs) (ys)\nif <(xs) > [0.505]> then\n    set pen size to ((2) * (xs))\nelse\n    set pen size to (1.01)\nend\nset [_i3 v] to [1]\nrepeat (c)\n    change [_i3 v] by (2)\n    repeat ((letter (_i3) of (d)) + ((10) * (letter ((_i3) - (1)) of (d))))\n        change [_i3 v] by (8)\n        set y to ((y) + ((ys) * ((letter ((_i3) - (4)) of (d)) + ((10) * ((letter ((_i3) - (5)) of (d)) + ((10) * ((letter ((_i3) - (6)) of (d)) + ((10) * (letter ((_i3) - (7)) of (d))))))))))\n        pen down\n        change y by ((ys) * ((letter (_i3) of (d)) + ((10) * ((letter ((_i3) - (1)) of (d)) + ((10) * ((letter ((_i3) - (2)) of (d)) + ((10) * (letter ((_i3) - (3)) of (d)))))))))\n        pen up\n    end\n    change x by (xs)\nend\n\ndefine _drawCache (idx) (y) (c) (xs) (ys)\nif <(xs) > [0.505]> then\n    set pen size to ((2) * (xs))\nelse\n    set pen size to (1.01)\nend\nset [_i3 v] to (idx)\nrepeat (c)\n    change [_i3 v] by (1)\n    repeat (item (_i3) of [_cache0 v])\n        change [_i3 v] by (1)\n        set y to ((y) + ((ys) * (item (_i3) of [_cache0 v])))\n        pen down\n        change y by ((ys) * (item (_i3) of [_cache1 v]))\n        pen up\n    end\n    change x by (xs)\nend\n\ndefine Set Scaling | Factor (factor)\nif <(factor) = [auto]> then\n    set [_scale v] to [auto]\nelse\n    if <(factor) = ((1) * (factor))> then\n        if <(factor) < [0.5]> then\n            set [_scale v] to ((1) * (0.5))\n        else\n            set [_scale v] to ((1) * (factor))\n        end\n    else\n        set [_scale v] to [auto]\n    end\nend\n\ndefine _updateScaling (size)\nif <(_scale) = [auto]> then\n    set [_scmin v] to ((1.1) * ((size) * (((2) / ((((size) * (size)) / (30)) + (1))) + (1))))\nelse\n    set [_scmin v] to ((1.1) * ((size) * (_scale)))\nend\nset [_scnew v] to ((1.1) * (_scMin))\nset [_scmax v] to ((1.21) * (_scMin))\n\ndefine Print | Pos (x) (y) Size (size) Bounds (xmin) (xmax) Space (cspace) Underline (ul.height) (ul.weight) Align (al.x) (al.y) Text (text)\npen up\nset [_i0 v] to ((size) + ((12) * <(size) = []>))\nset [_x v] to ((1) * (x))\nset [_y v] to ((1) * (y))\nif <<not <(_i0) > [0]>> or <(_i0) > [800]>> then\n    switch costume to ( _ v)\n    stop [this script v]\nend\n_updateScaling (_i0)\nset [_i1 v] to ((cspace) * (_i0))\nset [_i2 v] to ((al.x) + (((0.5) * <(al.x) = [c]>) + <(al.x) = [r]>))\nset [_i3 v] to ((al.y) + (((0.5) * <(al.y) = [c]>) + <(al.y) = [t]>))\nif <(xmin) = []> then\n    set [_i4 v] to ((-1) / (0))\nelse\n    set [_i4 v] to (xmin)\nend\nif <(xmax) = []> then\n    set [_i5 v] to ((1) / (0))\nelse\n    set [_i5 v] to (xmax)\nend\n_printText (text) (x) ((y) - ((_i3) * (_i0))) (_i0) (_i4) (_i5) (_i1) (ul.height) (ul.weight) ((-1) * (_i2))\n\ndefine _printText (text) (x) (y) (size) (xmin) (xmax) (cspace) (ul.height) (ul.weight) (al.x)\nset [_x v] to (x)\nset [_y v] to (y)\nset [_width v] to [0]\nif <not <(al.x) = [0]>> then\n    _getWidth (text) (size) (cspace)\n    change [_x v] by ((al.x) * (_width))\nend\nset [_i0 v] to [1]\nset [_i1 v] to [0]\nif <<(xmin) = ((-1) / (0))> and <(xmax) = ((1) / (0))>> then\n    repeat (length of (text))\n        switch costume to (blank v)\n        switch costume to (join (letter (_i0) of (text)) [_])\n        if <(costume [number v]) > [1]> then\n            set [_i3 v] to (item ((costume [number v]) - (1)) of [_chkern v])\n            change [_x v] by (((size) * (join (join (letter ((_i1) - (3)) of (_i3)) (letter ((_i1) - (2)) of (_i3))) (join (letter ((_i1) - (1)) of (_i3)) (letter (_i1) of (_i3))))) / (1000))\n            _printChar ((costume [number v]) - (1)) (_x) (y) (size) (_scMin) (_scMax) (_scNew)\n            change [_x v] by (((size) * (item ((costume [number v]) - (1)) of [_chwidth v])) + (cspace))\n        end\n        set [_i1 v] to ((4) * ((costume [number v]) - (1)))\n        change [_i0 v] by (1)\n    end\nelse\n    repeat (length of (text))\n        switch costume to (blank v)\n        switch costume to (join (letter (_i0) of (text)) [_])\n        if <(costume [number v]) > [1]> then\n            set [_i3 v] to (item ((costume [number v]) - (1)) of [_chkern v])\n            change [_x v] by (((size) * (join (join (letter ((_i1) - (3)) of (_i3)) (letter ((_i1) - (2)) of (_i3))) (join (letter ((_i1) - (1)) of (_i3)) (letter (_i1) of (_i3))))) / (1000))\n            if <not <<(_x) < (xmin)> or <((_x) + ((size) * (item ((costume [number v]) - (1)) of [_chwidth v]))) > (xmax)>>> then\n                _printChar ((costume [number v]) - (1)) (_x) (y) (size) (_scMin) (_scMax) (_scNew)\n            end\n            change [_x v] by (((size) * (item ((costume [number v]) - (1)) of [_chwidth v])) + (cspace))\n        end\n        set [_i1 v] to ((4) * ((costume [number v]) - (1)))\n        change [_i0 v] by (1)\n    end\nend\nswitch costume to ( _ v)\nif <not <(ul.height) = []>> then\n    set [_i0 v] to (round (((0.1) * (((ul.weight) + <(ul.weight) = []>) * (size))) - (1)))\n    if <(_i0) < [1]> then\n        set [_i0 v] to [1]\n    end\n    set [_i1 v] to ((x) + ((al.x) * (_width)))\n    if <(_i1) < (xmin)> then\n        set [_i1 v] to (xmin)\n    end\n    set [_i2 v] to ((_x) - (cspace))\n    if <(_i2) > (xmax)> then\n        set [_i2 v] to (xmax)\n    end\n    _drawUnderline (_i1) (_i2) ((y) + ((ul.height) * (size))) (_i0)\nend\n\ndefine _getWidth (text) (size) (cspace)\nset [_width v] to [0]\nset [_i0 v] to [1]\nset [_i1 v] to [0]\nset [_i4 v] to [0]\nrepeat (length of (text))\n    switch costume to (blank v)\n    switch costume to (join (letter (_i0) of (text)) [_])\n    set [_i2 v] to ((costume [number v]) - (1))\n    if <(_i2) > [0]> then\n        change [_width v] by (((size) * (item (_i2) of [_chwidth v])) + (cspace))\n        set [_i3 v] to (item (_i2) of [_chkern v])\n        change [_width v] by (((size) * (join (join (letter ((_i1) - (3)) of (_i3)) (letter ((_i1) - (2)) of (_i3))) (join (letter ((_i1) - (1)) of (_i3)) (letter (_i1) of (_i3))))) / (1000))\n        change [_i4 v] by (1)\n    end\n    set [_i1 v] to ((4) * (_i2))\n    change [_i0 v] by (1)\nend\nif <(_i4) > [0]> then\n    change [_width v] by ((-1) * (cspace))\nend\n\ndefine _drawUnderline (x0) (x1) (y) (weight)\nset pen size to (2)\nset y to ((y) + ((weight) / (2)))\nrepeat (weight)\n    set x to (x0)\n    pen down\n    set x to (x1)\n    pen up\n    change y by (-1)\nend\n\ndefine Print WW | Pos (x) (y) Size (size) Bounds (xmin) (xmax) (ymax) (ymin) Space (cspace) (lspace) Underline (ul.height) (ul.weight) Align (al.x) (al.y) Text (text)\npen up\nset [_i0 v] to ((size) + ((12) * <(size) = []>))\nset [_x v] to ((1) * (x))\nset [_y v] to ((1) * (y))\nif <<not <(_i0) > [0]>> or <(_i0) > [800]>> then\n    switch costume to ( _ v)\n    stop [this script v]\nend\n_updateScaling (_i0)\nset [_i1 v] to ((xmin) + ((-230) * <(xmin) = []>))\nset [_i2 v] to ((xmax) + ((230) * <(xmax) = []>))\nset [_i3 v] to (item (1) of [_chwidth v])\n_calcWW (text) (((_i2) - (_i1)) / (_i0)) (<not <(x) = []>> * (((x) - (_i1)) / (_i0))) ((1) * (cspace)) ((cspace) + (_i3))\nset [_i3 v] to ((al.x) + (((0.5) * <(al.x) = [c]>) + <(al.x) = [r]>))\nset [_i8 v] to ((lspace) + <(lspace) = []>)\nif <(al.y) = []> then\n    set [_i4 v] to [1]\nelse\n    if <(al.y) = ((1) * (al.y))> then\n        set [_i4 v] to (al.y)\n    else\n        if <(al.y) = [b]> then\n            set [_i4 v] to ((length of [_ww1 v]) - <<(item (1) of [_ww2 v]) = [0]> and <(x) = []>>)\n        else\n            if <(al.y) = [c]> then\n                set [_i4 v] to ((0.5) * ((((0.7) * (_i8)) / (((0.7) * (_i8)) + (1))) + ((length of [_ww1 v]) - <<(item (1) of [_ww2 v]) = [0]> and <(x) = []>>)))\n            else\n                set [_i4 v] to (((0.7) * (_i8)) / (((0.7) * (_i8)) + (1)))\n            end\n        end\n    end\nend\nset [_i5 v] to (round (((0.1) * (((ul.weight) + <(ul.weight) = []>) * (_i0))) - (1)))\nif <(_i5) < [1]> then\n    set [_i5 v] to [1]\nend\nif <(ymax) = []> then\n    set [_i6 v] to ((1) / (0))\nelse\n    set [_i6 v] to ((ymax) - (_i0))\nend\nif <(ymin) = []> then\n    set [_i7 v] to ((-1) / (0))\nelse\n    set [_i7 v] to (ymin)\nend\nset [_i8 v] to ((_i0) * ((-1) - ((0.7) * (_i8))))\nif <(x) = []> then\n    set [_i9 v] to [0]\nelse\n    set [_i9 v] to [1]\nend\n_printWW ((((1) - (_i3)) * (_i1)) + ((_i3) * (_i2))) (x) (_i9) ((1) * (y)) (_i0) (_i6) (_i7) ((cspace) * (_i0)) (_i8) ((ul.height) * (_i0)) (_i5) <not <(ul.height) = []>> ((-1) * ((_i3) * (_i0))) (_i4)\n\ndefine _printWW (x) (firstx) (firstline) (y) (size) (ymax) (ymin) (cspace) (lspace) (ul.height) (ul.weight) <undl> (al.x) (al.y)\nswitch costume to ( _ v)\nset [_x v] to (x)\nset [_y v] to ((y) - (((al.y) - (1)) * (lspace)))\nset [_i0 v] to [1]\nset [_i1 v] to [1]\nif <(item (1) of [_ww2 v]) = [0]> then\n    change [_i0 v] by (1)\n    change [_i1 v] by (1)\n    if <(firstline) = [1]> then\n        change [_y v] by (lspace)\n    end\nend\nrepeat until <<not <(_y) > (ymax)>> or <(_i0) > (length of [_ww1 v])>>\n    change [_i1 v] by ((item (_i0) of [_ww2 v]) + (1))\n    change [_i0 v] by (1)\n    change [_y v] by (lspace)\nend\nrepeat until <<(_y) < (ymin)> or <(_i0) > (length of [_ww1 v])>>\n    if <(_i0) = (firstline)> then\n        set [_x v] to (firstx)\n    else\n        set [_x v] to ((x) + ((al.x) * (item (_i0) of [_ww1 v])))\n    end\n    repeat (item (_i0) of [_ww2 v])\n        set [_i2 v] to ((4) * (item ((_i1) - (1)) of [_ww0 v]))\n        set [_i3 v] to (item (item (_i1) of [_ww0 v]) of [_chkern v])\n        change [_x v] by (((size) * (join (join (letter ((_i2) - (3)) of (_i3)) (letter ((_i2) - (2)) of (_i3))) (join (letter ((_i2) - (1)) of (_i3)) (letter (_i2) of (_i3))))) / (1000))\n        _printChar (item (_i1) of [_ww0 v]) (_x) (_y) (size) (_scMin) (_scMax) (_scNew)\n        change [_x v] by (((size) * (item (item (_i1) of [_ww0 v]) of [_chwidth v])) + (cspace))\n        change [_i1 v] by (1)\n    end\n    if <undl> then\n        if <(_i0) = (firstline)> then\n            _drawUnderline (firstx) ((_x) - (cspace)) ((_y) + (ul.height)) (ul.weight)\n        else\n            _drawUnderline ((x) + ((al.x) * (item (_i0) of [_ww1 v]))) ((_x) - (cspace)) ((_y) + (ul.height)) (ul.weight)\n        end\n    end\n    change [_i0 v] by (1)\n    change [_i1 v] by (1)\n    change [_y v] by (lspace)\nend\nif <((length of [_ww1 v]) - <(item (1) of [_ww2 v]) = [0]>) > [0]> then\n    change [_y v] by ((-1) * (lspace))\nend\ndelete all of [_ww0 v]\ndelete all of [_ww1 v]\ndelete all of [_ww2 v]\n\ndefine New Lines | Number (lines) Size (size) Space (lspace)\nchange [_y v] by (((lines) + <(lines) = []>) * (((size) + ((12) * <(size) = []>)) * ((-1) - ((0.7) * ((lspace) + <(lspace) = []>)))))\n\ndefine Get Width | Size (size) Space (cspace) Text (text)\n_getWidth (text) ((size) + ((12) * <(size) = []>)) ((cspace) * ((size) + ((12) * <(size) = []>)))\n\nwhen I receive [inittextengine v]\nLoad | Font [Nunito Sans Light]\nset [textindex v] to [0]\nset [textbox_y v] to [120]\n\nwhen I receive [text v]\nif <not <(LoopTask) = [none]>> then\n    wait until <(LoopTask) = [none]>\nend\nset [looptask v] to [text]\nUpdate Text (item (1) of [textareas v]) (item (2) of [textareas v]) (item (3) of [textareas v])\nset [looptask v] to [none]\n\ndefine Update Text (x) (y) (z)\npen up\nset [_i0 v] to [4]\nset [_i1 v] to [0]\nset [_i2 v] to [1e100]\nrepeat (round (((length of [textareas v]) - (3)) / (7)))\n    if <not <<(item ((_i0) + (4)) of [textareas v]) > (z)> or <(item ((_i0) + (5)) of [textareas v]) < (z)>>> then\n        if <not <<(item (_i0) of [textareas v]) > (x)> or <(item ((_i0) + (1)) of [textareas v]) < (x)>>> then\n            if <not <<(item ((_i0) + (2)) of [textareas v]) > (y)> or <(item ((_i0) + (3)) of [textareas v]) < (y)>>> then\n                set [_i3 v] to (((item ((_i0) + (1)) of [textareas v]) - (item (_i0) of [textareas v])) * (((item ((_i0) + (3)) of [textareas v]) - (item ((_i0) + (2)) of [textareas v])) * ((item ((_i0) + (5)) of [textareas v]) - (item ((_i0) + (4)) of [textareas v]))))\n                if <(_i3) < (_i2)> then\n                    set [_i1 v] to ((_i0) + (6))\n                    set [_i2 v] to (_i3)\n                end\n            end\n        end\n    end\n    change [_i0 v] by (7)\nend\nif <not <(_i1) = (TextIndex)>> then\n    set [textindex v] to (_i1)\n    if <not <(TextIndex) = [0]>> then\n        Set Pen Color | RGBA [63] [63] [63] []\n        set pen size to (((180) - (TEXTBOX_Y)) + (2))\n        go to x: (-400) y: (((180) + (TEXTBOX_Y)) / (2))\n        pen down\n        set x to (400)\n        pen up\n        Set Pen Color | RGBA [255] [255] [255] []\n        Get Width | Size (((180) - (TEXTBOX_Y)) / (2)) Space [] Text (item (TextIndex) of [textareas v])\n        if <(_width) < ((1.5) * (468))> then\n            if <(_width) < [468]> then\n                Print | Pos [0] (((180) + (TEXTBOX_Y)) / (2)) Size (((180) - (TEXTBOX_Y)) / (2)) Bounds [] [] Space [] Underline [] [] Align [c] [0.4] Text (item (TextIndex) of [textareas v])\n            else\n                Print | Pos [0] (((180) + (TEXTBOX_Y)) / (2)) Size ((((180) - (TEXTBOX_Y)) / (2)) / ((_width) / (468))) Bounds [] [] Space [] Underline [] [] Align [c] [0.4] Text (item (TextIndex) of [textareas v])\n            end\n        else\n            Print WW | Pos [] [174] Size [14] Bounds [-234] [234] [] ((TEXTBOX_Y) + (6)) Space [] [] Underline [] [] Align [l] [t] Text (item (TextIndex) of [textareas v])\n        end\n    end\nend\npen up\n\nwhen I receive [winscreen v]\npen up\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (254)\ngo to x: (-400) y: (0)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [63] [63] [63] []\nset pen size to (246)\ngo to x: (-400) y: (0)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [255] [255] [255] []\nset [_i0 v] to ([floor v] of ((100) * ((levelTime) mod (1))) )\nif <(length of (_i0)) = [1]> then\n    set [_i0 v] to (join [0] (_i0))\nend\nPrint | Pos [-220] [-20] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [] Text (join (join ([floor v] of (levelTime) ) (join [.] (_i0))) [ sec])\nPrint | Pos [-220] [-105] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [] Text (levelDeaths)\nLoad | Font [Nunito Sans]\nPrint | Pos [-220] [105] Size [45] Bounds [] [] Space [] Underline [] [] Align [] [t] Text [You Win!]\nPrint | Pos [-220] [15] Size [20] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Time]\nPrint | Pos [-220] [-70] Size [20] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Deaths]\nif <(CustomLevel) = [false]> then\n    Print | Pos [0] [15] Size [20] Bounds [] [] Space [] Underline [] [] Align [] [] Text [World Record]\n    Print | Pos [0] [-70] Size [20] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Global Wins]\n    delete all of [levelstats v]\n    broadcast (getLevelStats v)\nend\nrepeat (15)\n    Set Pen Color | RGBA [] [] [] [6]\n    set pen size to (110)\n    go to x: (-600) y: (-180)\n    pen down\n    set x to (600)\n    pen up\n    go to x: (-600) y: (180)\n    pen down\n    set x to (600)\n    pen up\n    Set Pen Color | RGBA [31] [31] [31] []\n    set pen size to (4)\n    go to x: (-400) y: (-125)\n    pen down\n    set x to (400)\n    pen up\n    set pen size to (4)\n    go to x: (-400) y: (125)\n    pen down\n    set x to (400)\n    pen up\nend\nif <(CustomLevel) = [true]> then\n    Clear Buttons\n    Add Button [100] [80] [] [_home]\nelse\n    Load | Font [Nunito Sans Light]\n    wait until <(length of [levelstats v]) > [0]>\n    Set Pen Color | RGBA [255] [255] [255] []\n    if <(length of [levelstats v]) < [3]> then\n        Print | Pos [0] [-20] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Error]\n        Print | Pos [2] [-25] Size [12] Bounds [] [] Space [] Underline [] [] Align [] [t] Text [Unable to access cloud data]\n        Print | Pos [0] [-105] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Error]\n    else\n        set [_i0 v] to ([floor v] of ((100) * ((item (1) of [levelstats v]) mod (1))) )\n        if <(length of (_i0)) = [1]> then\n            set [_i0 v] to (join [0] (_i0))\n        end\n        if <(item (1) of [levelstats v]) = [Infinity]> then\n            Print | Pos [0] [-20] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [] Text [---]\n        else\n            Print | Pos [0] [-20] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [] Text (join (join ([floor v] of (item (1) of [levelstats v]) ) (join [.] (_i0))) [ sec])\n        end\n        Get Width | Size [1] Space [] Text (item (2) of [levelstats v])\n        if <((220) / (_width)) > [12]> then\n            Print | Pos [2] [-25] Size [12] Bounds [] [] Space [] Underline [] [] Align [] [t] Text (item (2) of [levelstats v])\n        else\n            Print | Pos [2] [-25] Size ((220) / (_width)) Bounds [] [] Space [] Underline [] [] Align [] [t] Text (item (2) of [levelstats v])\n        end\n        Print | Pos [0] [-105] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [] Text ((item (3) of [levelstats v]) + (1))\n    end\n    set [submitlevel v] to (CurrentLevel)\n    broadcast (submitTime v)\n    Clear Buttons\n    Add Button [105] [80] [] [_menu]\n    replace item (CurrentLevel) of [mainlevelscompletion v] with [true]\n    if <not <((CurrentLevel) + (1)) > (length of [mainlevels v])>> then\n        set [customlevel v] to [false]\n        change [currentlevel v] by (1)\n        Add Button [190] [80] [] [_next]\n    end\nend\nUpdate Until Button Clicked\nif <(buttonClicked) = [_menu]> then\n    broadcast (levelSelect v)\nelse\n    if <(buttonClicked) = [_next]> then\n        set [leveldata v] to (item (CurrentLevel) of [mainlevels v])\n        set [editormode v] to [false]\n        broadcast (loadLevel v)\n    else\n        if <(buttonClicked) = [_home]> then\n            broadcast (mainMenu v)\n        end\n    end\nend\n\ndefine buttonBase (x) (y) (size) <hover>\nset pen size to (20)\ngo to x: ((x) - ((size) / (2))) y: ((y) + ((size) / (2)))\nset pen (transparency v) to (100)\npen down\nSet Pen Color | RGBA [63] [63] [63] []\nset x to ((x) + ((size) / (2)))\nset y to ((y) - ((size) / (2)))\nset x to ((x) - ((size) / (2)))\nset y to ((y) + ((size) / (2)))\npen up\nset pen size to (16)\ngo to x: ((x) - ((size) / (2))) y: ((y) + ((size) / (2)))\nset pen (transparency v) to (100)\npen down\nif <hover> then\n    Set Pen Color | RGBA [95] [95] [95] []\nelse\n    Set Pen Color | RGBA [31] [31] [31] []\nend\nset x to ((x) + ((size) / (2)))\nset y to ((y) - ((size) / (2)))\nset x to ((x) - ((size) / (2)))\nset y to ((y) + ((size) / (2)))\npen up\n\ndefine Clear Buttons\ndelete all of [buttons v]\n\ndefine Add Button (x) (y) (size) (icon)\nadd (x) to [buttons v]\nadd (y) to [buttons v]\nif <(size) = []> then\n    add [42] to [buttons v]\nelse\n    add (size) to [buttons v]\nend\nadd (icon) to [buttons v]\nadd [none] to [buttons v]\n\ndefine Draw Button (x) (y) (size) (icon) <hover> <active>\npen up\nbuttonBase (x) (y) ((size) - (2)) <<hover> and <not <active>>>\nif <active> then\n    Set Pen Color | RGBA [53] [53] [53] []\nelse\n    if <hover> then\n        Set Pen Color | RGBA [159] [159] [159] []\n    else\n        Set Pen Color | RGBA [95] [95] [95] []\n    end\nend\nset [_i1 v] to (size)\nset pen size to (_i1)\ngo to x: (x) y: (y)\npen down\npen up\nset [_i2 v] to ((x) - ((size) / (2)))\nset [_i3 v] to ((x) + ((size) / (2)))\nset [_i4 v] to ((y) - ((size) / (2)))\nset [_i5 v] to ((y) + ((size) / (2)))\nset [_i1 v] to ((0.16) * (_i1))\nrepeat until <(_i1) < [10]>\n    set pen size to (_i1)\n    set [_i6 v] to ((_i1) / (2))\n    go to x: ((_i2) + (_i6)) y: ((_i4) + (_i6))\n    pen down\n    set x to ((_i3) - (_i6))\n    set y to ((_i5) - (_i6))\n    set x to ((_i2) + (_i6))\n    set y to ((_i4) + (_i6))\n    pen up\n    set [_i1 v] to ((0.16) * (_i1))\nend\nset pen size to (10)\nset [_i6 v] to [1]\ngo to x: ((_i2) + (_i6)) y: ((_i4) + (_i6))\npen down\nset x to ((_i3) - (_i6))\nset y to ((_i5) - (_i6))\nset x to ((_i2) + (_i6))\nset y to ((_i4) + (_i6))\npen up\nif <<hover> and <not <active>>> then\n    Set Pen Color | RGBA [95] [95] [95] []\nelse\n    Set Pen Color | RGBA [31] [31] [31] []\nend\nDraw Icon (x) (y) (size) (icon)\n\ndefine Update Buttons\nset [buttonclicked v] to [none]\nset [_idx0 v] to [1]\nrepeat ((length of [buttons v]) / (5))\n    set [_i0 v] to ((item ((_idx0) + (2)) of [buttons v]) / (2))\n    if <<([abs v] of ((mouse x) - (item (_idx0) of [buttons v])) ) < (_i0)> and <([abs v] of ((mouse y) - (item ((_idx0) + (1)) of [buttons v])) ) < (_i0)>> then\n        if <not <(item ((_idx0) + (4)) of [buttons v]) = [true]>> then\n            Draw Button (item (_idx0) of [buttons v]) (item ((_idx0) + (1)) of [buttons v]) (item ((_idx0) + (2)) of [buttons v]) (item ((_idx0) + (3)) of [buttons v]) <[0] = [0]> <[1] = [0]>\n            replace item ((_idx0) + (4)) of [buttons v] with [true]\n        end\n        set [buttonclicked v] to (_idx0)\n    else\n        if <not <(item ((_idx0) + (4)) of [buttons v]) = [false]>> then\n            Draw Button (item (_idx0) of [buttons v]) (item ((_idx0) + (1)) of [buttons v]) (item ((_idx0) + (2)) of [buttons v]) (item ((_idx0) + (3)) of [buttons v]) <[1] = [0]> <[1] = [0]>\n            replace item ((_idx0) + (4)) of [buttons v] with [false]\n        end\n    end\n    change [_idx0 v] by (5)\nend\n\ndefine Update Until Button Clicked\nforever\n    Update Buttons\n    if <mouse down?> then\n        if <(buttonClicked) = [none]> then\n            wait until <not <mouse down?>>\n        else\n            set [_idx0 v] to (buttonClicked)\n            Draw Button (item (_idx0) of [buttons v]) (item ((_idx0) + (1)) of [buttons v]) (item ((_idx0) + (2)) of [buttons v]) (item ((_idx0) + (3)) of [buttons v]) <[0] = [0]> <[0] = [0]>\n            set [buttonclicked v] to (item ((_idx0) + (3)) of [buttons v])\n            set [buttonclickedidx v] to (round (((_idx0) + (4)) / (5)))\n            wait until <not <mouse down?>>\n            start sound [click v]\n            stop [this script v]\n        end\n    end\nend\n\ndefine Draw Icon (x) (y) (size) (icon)\nif <not <(letter (1) of (icon)) = [_]>> then\n    if <(icon) = ((1) * (icon))> then\n        if <(item (icon) of [mainlevelscompletion v]) = [true]> then\n            set pen color to (item (5) of [platform_colors v])\n        else\n            if <(icon) = (CurrentLevel)> then\n                Set Pen Color | RGBA [247] [223] [47] []\n            else\n                if <(icon) > ((length of [mainlevels v]) / (2))> then\n                    set pen color to (SKY_COLOR)\n                end\n            end\n        end\n    end\n    Get Width | Size [1] Space [] Text (icon)\n    if <(((0.8) * (size)) / (_width)) > ((0.5) * (size))> then\n        Print | Pos (x) (y) Size ((0.5) * (size)) Bounds [] [] Space [] Underline [] [] Align [c] [c] Text (icon)\n    else\n        Print | Pos (x) (y) Size (((0.8) * (size)) / (_width)) Bounds [] [] Space [] Underline [] [] Align [c] [c] Text (icon)\n    end\n    stop [this script v]\nend\nset [_x v] to (x)\nset [_y v] to (y)\nset [_i0 v] to ((size) / (2))\nset pen size to ((2) * ([ceiling v] of ((0.05) * (size)) ))\nif <(icon) = [_menu]> then\n    goTo [-0.6] [0.55]\n    pen down\n    goTo [0.6] [0.55]\n    pen up\n    goTo [-0.6] [0]\n    pen down\n    goTo [0.6] [0]\n    pen up\n    goTo [-0.6] [-0.55]\n    pen down\n    goTo [0.6] [-0.55]\n    pen up\nelse\n    if <(icon) = [_next]> then\n        goTo [-0.6] [0]\n        pen down\n        goTo [0.6] [0]\n        pen up\n        goTo [0.2] [0.5]\n        pen down\n        goTo [0.6] [0]\n        goTo [0.2] [-0.5]\n        pen up\n    else\n        if <(icon) = [_previous]> then\n            goTo [-0.6] [0]\n            pen down\n            goTo [0.6] [0]\n            pen up\n            goTo [-0.2] [0.5]\n            pen down\n            goTo [-0.6] [0]\n            goTo [-0.2] [-0.5]\n            pen up\n        else\n            if <(icon) = [_home]> then\n                goTo [-0.5] [0.275]\n                pen down\n                goTo [-0.5] [-0.525]\n                goTo [0.5] [-0.525]\n                goTo [0.5] [0.275]\n                pen up\n                goTo [-0.7] [0.125]\n                pen down\n                goTo [0] [0.65]\n                goTo [0.7] [0.125]\n                pen up\n            else\n                if <(icon) = [_play]> then\n                    goTo [0.6] [0.03]\n                    pen down\n                    goTo [-0.45] [-0.576218]\n                    goTo [-0.45] [0.636218]\n                    goTo [0.6] [0.03]\n                    pen up\n                else\n                    if <(icon) = [_edit]> then\n                        goTo [-0.8] [-0.3]\n                        pen down\n                        goTo [-0.8] [-0.7]\n                        goTo [0.8] [-0.7]\n                        goTo [0.8] [-0.3]\n                        pen up\n                        goTo [0] [0.8]\n                        pen down\n                        goTo [0] [-0.2]\n                        pen up\n                        goTo [-0.5] [0.3]\n                        pen down\n                        goTo [0.5] [0.3]\n                        pen up\n                    else\n                        if <(icon) = [_load]> then\n                            goTo [-0.8] [-0.3]\n                            pen down\n                            goTo [-0.8] [-0.7]\n                            goTo [0.8] [-0.7]\n                            goTo [0.8] [-0.3]\n                            pen up\n                            goTo [0] [0.8]\n                            pen down\n                            goTo [0] [-0.2]\n                            pen up\n                            goTo [-0.5] [0.2]\n                            pen down\n                            goTo [0] [-0.2]\n                            goTo [0.5] [0.2]\n                            pen up\n                        else\n                            if <(icon) = [_tutorial]> then\n                                goTo [-0.7] [0.5]\n                                pen down\n                                goTo [-0.9] [0.5]\n                                goTo [-0.9] [-0.7]\n                                goTo [0.9] [-0.7]\n                                goTo [0.9] [0.5]\n                                goTo [0.7] [0.5]\n                                pen up\n                                goTo [0] [-0.5]\n                                pen down\n                                goTo [0] [0.6]\n                                goTo [-0.7] [0.8]\n                                goTo [-0.7] [-0.3]\n                                goTo [0] [-0.5]\n                                goTo [0.7] [-0.3]\n                                goTo [0.7] [0.8]\n                                goTo [0] [0.6]\n                                pen up\n                            else\n                                if <(icon) = [_cloud]> then\n                                    goTo [-0.25] [-0.1]\n                                    pen down\n                                    goTo [-0.75] [-0.1]\n                                    goTo [-0.75] [-0.7]\n                                    goTo [0.75] [-0.7]\n                                    goTo [0.75] [0.3]\n                                    goTo [0.25] [0.3]\n                                    pen up\n                                    goTo [-0.25] [-0.7]\n                                    pen down\n                                    goTo [-0.25] [0.8]\n                                    goTo [0.25] [0.8]\n                                    goTo [0.25] [-0.7]\n                                    pen up\n                                else\n                                    if <(icon) = [_settings]> then\n                                        set [_i1 v] to [0]\n                                        goTo [0.6] [0.03]\n                                        pen down\n                                        repeat (12)\n                                            goTo ((0.8) * ([cos v] of (_i1) )) ((0.03) + ((0.8) * ([sin v] of (_i1) )))\n                                            change [_i1 v] by ((360) / (12))\n                                            goTo ((0.6) * ([cos v] of (_i1) )) ((0.03) + ((0.6) * ([sin v] of (_i1) )))\n                                        end\n                                        pen up\n                                        set [_i1 v] to [0]\n                                        goTo [0.5] [0.03]\n                                        pen down\n                                        repeat (12)\n                                            change [_i1 v] by ((360) / (12))\n                                            goTo ((0.5) * ([cos v] of (_i1) )) ((0.03) + ((0.5) * ([sin v] of (_i1) )))\n                                        end\n                                        pen up\n                                    else\n                                        if <(icon) = [_credits]> then\n                                            set [_i1 v] to [0]\n                                            goTo [0.9] [0.03]\n                                            pen down\n                                            repeat (24)\n                                                change [_i1 v] by ((360) / (24))\n                                                goTo ((0.9) * ([cos v] of (_i1) )) ((0.03) + ((0.9) * ([sin v] of (_i1) )))\n                                            end\n                                            pen up\n                                            set [_i1 v] to [135]\n                                            goTo ((-0.45) * (([sqrt v] of (2) ) / (2))) ((0.03) + ((0.45) * (([sqrt v] of (2) ) / (2))))\n                                            pen down\n                                            repeat (18)\n                                                change [_i1 v] by ((-360) / (24))\n                                                goTo ((0.45) * ([cos v] of (_i1) )) ((0.03) + ((0.45) * ([sin v] of (_i1) )))\n                                            end\n                                            pen up\n                                        else\n                                            if <(icon) = [_graphics]> then\n                                                set [_i1 v] to [0]\n                                                goTo [0] [-0.9]\n                                                pen down\n                                                goTo [0] [0.3]\n                                                goTo [-0.9] [0.6]\n                                                goTo [0] [0.8]\n                                                goTo [0.9] [0.6]\n                                                goTo [0] [0.3]\n                                                pen up\n                                                goTo [-0.9] [0.6]\n                                                pen down\n                                                goTo [-0.85] [-0.55]\n                                                goTo [0] [-0.9]\n                                                goTo [0.85] [-0.55]\n                                                goTo [0.9] [0.6]\n                                                pen up\n                                                goTo [-0.5] [0.6]\n                                                pen down\n                                                goTo [0.5] [0.6]\n                                                pen up\n                                            else\n                                                if <(icon) = [_musicEnabled]> then\n                                                    set [_i1 v] to [0]\n                                                    goTo [-0.65] [-0.7]\n                                                    pen down\n                                                    goTo [-0.45] [-0.6]\n                                                    goTo [-0.45] [0.5]\n                                                    goTo [0.6] [0.8]\n                                                    goTo [0.6] [-0.3]\n                                                    goTo [0.4] [-0.4]\n                                                    pen up\n                                                else\n                                                    if <(icon) = [_musicDisabled]> then\n                                                        set [_i1 v] to [0]\n                                                        goTo [-0.65] [-0.7]\n                                                        pen down\n                                                        goTo [-0.45] [-0.6]\n                                                        goTo [-0.45] [0.5]\n                                                        goTo [0.6] [0.8]\n                                                        goTo [0.6] [-0.3]\n                                                        goTo [0.4] [-0.4]\n                                                        pen up\n                                                        goTo [-0.75] [0.5]\n                                                        pen down\n                                                        goTo [0.8] [-0.4]\n                                                        pen up\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\nend\npen up\n\ndefine goTo (x) (y)\ngo to x: ((_x) + ((_i0) * (x))) y: ((_y) + ((_i0) * (y)))\n\ndefine Fill Screen With Sky\npen up\nerase all\nset pen color to (SKY_COLOR)\nset pen size to (184)\ngo to x: (-400) y: (-90)\npen down\nset x to (400)\nset y to (90)\nset x to (-400)\nset y to (-90)\npen up\n\nwhen I receive [levelselect v]\nLoad | Font [Nunito Sans Bold]\nFill Screen With Sky\nSet Pen Color | RGBA [31] [31] [31] []\nPrint | Pos [0] [165] Size [50] Bounds [] [] Space [] Underline [] [] Align [c] [t] Text [Level Select]\npen up\nSet Pen Color | RGBA [63] [63] [63] []\nset pen size to (200)\ngo to x: (-400) y: (-2)\npen down\nset x to (400)\npen up\ngo to x: (-400) y: (-180)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (4)\ngo to x: (-400) y: (98)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [255] [255] [255] []\nLoad | Font [Nunito Sans Light]\nPrint WW | Pos [] [-140] Size [10] Bounds [-220] [-40] [] [] Space [] [] Underline [] [] Align [l] [] Text [Levels 1–18 are regular levels with standard physics]\nPrint WW | Pos [] [-140] Size [10] Bounds [40] [220] [] [] Space [] [] Underline [] [] Align [r] [] Text [Levels 19–36 are challenge versions of levels 1–18]\nLevel Select Create Buttons\nUpdate Until Button Clicked\nif <(buttonClicked) = ((1) * (buttonClicked))> then\n    if <(EditorMode) = [true]> then\n        set [error v] to [Please export the level in the Level Editor before playing]\n        broadcast (errorScreen v)\n    else\n        set [currentlevel v] to (buttonClicked)\n        set [customlevel v] to [false]\n        set [leveldata v] to (item (CurrentLevel) of [mainlevels v])\n        set [editormode v] to [false]\n        broadcast (loadLevel v)\n    end\nelse\n    if <(buttonClicked) = [_home]> then\n        broadcast (mainMenu v)\n    end\nend\n\ndefine Level Select Create Buttons\nLoad | Font [Nunito Sans]\nClear Buttons\nset [_i0 v] to [1]\nrepeat (length of [mainlevels v])\n    Add Button (((50) * (((_i0) - (1)) mod (9))) - (200)) ((108) - ((50) * ([ceiling v] of ((_i0) / (9)) ))) [30] (_i0)\n    change [_i0 v] by (1)\nend\nAdd Button [0] [-146] [34] [_home]\n\nwhen I receive [errorscreen v]\npen up\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (154)\ngo to x: (-400) y: (0)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [63] [63] [63] []\nset pen size to (146)\ngo to x: (-400) y: (0)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [] [] [] [63]\nset pen size to (210)\ngo to x: (-600) y: (-180)\npen down\nset x to (600)\npen up\ngo to x: (-600) y: (180)\npen down\nset x to (600)\npen up\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (4)\ngo to x: (-400) y: (-75)\npen down\nset x to (400)\npen up\nset pen size to (4)\ngo to x: (-400) y: (75)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [255] [255] [255] []\nLoad | Font [Nunito Sans]\nPrint WW | Pos [] [55] Size [24] Bounds [-220] [220] [] [-15] Space [] [] Underline [] [] Align [] [t] Text (Error)\nClear Buttons\nAdd Button [0] [-48] [24] [_home]\nUpdate Until Button Clicked\nif <(menuPage) = [2]> then\n    broadcast (mainMenu2 v)\nelse\n    broadcast (mainMenu v)\nend\n\nwhen I receive [mainmenu v]\nset [menupage v] to [1]\nMain Menu Base\nAdd Button [-205] [44] [30] [_play]\nAdd Button [-205] [-4] [30] [_menu]\nAdd Button [-205] [-52] [30] [_edit]\nAdd Button [-205] [-100] [30] [_load]\nAdd Button [-205] [-148] [30] [_tutorial]\nAdd Button [9] [49] [20] [_next]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint | Pos [-170] [44] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Play]\nPrint | Pos [-170] [-4] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Level Select]\nPrint | Pos [-170] [-52] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Level Editor]\nPrint | Pos [-170] [-100] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Load Level]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint | Pos [-170] [-148] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Tutorial]\nUpdate Buttons\nif <(EditorMode) = [false]> then\n    broadcast (mainMenu3D v) and wait\nend\nUpdate Until Button Clicked\nif <(buttonClicked) = [_play]> then\n    if <(EditorMode) = [true]> then\n        set [error v] to [Please export the level in the Level Editor before playing]\n        broadcast (errorScreen v)\n    else\n        set [customlevel v] to [false]\n        set [leveldata v] to (item (CurrentLevel) of [mainlevels v])\n        set [editormode v] to [false]\n        broadcast (loadLevel v)\n    end\nelse\n    if <(buttonClicked) = [_menu]> then\n        broadcast (levelSelect v)\n    else\n        if <(buttonClicked) = [_edit]> then\n            if <(EditorMode) = [true]> then\n                broadcast (editorLoop v)\n            else\n                ask [Enter Level Data \(Leave Blank to Create a New Level\):] and wait\n                if <(answer) = []> then\n                    set [leveldata v] to [v1.0:0;0;0;0;0;0;]\n                else\n                    set [leveldata v] to (answer)\n                end\n                set [customlevel v] to [true]\n                set [editormode v] to [true]\n                broadcast (loadLevel v)\n            end\n        else\n            if <(buttonClicked) = [_load]> then\n                ask [Enter Level Data:] and wait\n                if <(answer) = []> then\n                    broadcast (mainMenu v)\n                else\n                    set [customlevel v] to [true]\n                    set [leveldata v] to (answer)\n                    set [editormode v] to [false]\n                    broadcast (loadLevel v)\n                end\n            else\n                if <(buttonClicked) = [_tutorial]> then\n                    broadcast (tutorial v)\n                else\n                    if <(buttonClicked) = [_next]> then\n                        broadcast (mainMenu2 v)\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Main Menu Base\nLoad | Font [Nunito Sans Bold]\nFill Screen With Sky\nSet Pen Color | RGBA [31] [31] [31] []\nPrint | Pos [-220] [160] Size [50] Bounds [] [] Space [] Underline [] [] Align [] [t] Text [Sky Run ]\nLoad | Font [Nunito Sans]\nSet Pen Color | RGBA [63] [63] [63] []\nPrint | Pos (_x) [160] Size [50] Bounds [] [] Space [] Underline [] [] Align [] [t] Text [3D]\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (28)\ngo to x: (-228) y: (-190)\npen down\nset y to (66)\nset x to (26)\nset y to (-190)\npen up\nSet Pen Color | RGBA [63] [63] [63] []\nset pen size to (20)\ngo to x: (-228) y: (-190)\npen down\nset y to (66)\nset x to (26)\nset y to (-190)\npen up\nset pen size to (100)\ngo to x: (-188) y: (-190)\npen down\nset y to (26)\nset x to (-14)\nset y to (-190)\npen up\nset pen size to (220)\ngo to x: (-112) y: (-75)\npen down\nset x to (-90)\npen up\nClear Buttons\n\nwhen I receive [mainmenu2 v]\nset [menupage v] to [2]\nMain Menu Base\nAdd Button [-205] [44] [30] [_cloud]\nAdd Button [-205] [-4] [30] [_settings]\nAdd Button [-205] [-52] [30] [_credits]\nAdd Button [9] [49] [20] [_previous]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint | Pos [-170] [44] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Cloud]\nPrint | Pos [-170] [-4] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Settings]\nPrint | Pos [-170] [-52] Size [25] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Credits]\nUpdate Buttons\nif <(EditorMode) = [false]> then\n    broadcast (mainMenu3D v) and wait\nend\nUpdate Until Button Clicked\nif <(buttonClicked) = [_cloud]> then\n    broadcast (cloudAll v)\nelse\n    if <(buttonClicked) = [_settings]> then\n        broadcast (settings v)\n    else\n        if <(buttonClicked) = [_credits]> then\n            broadcast (credits v)\n        else\n            if <(buttonClicked) = [_previous]> then\n                broadcast (mainMenu v)\n            end\n        end\n    end\nend\n\nwhen I receive [credits v]\nLoad | Font [Nunito Sans Bold]\nFill Screen With Sky\nSet Pen Color | RGBA [31] [31] [31] []\nPrint | Pos [0] [165] Size [50] Bounds [] [] Space [] Underline [] [] Align [c] [t] Text [Credits]\npen up\nSet Pen Color | RGBA [63] [63] [63] []\nset pen size to (200)\ngo to x: (-400) y: (-2)\npen down\nset x to (400)\npen up\ngo to x: (-400) y: (-180)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (4)\ngo to x: (-400) y: (98)\npen down\nset x to (400)\npen up\nLoad | Font [Nunito Sans Light]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint | Pos [-220] [76] Size [18] Bounds [] [] Space [] Underline [] [] Align [] [t] Text [Font - Nunito Sans]\nNew Lines | Number [] Size [18] Space []\nPrint | Pos [-220] (_y) Size [18] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Music - ]\nNew Lines | Number [] Size [18] Space []\nPrint | Pos [-220] (_y) Size [18] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Fire Sound - Mike Koenig]\nNew Lines | Number [] Size [18] Space []\nPrint | Pos [-220] (_y) Size [18] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Victory Sound - Mike Koenig]\nNew Lines | Number [] Size [18] Space []\nPrint | Pos [-220] (_y) Size [18] Bounds [] [] Space [] Underline [] [] Align [] [] Text [Math Formulas - Various Sources]\nNew Lines | Number [] Size [18] Space []\nPrint | Pos [-220] (_y) Size [18] Bounds [] [] Space [] Underline [] [] Align [] [] Text [All Other Code and Assets - @-Rex-]\nClear Buttons\nAdd Button [0] [-146] [34] [_home]\nUpdate Until Button Clicked\nbroadcast (mainMenu2 v)\n\nwhen I receive [tutorial v]\ntutorialControls\ntutorialTips\ntutorialPlatforms\ntutorialEditor\nbroadcast (mainMenu v)\n\nwhen I receive [settings v]\nLoad | Font [Nunito Sans Bold]\nFill Screen With Sky\nSet Pen Color | RGBA [31] [31] [31] []\nPrint | Pos [0] [165] Size [30] Bounds [] [] Space [] Underline [] [] Align [c] [t] Text [Settings]\npen up\nSet Pen Color | RGBA [63] [63] [63] []\nset pen size to (200)\ngo to x: (-400) y: (18)\npen down\nset x to (400)\npen up\ngo to x: (-400) y: (-180)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (4)\ngo to x: (-400) y: (118)\npen down\nset x to (400)\npen up\nClear Buttons\nAdd Button [-195] [85] [24] (item (1) of [controls v])\nAdd Button [-195] [45] [24] (item (2) of [controls v])\nAdd Button [-195] [5] [24] (item (3) of [controls v])\nAdd Button [-195] [-35] [24] (item (4) of [controls v])\nAdd Button [45] [85] [24] (item (5) of [controls v])\nAdd Button [45] [45] [24] (item (6) of [controls v])\nAdd Button [45] [-35] [24] [_graphics]\nif <(MusicEnabled) = [true]> then\n    Add Button [45] [-75] [24] [_musicEnabled]\nelse\n    Add Button [45] [-75] [24] [_musicDisabled]\nend\nAdd Button [0] [-146] [34] [_home]\nLoad | Font [Nunito Sans Light]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint | Pos [-170] [85] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Move Forward]\nPrint | Pos [-170] [45] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Move Backward]\nPrint | Pos [-170] [5] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Move Left]\nPrint | Pos [-170] [-35] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Move Right]\nPrint | Pos [70] [85] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Respawn]\nPrint | Pos [70] [45] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Main Menu]\nPrint | Pos [70] [-35] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text (join (3DQuality) [ Graphics])\nif <(MusicEnabled) = [true]> then\n    Print | Pos [70] [-75] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Music Enabled]\nelse\n    Print | Pos [70] [-75] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Music Disabled]\nend\nLoad | Font [Nunito Sans]\nUpdate Until Button Clicked\nif <(buttonClicked) = [_home]> then\n    broadcast (mainMenu2 v)\nelse\n    if <(buttonClickedIdx) > [6]> then\n        if <(buttonClicked) = [_graphics]> then\n            if <(3DQuality) = [Low]> then\n                set [3dquality v] to [Extreme]\n            else\n                if <(3DQuality) = [Medium]> then\n                    set [3dquality v] to [Low]\n                else\n                    if <(3DQuality) = [High]> then\n                        set [3dquality v] to [Medium]\n                    else\n                        if <(3DQuality) = [Ultra]> then\n                            set [3dquality v] to [High]\n                        else\n                            if <(3DQuality) = [Extreme]> then\n                                set [3dquality v] to [Ultra]\n                            else\n                                set [3dquality v] to [Medium]\n                            end\n                        end\n                    end\n                end\n            end\n            broadcast (settings v)\n            broadcast (update3DQuality v)\n        else\n            if <(buttonClicked) = [_musicEnabled]> then\n                set [musicenabled v] to [false]\n                broadcast (settings v)\n                broadcast (disableMusic v)\n            else\n                if <(buttonClicked) = [_musicDisabled]> then\n                    set [musicenabled v] to [true]\n                    broadcast (settings v)\n                    broadcast (enableMusic v)\n                end\n            end\n        end\n    else\n        Load | Font [Nunito Sans Light]\n        Set Pen Color | RGBA [247] [223] [47] []\n        Print | Pos [-210] [-80] Size [14] Bounds [] [] Space [] Underline [] [] Align [] [c] Text [Press Any Letter Key]\n        wait until <key (any v) pressed?>\n        Detect Key Pressed\n        if <not <(keyPressed) = [none]>> then\n            replace item (buttonClickedIdx) of [controls v] with (keyPressed)\n        end\n        broadcast (settings v)\n    end\nend\n\ndefine Detect Key Pressed\nset [keypressed v] to [none]\nset [_i0 v] to [1]\nrepeat (26)\n    if <key ((letter (_i0) of [ABCDEFGHIJKLMNOPQRSTUVWXYZ]) v) pressed?> then\n        set [keypressed v] to (letter (_i0) of [ABCDEFGHIJKLMNOPQRSTUVWXYZ])\n        stop [this script v]\n    end\n    change [_i0 v] by (1)\nend\n\nwhen I receive [cloudall v]\nset [error v] to [none]\nbroadcast (loadCloudAll v) and wait\nif <not <(Error) = [none]>> then\n    broadcast (errorScreen v)\n    stop [this script v]\nend\ncloudBackground\nLoad | Font [Nunito Sans Light]\nClear Buttons\nAdd Button [0] [-146] [34] [_home]\nAdd Button [60] [-146] [24] [_next]\nUpdate Buttons\nRender Cloud [1] [12]\nUpdate Until Button Clicked\nif <(buttonClicked) = [_home]> then\n    broadcast (mainMenu2 v)\nelse\n    if <(buttonClicked) = [_next]> then\n        broadcast (cloudAll2 v)\n    end\nend\n\ndefine Render Cloud (lo) (hi)\nSet Pen Color | RGBA [159] [159] [159] []\nset [_y v] to [78]\nPrint | Pos [-183] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text [Level]\nPrint | Pos [-83] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text [World Record]\nPrint | Pos [117] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text [Record Holder]\nPrint | Pos [217] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text [Global Wins]\nset [_idx0 v] to (lo)\nrepeat (((hi) + (1)) - (lo))\n    change [_y v] by (-16)\n    if <(_idx0) > ((length of [mainlevels v]) / (2))> then\n        set pen color to (SKY_COLOR)\n    else\n        Set Pen Color | RGBA [255] [255] [255] []\n    end\n    Print | Pos [-183] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text (_idx0)\n    Set Pen Color | RGBA [255] [255] [255] []\n    set [_i0 v] to (item (_idx0) of [cloud | scores v])\n    if <(_i0) = [Infinity]> then\n        Print | Pos [-83] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text [---]\n    else\n        set [_i1 v] to ([floor v] of ((100) * ((_i0) mod (1))) )\n        if <(length of (_i1)) = [1]> then\n            set [_i1 v] to (join [0] (_i1))\n        end\n        Print | Pos [-83] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text (join (join ([floor v] of (_i0) ) (join [.] (_i1))) [ sec])\n    end\n    Get Width | Size [1] Space [] Text (item (_idx0) of [cloud | names v])\n    if <((190) / (_width)) > [10]> then\n        Print | Pos [117] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text (item (_idx0) of [cloud | names v])\n    else\n        Print | Pos [117] (_y) Size ((190) / (_width)) Bounds [] [] Space [] Underline [] [] Align [r] [] Text (item (_idx0) of [cloud | names v])\n    end\n    Print | Pos [217] (_y) Size [10] Bounds [] [] Space [] Underline [] [] Align [r] [] Text (item (_idx0) of [cloud | wins v])\n    Set Pen Color | RGBA [47] [47] [47] []\n    set pen size to (1)\n    go to x: (-218) y: ((_y) + (11.5))\n    pen down\n    set x to (218)\n    pen up\n    change [_idx0 v] by (1)\nend\n\nwhen I receive [cloudall2 v]\nset [error v] to [none]\nbroadcast (loadCloudAll v) and wait\nif <not <(Error) = [none]>> then\n    broadcast (errorScreen v)\n    stop [this script v]\nend\ncloudBackground\nLoad | Font [Nunito Sans Light]\nClear Buttons\nAdd Button [0] [-146] [34] [_home]\nAdd Button [-60] [-146] [24] [_previous]\nAdd Button [60] [-146] [24] [_next]\nUpdate Buttons\nRender Cloud [13] [24]\nUpdate Until Button Clicked\nif <(buttonClicked) = [_home]> then\n    broadcast (mainMenu2 v)\nelse\n    if <(buttonClicked) = [_previous]> then\n        broadcast (cloudAll v)\n    else\n        if <(buttonClicked) = [_next]> then\n            broadcast (cloudAll3 v)\n        end\n    end\nend\n\nwhen I receive [cloudall3 v]\nset [error v] to [none]\nbroadcast (loadCloudAll v) and wait\nif <not <(Error) = [none]>> then\n    broadcast (errorScreen v)\n    stop [this script v]\nend\ncloudBackground\nLoad | Font [Nunito Sans Light]\nClear Buttons\nAdd Button [0] [-146] [34] [_home]\nAdd Button [-60] [-146] [24] [_previous]\nUpdate Buttons\nRender Cloud [25] [36]\nUpdate Until Button Clicked\nif <(buttonClicked) = [_home]> then\n    broadcast (mainMenu2 v)\nelse\n    if <(buttonClicked) = [_previous]> then\n        broadcast (cloudAll2 v)\n    end\nend\n\nwhen I receive [editortext v]\nif <not <(LoopTask) = [none]>> then\n    wait until <(LoopTask) = [none]>\nend\nset [looptask v] to [editorText]\nDraw Editor Text (TextEditor)\nset [looptask v] to [none]\n\ndefine Draw Editor Text (text)\nif <not <(text) = []>> then\n    Get Width | Size [12] Space [] Text (text)\n    Set Pen Color | RGBA [31] [31] [31] []\n    set pen size to (34)\n    go to x: ((_width) / (-2)) y: (156)\n    pen down\n    set x to ((_width) / (2))\n    pen up\n    Set Pen Color | RGBA [63] [63] [63] []\n    set pen size to (26)\n    go to x: ((_width) / (-2)) y: (156)\n    pen down\n    set x to ((_width) / (2))\n    pen up\n    Set Pen Color | RGBA [255] [255] [255] []\n    Print | Pos [0] [156] Size [12] Bounds [] [] Space [] Underline [] [] Align [c] [0.4] Text (text)\nend\n\ndefine tutorialControls\ntutorialBase\nLoad | Font [Nunito Sans Light]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos [] [79] Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Use the ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text (join (join (item (1) of [controls v]) (item (3) of [controls v])) (join (item (2) of [controls v]) (item (4) of [controls v])))\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ keys to move]\nNew Lines | Number [] Size [18] Space [1.5]\nPrint WW | Pos [] (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Use the ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [arrow]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ keys to look around]\nNew Lines | Number [] Size [18] Space [1.5]\nPrint WW | Pos [] (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Press ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [space]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ to jump]\nNew Lines | Number [] Size [18] Space [1.5]\nPrint WW | Pos [] (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Press ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text (item (5) of [controls v])\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ to respawn]\nNew Lines | Number [] Size [18] Space [1.5]\nPrint WW | Pos [] (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Press ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text (item (6) of [controls v])\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ to return to the main menu]\nNew Lines | Number [] Size [18] Space [1.5]\nPrint WW | Pos [] (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Go to Settings to change the controls]\nClear Buttons\nAdd Button [0] [-151] [24] [_next]\nUpdate Until Button Clicked\n\ndefine tutorialBase\nLoad | Font [Nunito Sans Bold]\nFill Screen With Sky\nSet Pen Color | RGBA [31] [31] [31] []\nPrint | Pos [0] [165] Size [30] Bounds [] [] Space [] Underline [] [] Align [c] [t] Text [Tutorial]\npen up\nSet Pen Color | RGBA [63] [63] [63] []\nset pen size to (200)\ngo to x: (-400) y: (18)\npen down\nset x to (400)\npen up\ngo to x: (-400) y: (-180)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (4)\ngo to x: (-400) y: (118)\npen down\nset x to (400)\npen up\n\ndefine tutorialPlatforms\ntutorialBase\nLoad | Font [Nunito Sans Light]\nSet Pen Color | RGBA [255] [255] [255] []\nset pen color to (item (1) of [platform_colors v])\nPrint WW | Pos [] [83] Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Gray]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [, ]\nset pen color to (#000000)\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Black]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [, ]\nset pen color to (item (10) of [platform_colors v])\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Grass]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [, and ]\nset pen color to (item (11) of [platform_colors v])\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Dirt ]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [platforms are normal]\nNew Lines | Number [] Size [14] Space [1.5]\nset pen color to (item (2) of [platform_colors v])\nchange pen (brightness v) by (20)\nPrint WW | Pos [] (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Purple ]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [platforms restrict vertical movement]\nNew Lines | Number [] Size [14] Space [1.5]\nset pen color to (item (3) of [platform_colors v])\nPrint WW | Pos [] (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Pink ]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [platforms cause the player to bounce off]\nNew Lines | Number [] Size [14] Space [1.5]\nset pen color to (item (6) of [platform_colors v])\nPrint WW | Pos [] (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Blue ]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [platforms flip gravity]\nNew Lines | Number [] Size [14] Space [1.5]\nset pen color to (item (7) of [platform_colors v])\nPrint WW | Pos [] (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Orange ]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [platforms set the player on fire]\nNew Lines | Number [] Size [14] Space [1.5]\nset pen color to (item (8) of [platform_colors v])\nPrint WW | Pos [] (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Red ]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [platforms immediately kill the player]\nNew Lines | Number [] Size [14] Space [1.5]\nset pen color to (item (4) of [platform_colors v])\nPrint WW | Pos [] (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Yellow ]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [platforms are checkpoints]\nNew Lines | Number [] Size [14] Space [1.5]\nset pen color to (item (5) of [platform_colors v])\nPrint WW | Pos [] (_y) Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Bright Green ]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [14] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [platforms should be reached to win]\nClear Buttons\nAdd Button [0] [-151] [24] [_next]\nUpdate Until Button Clicked\n\ndefine tutorialTips\ntutorialBase\nLoad | Font [Nunito Sans Light]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos [] [79] Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [If you can’t pass a level, go to Level Select and choose the next level. You may play any level from Level Select.]\nNew Lines | Number [] Size [18] Space [2]\nPrint WW | Pos [] (_y) Size [18] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [If the game runs at a low frame rate, go to Settings and lower the graphics quality or go to Turbowarp link in the Notes and Credits.]\nClear Buttons\nAdd Button [0] [-151] [24] [_next]\nUpdate Until Button Clicked\n\ndefine tutorialEditor\ntutorialBase\nLoad | Font [Nunito Sans Light]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos [] [83] Size [14] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Editor Controls]\nNew Lines | Number [] Size [14] Space []\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos [] (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text (join (join (item (1) of [controls v]) (item (3) of [controls v])) (join (item (2) of [controls v]) (item (4) of [controls v])))\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ to move \(hold ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [space]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ to look around, ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [F]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ to adjust\)]\nNew Lines | Number [] Size [12] Space [1.5]\nPrint WW | Pos [] (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Use the ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [QE]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ keys to move up and down]\nNew Lines | Number [] Size [12] Space [1.5]\nPrint WW | Pos [] (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Use the ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [arrow]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ keys to look around]\nNew Lines | Number [] Size [12] Space [1.5]\nPrint WW | Pos [] (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Press ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text (item (6) of [controls v])\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ to toggle between edit and play mode]\nNew Lines | Number [] Size [12] Space [1.5]\nPrint WW | Pos [] (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Press ]\nSet Pen Color | RGBA [247] [223] [47] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [C]\nSet Pen Color | RGBA [255] [255] [255] []\nPrint WW | Pos (_x) (_y) Size [12] Bounds [-210] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [ to add a new object]\nNew Lines | Number [] Size [12] Space [1.5]\nPrint WW | Pos [] (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Click the surface of a polygon to modify it]\nNew Lines | Number [] Size [12] Space [1.5]\nPrint WW | Pos [] (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Click and drag the vertices of a polygon to move them]\nNew Lines | Number [] Size [12] Space [1.5]\nPrint WW | Pos [] (_y) Size [12] Bounds [-220] [220] [] [] Space [] [] Underline [] [] Align [] [] Text [Click and drag the black box to move the spawn location]\nClear Buttons\nAdd Button [0] [-146] [34] [_home]\nUpdate Until Button Clicked\n\ndefine cloudBackground\nLoad | Font [Nunito Sans Bold]\nFill Screen With Sky\nSet Pen Color | RGBA [31] [31] [31] []\nPrint | Pos [0] [165] Size [50] Bounds [] [] Space [] Underline [] [] Align [c] [t] Text [Cloud]\npen up\nSet Pen Color | RGBA [63] [63] [63] []\nset pen size to (200)\ngo to x: (-400) y: (-2)\npen down\nset x to (400)\npen up\ngo to x: (-400) y: (-180)\npen down\nset x to (400)\npen up\nSet Pen Color | RGBA [31] [31] [31] []\nset pen size to (4)\ngo to x: (-400) y: (98)\npen down\nset x to (400)\npen up\n\n@Editor\n\ndefine _revRot (x) (y) (z) (sinx) (cosx) (siny) (cosy) (sinz) (cosz)\nset [_rot0 v] to (((cosz) * (x)) - ((sinz) * (y)))\nset [_rotatedy v] to (((cosz) * (y)) + ((sinz) * (x)))\nset [_rotatedz v] to (((cosx) * (z)) + ((sinx) * (_rotatedY)))\nset [_rotatedy v] to (((cosx) * (_rotatedY)) - ((sinx) * (z)))\nset [_rotatedx v] to (((cosy) * (_rot0)) - ((siny) * (_rotatedZ)))\nset [_rotatedz v] to (((cosy) * (_rotatedZ)) + ((siny) * (_rot0)))\n\nwhen flag clicked\nhide\n\nwhen I receive [editortoplaymode v]\nbroadcast (updateLevelAfterEditor v) and wait\nbroadcast (gameLoop v) and wait\nUpdate Quad Ordering\n\nwhen I receive [initeditor v]\nInit\n\ndefine Update Quad Ordering\ndelete all of [3dquadorder v]\n_orderAddQuad [1] (length of [3dquadcolor v])\n\ndefine Replace (idx) with Box (xmin) (xmax) (ymin) (ymax) (zmin) (zmax) (rot) Type (type)\nset [_rotsin v] to ([sin v] of (rot) )\nset [_rotcos v] to ([cos v] of (rot) )\nset [_midx v] to (((xmin) + (xmax)) / (2))\nset [_midy v] to (((ymin) + (ymax)) / (2))\nset [_midz v] to (((zmin) + (zmax)) / (2))\nReplace (idx) with Quad ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) Type (type) [true]\nReplace ((idx) + (1)) with Quad ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) Type (type) [true]\nReplace ((idx) + (2)) with Quad ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) Type (type) [true]\nReplace ((idx) + (3)) with Quad ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) Type (type) [true]\nReplace ((idx) + (4)) with Quad ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymin) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) Type (type) [true]\nReplace ((idx) + (5)) with Quad ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmin) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmin) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmax) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmax) - (_midZ)))) + (_midZ)) ((((_rotCos) * ((xmax) - (_midX))) - ((_rotSin) * ((zmin) - (_midZ)))) + (_midX)) (ymax) ((((_rotSin) * ((xmax) - (_midX))) + ((_rotCos) * ((zmin) - (_midZ)))) + (_midZ)) Type (type) [true]\n\ndefine Find Bounds (x0) (y0) (z0) (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3)\nset [_xmin v] to (x0)\nset [_xmax v] to (x0)\nset [_ymin v] to (y0)\nset [_ymax v] to (y0)\nset [_zmin v] to (z0)\nset [_zmax v] to (z0)\nif <(x1) > (_xmax)> then\n    set [_xmax v] to (x1)\nelse\n    if <(x1) < (_xmin)> then\n        set [_xmin v] to (x1)\n    end\nend\nif <(y1) > (_ymax)> then\n    set [_ymax v] to (y1)\nelse\n    if <(y1) < (_ymin)> then\n        set [_ymin v] to (y1)\n    end\nend\nif <(z1) > (_zmax)> then\n    set [_zmax v] to (z1)\nelse\n    if <(z1) < (_zmin)> then\n        set [_zmin v] to (z1)\n    end\nend\nif <(x2) > (_xmax)> then\n    set [_xmax v] to (x2)\nelse\n    if <(x2) < (_xmin)> then\n        set [_xmin v] to (x2)\n    end\nend\nif <(y2) > (_ymax)> then\n    set [_ymax v] to (y2)\nelse\n    if <(y2) < (_ymin)> then\n        set [_ymin v] to (y2)\n    end\nend\nif <(z2) > (_zmax)> then\n    set [_zmax v] to (z2)\nelse\n    if <(z2) < (_zmin)> then\n        set [_zmin v] to (z2)\n    end\nend\nif <not <(x3) = [_]>> then\n    if <(x3) > (_xmax)> then\n        set [_xmax v] to (x3)\n    else\n        if <(x3) < (_xmin)> then\n            set [_xmin v] to (x3)\n        end\n    end\n    if <(y3) > (_ymax)> then\n        set [_ymax v] to (y3)\n    else\n        if <(y3) < (_ymin)> then\n            set [_ymin v] to (y3)\n        end\n    end\n    if <(z3) > (_zmax)> then\n        set [_zmax v] to (z3)\n    else\n        if <(z3) < (_zmin)> then\n            set [_zmin v] to (z3)\n        end\n    end\nend\n\ndefine Replace (idx) with Quad (x0) (y0) (z0) (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) Type (type) (culling)\nset [_id0 v] to ((4) * (idx))\nreplace item ((_id0) - (3)) of [3dquadx v] with (x0)\nreplace item ((_id0) - (3)) of [3dquady v] with (y0)\nreplace item ((_id0) - (3)) of [3dquadz v] with (z0)\nreplace item ((_id0) - (2)) of [3dquadx v] with (x1)\nreplace item ((_id0) - (2)) of [3dquady v] with (y1)\nreplace item ((_id0) - (2)) of [3dquadz v] with (z1)\nreplace item ((_id0) - (1)) of [3dquadx v] with (x2)\nreplace item ((_id0) - (1)) of [3dquady v] with (y2)\nreplace item ((_id0) - (1)) of [3dquadz v] with (z2)\nreplace item (_id0) of [3dquadx v] with (x3)\nreplace item (_id0) of [3dquady v] with (y3)\nreplace item (_id0) of [3dquadz v] with (z3)\nUpdate Bounds of Quad (idx)\nreplace item ((_id0) - (3)) of [3dquadmovement v] with [_]\nreplace item ((_id0) - (2)) of [3dquadmovement v] with [_]\nreplace item ((_id0) - (1)) of [3dquadmovement v] with [_]\nreplace item (_id0) of [3dquadmovement v] with [_]\nif <not <(type) = [_]>> then\n    if <(type) = [-2]> then\n        replace item (_id0) of [3dquadcolor v] with ((1) * (1513239))\n        replace item (_id0) of [3dquadreflectivity v] with ((1) * (0.3))\n    else\n        if <(type) = [-1]> then\n            replace item (_id0) of [3dquadcolor v] with ((1) * (4144959))\n            replace item (_id0) of [3dquadreflectivity v] with ((1) * (0.3))\n        else\n            if <(type) = [0]> then\n                replace item (_id0) of [3dquadcolor v] with ((1) * (14671839))\n                replace item (_id0) of [3dquadreflectivity v] with ((1) * (1.0))\n            else\n                replace item (_id0) of [3dquadtype v] with (type)\n                replace item (_id0) of [3dquadcolor v] with (item (type) of [platform_colors v])\n                replace item (_id0) of [3dquadreflectivity v] with (item (type) of [platform_reflects v])\n            end\n        end\n    end\nend\nif <(culling) = []> then\n    replace item (idx) of [3dquadbackculling v] with [false]\nelse\n    replace item (idx) of [3dquadbackculling v] with (culling)\nend\n\ndefine Add New Quad (type)\nadd [] to [3dquadx v]\nadd [] to [3dquadx v]\nadd [] to [3dquadx v]\nadd [] to [3dquadx v]\nadd [] to [3dquady v]\nadd [] to [3dquady v]\nadd [] to [3dquady v]\nadd [] to [3dquady v]\nadd [] to [3dquadz v]\nadd [] to [3dquadz v]\nadd [] to [3dquadz v]\nadd [] to [3dquadz v]\nadd [] to [3dquadboundx v]\nadd [] to [3dquadboundx v]\nadd [] to [3dquadboundx v]\nadd [] to [3dquadboundx v]\nadd [] to [3dquadboundy v]\nadd [] to [3dquadboundy v]\nadd [] to [3dquadboundy v]\nadd [] to [3dquadboundy v]\nadd [] to [3dquadboundz v]\nadd [] to [3dquadboundz v]\nadd [] to [3dquadboundz v]\nadd [] to [3dquadboundz v]\nif <(type) = [-2]> then\n    add ((1) * (1513239)) to [3dquadcolor v]\n    add ((1) * (12.3)) to [3dquadreflectivity v]\nelse\n    if <(type) = [-1]> then\n        add ((1) * (4144959)) to [3dquadcolor v]\n        add ((1) * (12.3)) to [3dquadreflectivity v]\n    else\n        if <(type) = [0]> then\n            add ((1) * (14671839)) to [3dquadcolor v]\n            add ((1) * (17.0)) to [3dquadreflectivity v]\n        else\n            add (type) to [3dquadtype v]\n            add (item (type) of [platform_colors v]) to [3dquadcolor v]\n            add (item (type) of [platform_reflects v]) to [3dquadreflectivity v]\n        end\n    end\nend\nadd [_] to [3dquadmovement v]\nadd [_] to [3dquadmovement v]\nadd [_] to [3dquadmovement v]\nadd [_] to [3dquadmovement v]\nadd [false] to [3dquadbackculling v]\n\ndefine Replace (idx) With Player Spawn\nReplace (idx) with Box ((item (1) of [locationspawn v]) - (PL_S_H)) ((item (1) of [locationspawn v]) + (PL_S_H)) ((item (2) of [locationspawn v]) - (PL_S_V)) ((item (2) of [locationspawn v]) + (PL_S_V)) ((item (3) of [locationspawn v]) - (PL_S_H)) ((item (3) of [locationspawn v]) + (PL_S_H)) ((-1) * (item (4) of [locationspawn v])) Type [_]\n\ndefine Init\nset [pl_s_v v] to [16]\nset [pl_s_h v] to ((PL_S_V) / (2))\nAdd New Quad [-1]\nAdd New Quad [-2]\nAdd New Quad [-2]\nAdd New Quad [-2]\nAdd New Quad [-2]\nAdd New Quad [-2]\nReplace ((length of [3dquadcolor v]) - (5)) With Player Spawn\nset [_i0 v] to [1]\nrepeat (((length of [textareas v]) - (3)) / (7))\n    Add New Quad [0]\n    Add New Quad [0]\n    Add New Quad [0]\n    Add New Quad [0]\n    Add New Quad [0]\n    Add New Quad [0]\n    Replace ((length of [3dquadcolor v]) - (5)) with TextArea (_i0)\n    change [_i0 v] by (1)\nend\nInit Soft\n\ndefine Replace (idx) with TextArea (textidx)\nset [_id0 v] to (((7) * (textidx)) - (3))\nReplace (idx) with Box (item (_id0) of [textareas v]) (item ((_id0) + (1)) of [textareas v]) (item ((_id0) + (2)) of [textareas v]) (item ((_id0) + (3)) of [textareas v]) (item ((_id0) + (4)) of [textareas v]) (item ((_id0) + (5)) of [textareas v]) [0] Type [0]\n\nwhen I receive [initsofteditor v]\nInit Soft\n\ndefine Init Soft\nset [grid_resolution v] to [5]\nset [mousedown v] to [false]\ndelete all of [_selection v]\nUpdate Quad Ordering\n\nwhen I receive [editor v]\nif <not <(LoopTask) = [none]>> then\n    wait until <(LoopTask) = [none]>\nend\nset [looptask v] to [editor]\nset [texteditor v] to []\nif <mouse down?> then\n    if <(mouseDown) = [false]> then\n        delete all of [selectvertex v]\n        add [needSelection] to [selectvertex v]\n        delete all of [selectquad v]\n        add [needSelection] to [selectquad v]\n        delete all of [_selection v]\n    else\n        if <(length of [_selection v]) = [0]> then\n            Choose Selection\n        end\n        Process Selection\n    end\n    set [mousedown v] to [true]\nelse\n    delete all of [_selection v]\n    set [mousedown v] to [false]\nend\nset [looptask v] to [none]\n\ndefine Choose Selection\ndelete all of [_selection v]\nif <(item (2) of [selectvertex v]) = [none]> then\n    if <not <(item (2) of [selectquad v]) = [none]>> then\n        Choose Quad Selection (item (1) of [selectquad v]) (item (2) of [selectquad v])\n    end\nelse\n    if <(item (2) of [selectquad v]) = [none]> then\n        add [vertex] to [_selection v]\n        set [_i0 v] to [1]\n        repeat (length of [selectvertex v])\n            add (item (_i0) of [selectvertex v]) to [_selection v]\n            change [_i0 v] by (1)\n        end\n    else\n        if <((1) / (item (1) of [selectquad v])) < (item (1) of [selectvertex v])> then\n            Choose Quad Selection (item (1) of [selectquad v]) (item (2) of [selectquad v])\n        else\n            add [vertex] to [_selection v]\n            set [_i0 v] to [1]\n            repeat (length of [selectvertex v])\n                add (item (_i0) of [selectvertex v]) to [_selection v]\n                change [_i0 v] by (1)\n            end\n        end\n    end\nend\nif <(length of [_selection v]) = [0]> then\n    add [none] to [_selection v]\nend\n\ndefine Process Selection\nif <(item (1) of [_selection v]) = [vertex]> then\n    Get 3D Coords of Mouse at Depth (item (2) of [_selection v])\n    set [texteditor v] to (join (join (join [\(x=] (_gridX)) (join (join [, z=] (_gridZ)) (join [, y=] (_gridY)))) [\)])\n    set [_i0 v] to [3]\n    repeat ((length of [_selection v]) - (2))\n        Move Point (item (_i0) of [_selection v]) to (_gridX) (_gridY) (_gridZ)\n        change [_i0 v] by (1)\n    end\nelse\n    if <(item (1) of [_selection v]) = [spawn]> then\n        Get 3D Coords of Mouse at Depth (item (2) of [_selection v])\n        set [texteditor v] to (join (join (join [Player Spawn \(x=] (_gridX)) (join (join [, z=] (_gridZ)) (join [, y=] (_gridY)))) [\)])\n        replace item (1) of [locationspawn v] with (_gridX)\n        replace item (2) of [locationspawn v] with (_gridY)\n        replace item (3) of [locationspawn v] with (_gridZ)\n        replace item (4) of [locationspawn v] with ((45) * (round ((((3DCamRotY) + (180)) mod (360)) / (45))))\n        Replace ((length of [3dquadtype v]) + (1)) With Player Spawn\n    end\nend\n\ndefine Get 3D Coords of Mouse at Depth (z)\nset [_gridx v] to (3DCamX)\nset [_gridy v] to (3DCamY)\nset [_gridz v] to (3DCamZ)\nReverse Rotate (((mouse x) / (180)) * ((z) * ([tan v] of (([abs v] of (3DCamFOV) ) / (2)) ))) (((mouse y) / (180)) * ((z) * ([tan v] of (([abs v] of (3DCamFOV) ) / (2)) ))) (z) (3DCamRotX) (3DCamRotY) (3DCamRotZ)\nchange [_gridx v] by (_rotatedX)\nchange [_gridy v] by (_rotatedY)\nchange [_gridz v] by (_rotatedZ)\nSnap to Grid\n\ndefine Snap to Grid\nset [_gridx v] to ((GRID_RESOLUTION) * (round ((_gridX) / (GRID_RESOLUTION))))\nset [_gridy v] to ((GRID_RESOLUTION) * (round ((_gridY) / (GRID_RESOLUTION))))\nset [_gridz v] to ((GRID_RESOLUTION) * (round ((_gridZ) / (GRID_RESOLUTION))))\n\ndefine Reverse Rotate (x) (y) (z) (rotx) (roty) (rotz)\n_revRot (x) (y) (z) ([sin v] of ((-1) * (rotx)) ) ([cos v] of ((-1) * (rotx)) ) ([sin v] of ((-1) * (roty)) ) ([cos v] of ((-1) * (roty)) ) ([sin v] of ((-1) * (rotz)) ) ([cos v] of ((-1) * (rotz)) )\n\ndefine Move Point (idx) to (x) (y) (z)\nif <not <(item (idx) of [3dquadx v]) = [_]>> then\n    replace item (idx) of [3dquadx v] with (x)\n    replace item (idx) of [3dquady v] with (y)\n    replace item (idx) of [3dquadz v] with (z)\n    set [_id1 v] to ((4) * ([ceiling v] of ((idx) / (4)) ))\n    if <not <(item (_id1) of [3dquadx v]) = [_]>> then\n        if <(((idx) - (1)) mod (4)) = [2]> then\n            replace item ((idx) - (2)) of [3dquadx v] with ((x) - ((2) * ((x) - (((item ((idx) + (1)) of [3dquadx v]) + (item ((idx) - (1)) of [3dquadx v])) / (2)))))\n            replace item ((idx) - (2)) of [3dquady v] with ((y) - ((2) * ((y) - (((item ((idx) + (1)) of [3dquady v]) + (item ((idx) - (1)) of [3dquady v])) / (2)))))\n            replace item ((idx) - (2)) of [3dquadz v] with ((z) - ((2) * ((z) - (((item ((idx) + (1)) of [3dquadz v]) + (item ((idx) - (1)) of [3dquadz v])) / (2)))))\n        else\n            replace item ((_id1) - (1)) of [3dquadx v] with ((item ((_id1) - (3)) of [3dquadx v]) - ((2) * ((item ((_id1) - (3)) of [3dquadx v]) - (((item ((_id1) - (2)) of [3dquadx v]) + (item (_id1) of [3dquadx v])) / (2)))))\n            replace item ((_id1) - (1)) of [3dquady v] with ((item ((_id1) - (3)) of [3dquady v]) - ((2) * ((item ((_id1) - (3)) of [3dquady v]) - (((item ((_id1) - (2)) of [3dquady v]) + (item (_id1) of [3dquady v])) / (2)))))\n            replace item ((_id1) - (1)) of [3dquadz v] with ((item ((_id1) - (3)) of [3dquadz v]) - ((2) * ((item ((_id1) - (3)) of [3dquadz v]) - (((item ((_id1) - (2)) of [3dquadz v]) + (item (_id1) of [3dquadz v])) / (2)))))\n        end\n    end\n    Update Bounds of Quad ([ceiling v] of ((idx) / (4)) )\nend\n\ndefine Update Bounds of Quad (idx)\nset [_id0 v] to ((4) * (idx))\nFind Bounds (item ((_id0) - (3)) of [3dquadx v]) (item ((_id0) - (3)) of [3dquady v]) (item ((_id0) - (3)) of [3dquadz v]) (item ((_id0) - (2)) of [3dquadx v]) (item ((_id0) - (2)) of [3dquady v]) (item ((_id0) - (2)) of [3dquadz v]) (item ((_id0) - (1)) of [3dquadx v]) (item ((_id0) - (1)) of [3dquady v]) (item ((_id0) - (1)) of [3dquadz v]) (item (_id0) of [3dquadx v]) (item (_id0) of [3dquady v]) (item (_id0) of [3dquadz v])\nif <(item ((_id0) - (2)) of [3dquadmovement v]) = [_]> then\n    replace item ((_id0) - (3)) of [3dquadboundx v] with (_xmin)\n    replace item ((_id0) - (2)) of [3dquadboundx v] with (_xmax)\nelse\n    if <(item ((_id0) - (2)) of [3dquadmovement v]) < [0]> then\n        replace item ((_id0) - (3)) of [3dquadboundx v] with ((_xmin) + (item ((_id0) - (2)) of [3dquadmovement v]))\n        replace item ((_id0) - (2)) of [3dquadboundx v] with (_xmax)\n    else\n        replace item ((_id0) - (3)) of [3dquadboundx v] with (_xmin)\n        replace item ((_id0) - (2)) of [3dquadboundx v] with ((_xmax) + (item ((_id0) - (2)) of [3dquadmovement v]))\n    end\nend\nreplace item ((_id0) - (1)) of [3dquadboundx v] with (_xmin)\nreplace item (_id0) of [3dquadboundx v] with (_xmax)\nif <(item ((_id0) - (1)) of [3dquadmovement v]) = [_]> then\n    replace item ((_id0) - (3)) of [3dquadboundy v] with (_ymin)\n    replace item ((_id0) - (2)) of [3dquadboundy v] with (_ymax)\nelse\n    if <(item ((_id0) - (1)) of [3dquadmovement v]) < [0]> then\n        replace item ((_id0) - (3)) of [3dquadboundy v] with ((_ymin) + (item ((_id0) - (1)) of [3dquadmovement v]))\n        replace item ((_id0) - (2)) of [3dquadboundy v] with (_ymax)\n    else\n        replace item ((_id0) - (3)) of [3dquadboundy v] with (_ymin)\n        replace item ((_id0) - (2)) of [3dquadboundy v] with ((_ymax) + (item ((_id0) - (1)) of [3dquadmovement v]))\n    end\nend\nreplace item ((_id0) - (1)) of [3dquadboundy v] with (_ymin)\nreplace item (_id0) of [3dquadboundy v] with (_ymax)\nif <(item (_id0) of [3dquadmovement v]) = [_]> then\n    replace item ((_id0) - (3)) of [3dquadboundz v] with (_zmin)\n    replace item ((_id0) - (2)) of [3dquadboundz v] with (_zmax)\nelse\n    if <(item (_id0) of [3dquadmovement v]) < [0]> then\n        replace item ((_id0) - (3)) of [3dquadboundz v] with ((_zmin) + (item (_id0) of [3dquadmovement v]))\n        replace item ((_id0) - (2)) of [3dquadboundz v] with (_zmax)\n    else\n        replace item ((_id0) - (3)) of [3dquadboundz v] with (_zmin)\n        replace item ((_id0) - (2)) of [3dquadboundz v] with ((_zmax) + (item (_id0) of [3dquadmovement v]))\n    end\nend\nreplace item ((_id0) - (1)) of [3dquadboundz v] with (_zmin)\nreplace item (_id0) of [3dquadboundz v] with (_zmax)\n\ndefine _orderAddQuad (lo) (hi)\nadd (round (((lo) + (hi)) / (2))) to [3dquadorder v]\nif <(lo) < (round (((lo) + (hi)) / (2)))> then\n    _orderAddQuad (lo) ((round (((lo) + (hi)) / (2))) - (1))\nend\nif <(hi) > (round (((lo) + (hi)) / (2)))> then\n    _orderAddQuad ((round (((lo) + (hi)) / (2))) + (1)) (hi)\nend\n\ndefine Choose Quad Selection (depth) (idx)\nif <(idx) > (length of [3dquadtype v])> then\n    if <((idx) - (length of [3dquadtype v])) > [6]> then\nelse\n    add [quad] to [_selection v]\n    add (idx) to [_selection v]\nend\n\n@SaveLoad\n\nwhen flag clicked\nhide\n\ndefine Update Graphics to Quality (quality)\nif <is compiled?> then\n    set [3dscreenwidth v] to [364]\nelse\n    set [3dscreenwidth v] to [242]\nend\nif <(quality) = [Low]> then\n    set [3dcamnearz v] to [1]\n    set [3dcamfarz v] to [550]\n    set [3dlightquality v] to [low]\n    set [3dsortmethod v] to [fast]\n    set [3dcamfov v] to [75]\nelse\n    if <(quality) = [Medium]> then\n        set [3dcamnearz v] to [1]\n        set [3dcamfarz v] to [750]\n        set [3dlightquality v] to [high]\n        set [3dsortmethod v] to [accurate]\n        set [3dcamfov v] to [75]\n    else\n        if <(quality) = [High]> then\n            set [3dcamnearz v] to [1]\n            set [3dcamfarz v] to [1000]\n            set [3dlightquality v] to [high]\n            set [3dsortmethod v] to [accurate]\n            set [3dcamfov v] to [85]\n        else\n            if <(quality) = [Ultra]> then\n                set [3dcamnearz v] to [1]\n                set [3dcamfarz v] to [1500]\n                set [3dlightquality v] to [high]\n                set [3dsortmethod v] to [accurate]\n                set [3dcamfov v] to [85]\n            else\n                if <(quality) = [Extreme]> then\n                    set [3dcamnearz v] to [1]\n                    set [3dcamfarz v] to [3000]\n                    set [3dlightquality v] to [high]\n                    set [3dsortmethod v] to [accurate]\n                    set [3dcamfov v] to [85]\n                else\n                    set [3dcamnearz v] to [1]\n                    set [3dcamfarz v] to [100]\n                    set [3dlightquality v] to [high]\n                    set [3dsortmethod v] to [accurate]\n                    set [3dcamfov v] to [85]\n                end\n            end\n        end\n    end\nend\n\ndefine Update Graphics to Sky (sky)\nif <(sky) = [day]> then\n    set [3dlightambientlevel v] to [-0.35]\n    set [3dlightsourcelevel v] to [0.75]\n    set [3dskycolor v] to [4177919]\nelse\n    if <(sky) = [night]> then\n        set [3dlightambientlevel v] to [-0.8]\n        set [3dlightsourcelevel v] to [0.45]\n        set [3dskycolor v] to [132632]\n    else\n        if <(sky) = [space]> then\n            set [3dlightambientlevel v] to [-0.6]\n            set [3dlightsourcelevel v] to [0.9]\n            set [3dskycolor v] to [0]\n        else\n            set [3dlightambientlevel v] to [-0.35]\n            set [3dlightsourcelevel v] to [0.75]\n            set [3dskycolor v] to [4177919]\n        end\n    end\nend\n\ndefine Load Level Data (data)\nset [error v] to [none]\ndelete all of [3dquadtype v]\ndelete all of [3dquadcolor v]\ndelete all of [3dquadreflectivity v]\ndelete all of [3dquadmovement v]\ndelete all of [3dquadbackculling v]\ndelete all of [3dquadx v]\ndelete all of [3dquady v]\ndelete all of [3dquadz v]\ndelete all of [3dquadboundx v]\ndelete all of [3dquadboundy v]\ndelete all of [3dquadboundz v]\ndelete all of [3dquadslope v]\ndelete all of [textareas v]\ndelete all of [locationspawn v]\nset [_len v] to (length of (data))\nset [_i0 v] to [1]\nFind Char (data) [v]\nif <(_i0) > (_len)> then\n    Load Error []\n    stop [this script v]\nend\nchange [_i0 v] by (1)\nExtract Substring (data) [:]\nif <(_i0) > (_len)> then\n    Load Error []\n    stop [this script v]\nend\nchange [_i0 v] by (1)\nset [_version v] to (_s0)\nif <not <[_versions v] contains (_version)?>> then\n    Load Error [Incompatible Version]\n    stop [this script v]\nend\nExtract Substring (data) [;]\nif <(_i0) > (_len)> then\n    Load Error []\n    stop [this script v]\nend\nchange [_i0 v] by (1)\nUpdate Graphics to Sky (_s0)\nrepeat (4)\n    Extract Substring (data) [;]\n    if <(_i0) > (_len)> then\n        Load Error []\n        stop [this script v]\n    end\n    change [_i0 v] by (1)\n    add ((1) * (_s0)) to [locationspawn v]\nend\nExtract Substring (data) [;]\nif <(_i0) > (_len)> then\n    Load Error []\n    stop [this script v]\nend\nchange [_i0 v] by (1)\nrepeat (round (_s0))\n    delete all of [_currentplatform v]\n    repeat (10)\n        Extract Substring (data) [;]\n        if <(_i0) > (_len)> then\n            Load Error []\n            stop [this script v]\n        end\n        change [_i0 v] by (1)\n        if <(_s0) = ((1) * (_s0))> then\n            add ((1) * (_s0)) to [_currentplatform v]\n        else\n            add (_s0) to [_currentplatform v]\n        end\n    end\n    Extract Substring (data) [;]\n    if <(_i0) > (_len)> then\n        Load Error []\n        stop [this script v]\n    end\n    change [_i0 v] by (1)\n    if <(_s0) = [true]> then\n        add [true] to [3dquadbackculling v]\n    else\n        add [false] to [3dquadbackculling v]\n    end\n    Extract Substring (data) [;]\n    if <(_i0) > (_len)> then\n        Load Error []\n        stop [this script v]\n    end\n    change [_i0 v] by (1)\n    if <(_s0) = [true]> then\n        insert [_] at (8) of [_currentplatform v] \n        insert [_] at (9) of [_currentplatform v] \n        insert [_] at (10) of [_currentplatform v] \n        replace item (8) of [_currentplatform v] with ((item (2) of [_currentplatform v]) - ((2) * ((item (2) of [_currentplatform v]) - (((item (5) of [_currentplatform v]) + (item (11) of [_currentplatform v])) / (2)))))\n        replace item (9) of [_currentplatform v] with ((item (3) of [_currentplatform v]) - ((2) * ((item (3) of [_currentplatform v]) - (((item (6) of [_currentplatform v]) + (item (12) of [_currentplatform v])) / (2)))))\n        replace item (10) of [_currentplatform v] with ((item (4) of [_currentplatform v]) - ((2) * ((item (4) of [_currentplatform v]) - (((item (7) of [_currentplatform v]) + (item (13) of [_currentplatform v])) / (2)))))\n    else\n        add [_] to [_currentplatform v]\n        add [_] to [_currentplatform v]\n        add [_] to [_currentplatform v]\n    end\n    set [_i1 v] to (item # of (item (1) of [_currentplatform v]) in [platform_types v])\n    add (_i1) to [3dquadtype v]\n    add (round (item (_i1) of [platform_colors v])) to [3dquadcolor v]\n    add ((1) * (item (_i1) of [platform_reflects v])) to [3dquadreflectivity v]\n    add (item (2) of [_currentplatform v]) to [3dquadx v]\n    add (item (3) of [_currentplatform v]) to [3dquady v]\n    add (item (4) of [_currentplatform v]) to [3dquadz v]\n    add (item (5) of [_currentplatform v]) to [3dquadx v]\n    add (item (6) of [_currentplatform v]) to [3dquady v]\n    add (item (7) of [_currentplatform v]) to [3dquadz v]\n    add (item (8) of [_currentplatform v]) to [3dquadx v]\n    add (item (9) of [_currentplatform v]) to [3dquady v]\n    add (item (10) of [_currentplatform v]) to [3dquadz v]\n    add (item (11) of [_currentplatform v]) to [3dquadx v]\n    add (item (12) of [_currentplatform v]) to [3dquady v]\n    add (item (13) of [_currentplatform v]) to [3dquadz v]\n    set [_i1 v] to [2]\n    set [_min v] to (item (_i1) of [_currentplatform v])\n    set [_max v] to (_min)\n    repeat (3)\n        change [_i1 v] by (3)\n        set [_i2 v] to (item (_i1) of [_currentplatform v])\n        if <not <(_i2) = [_]>> then\n            if <(_i2) < (_min)> then\n                set [_min v] to (_i2)\n            else\n                if <(_i2) > (_max)> then\n                    set [_max v] to (_i2)\n                end\n            end\n        end\n    end\n    set [_xmin v] to (_min)\n    set [_xmax v] to (_max)\n    set [_i1 v] to [3]\n    set [_min v] to (item (_i1) of [_currentplatform v])\n    set [_max v] to (_min)\n    repeat (3)\n        change [_i1 v] by (3)\n        set [_i2 v] to (item (_i1) of [_currentplatform v])\n        if <not <(_i2) = [_]>> then\n            if <(_i2) < (_min)> then\n                set [_min v] to (_i2)\n            else\n                if <(_i2) > (_max)> then\n                    set [_max v] to (_i2)\n                end\n            end\n        end\n    end\n    set [_ymin v] to (_min)\n    set [_ymax v] to (_max)\n    set [_i1 v] to [4]\n    set [_min v] to (item (_i1) of [_currentplatform v])\n    set [_max v] to (_min)\n    repeat (3)\n        change [_i1 v] by (3)\n        set [_i2 v] to (item (_i1) of [_currentplatform v])\n        if <not <(_i2) = [_]>> then\n            if <(_i2) < (_min)> then\n                set [_min v] to (_i2)\n            else\n                if <(_i2) > (_max)> then\n                    set [_max v] to (_i2)\n                end\n            end\n        end\n    end\n    set [_zmin v] to (_min)\n    set [_zmax v] to (_max)\n    Extract Substring (data) [;]\n    if <(_i0) > (_len)> then\n        Load Error []\n        stop [this script v]\n    end\n    change [_i0 v] by (1)\n    if <(_s0) = [true]> then\n        repeat (4)\n            Extract Substring (data) [;]\n            if <(_i0) > (_len)> then\n                Load Error []\n                stop [this script v]\n            end\n            change [_i0 v] by (1)\n            if <(_s0) = ((1) * (_s0))> then\n                add ((1) * (_s0)) to [_currentplatform v]\n            else\n                add (_s0) to [_currentplatform v]\n            end\n        end\n        add ((30) * (([sqrt v] of (((item (15) of [_currentplatform v]) * (item (15) of [_currentplatform v])) + (((item (16) of [_currentplatform v]) * (item (16) of [_currentplatform v])) + ((item (17) of [_currentplatform v]) * (item (17) of [_currentplatform v])))) ) / (item (14) of [_currentplatform v]))) to [3dquadmovement v]\n        add (item (15) of [_currentplatform v]) to [3dquadmovement v]\n        add (item (16) of [_currentplatform v]) to [3dquadmovement v]\n        add (item (17) of [_currentplatform v]) to [3dquadmovement v]\n        if <(item (15) of [_currentplatform v]) < [0]> then\n            add ((_xmin) + (item (15) of [_currentplatform v])) to [3dquadboundx v]\n            add (_xmax) to [3dquadboundx v]\n        else\n            add (_xmin) to [3dquadboundx v]\n            add ((_xmax) + (item (15) of [_currentplatform v])) to [3dquadboundx v]\n        end\n        if <(item (16) of [_currentplatform v]) < [0]> then\n            add ((_ymin) + (item (16) of [_currentplatform v])) to [3dquadboundy v]\n            add (_ymax) to [3dquadboundy v]\n        else\n            add (_ymin) to [3dquadboundy v]\n            add ((_ymax) + (item (16) of [_currentplatform v])) to [3dquadboundy v]\n        end\n        if <(item (17) of [_currentplatform v]) < [0]> then\n            add ((_zmin) + (item (17) of [_currentplatform v])) to [3dquadboundz v]\n            add (_zmax) to [3dquadboundz v]\n        else\n            add (_zmin) to [3dquadboundz v]\n            add ((_zmax) + (item (17) of [_currentplatform v])) to [3dquadboundz v]\n        end\n    else\n        add (_xmin) to [3dquadboundx v]\n        add (_xmax) to [3dquadboundx v]\n        add (_ymin) to [3dquadboundy v]\n        add (_ymax) to [3dquadboundy v]\n        add (_zmin) to [3dquadboundz v]\n        add (_zmax) to [3dquadboundz v]\n        add [_] to [3dquadmovement v]\n        add [_] to [3dquadmovement v]\n        add [_] to [3dquadmovement v]\n        add [_] to [3dquadmovement v]\n    end\n    add (_xmin) to [3dquadboundx v]\n    add (_xmax) to [3dquadboundx v]\n    add (_ymin) to [3dquadboundy v]\n    add (_ymax) to [3dquadboundy v]\n    add (_zmin) to [3dquadboundz v]\n    add (_zmax) to [3dquadboundz v]\nend\nadd [] to [textareas v]\nadd [] to [textareas v]\nadd [] to [textareas v]\nExtract Substring (data) [;]\nif <(_i0) > (_len)> then\n    Load Error []\n    stop [this script v]\nend\nchange [_i0 v] by (1)\nrepeat (round (_s0))\n    repeat (6)\n        Extract Substring (data) [;]\n        if <(_i0) > (_len)> then\n            Load Error []\n            stop [this script v]\n        end\n        change [_i0 v] by (1)\n        if <(_s0) = ((1) * (_s0))> then\n            add ((1) * (_s0)) to [textareas v]\n        else\n            add (_s0) to [textareas v]\n        end\n    end\n    Extract Substring (data) [;]\n    if <(_i0) > (_len)> then\n        Load Error []\n        stop [this script v]\n    end\n    Unescape (_s0)\n    add (_s1) to [textareas v]\n    change [_i0 v] by (1)\nend\nCalculate Quad Slopes\nFind Death Barriers\nSort Quads By Area\n\ndefine Extract Substring (str) (sep)\nset [_s0 v] to []\nrepeat until <<(letter (_i0) of (str)) = (sep)> or <(_i0) > (_len)>>\n    set [_s0 v] to (join (_s0) (letter (_i0) of (str)))\n    change [_i0 v] by (1)\nend\n\ndefine Find Char (str) (ch)\nrepeat until <<(letter (_i0) of (str)) = (ch)> or <(_i0) > (_len)>>\n    change [_i0 v] by (1)\nend\n\ndefine Load Error (message)\nif <(message) = []> then\n    set [error v] to [Level Loading Error: Invalid Level Data]\nelse\n    set [error v] to (join [Level Loading Error: ] (message))\nend\n\ndefine _getPlaneOfTri (x0) (y0) (z0) (x1) (y1) (z1) (x2) (y2) (z2)\nset [_planetype v] to [perp]\nset [_planeyslope v] to ((1) / (0))\nset [_planexslope v] to ((1) / (0))\nset [_planeorigin v] to [0]\nif <<([abs v] of ((x0) - (x1)) ) < [1e-7]> and <([abs v] of ((x1) - (x2)) ) < [1e-7]>> then\n    stop [this script v]\nend\nif <<([abs v] of ((y0) - (y1)) ) < [1e-7]> and <([abs v] of ((y1) - (y2)) ) < [1e-7]>> then\n    stop [this script v]\nend\nif <([abs v] of ((((x2) - (x0)) / ((x1) - (x0))) - (((y2) - (y0)) / ((y1) - (y0)))) ) < [1e-7]> then\n    stop [this script v]\nend\nset [_planetype v] to [regular]\nset [_sys0 v] to ((round ((134217728) * ((x1) - (x0)))) / (134217728))\nset [_sys1 v] to ((round ((134217728) * ((y1) - (y0)))) / (134217728))\nset [_sys2 v] to ((round ((134217728) * ((z1) - (z0)))) / (134217728))\nset [_sys3 v] to ((round ((134217728) * ((x2) - (x0)))) / (134217728))\nset [_sys4 v] to ((round ((134217728) * ((y2) - (y0)))) / (134217728))\nset [_sys5 v] to ((round ((134217728) * ((z2) - (z0)))) / (134217728))\nif <<(_sys0) = [0]> or <(_sys3) = [0]>> then\n    if <(_sys0) = [0]> then\n        set [_planeyslope v] to ((_sys2) / (_sys1))\n        set [_planexslope v] to (((_sys5) - ((_planeYSlope) * (_sys4))) / (_sys3))\n    else\n        set [_planeyslope v] to ((_sys5) / (_sys4))\n        set [_planexslope v] to (((_sys2) - ((_planeYSlope) * (_sys1))) / (_sys0))\n    end\nelse\n    set [_planeorigin v] to ((-1) * ((_sys0) / (_sys3)))\n    set [_sys3 v] to ((_planeOrigin) * (_sys3))\n    set [_sys4 v] to ((_planeOrigin) * (_sys4))\n    set [_sys5 v] to ((_planeOrigin) * (_sys5))\n    set [_planeyslope v] to (((_sys2) + (_sys5)) / ((_sys1) + (_sys4)))\n    set [_planexslope v] to (((_sys2) - ((_planeYSlope) * (_sys1))) / (_sys0))\nend\nset [_planeorigin v] to ((z0) - (((_planeXSlope) * (x0)) + ((_planeYSlope) * (y0))))\n\ndefine Unescape (string)\nset [_s1 v] to []\nset [_i4 v] to [1]\nset [_i6 v] to (length of (string))\nrepeat until <(_i4) > (_i6)>\n    if <(letter (_i4) of (string)) = [_]> then\n        set [_i5 v] to (item # of (join [_:] (letter ((_i4) + (1)) of (string))) in [char_escapes v])\n        if <(_i5) = [0]> then\n            set [_s1 v] to (join (_s1) (letter ((_i4) + (1)) of (string)))\n        else\n            set [_s1 v] to (join (_s1) (item ((_i5) - (1)) of [char_escapes v]))\n        end\n        change [_i4 v] by (2)\n    else\n        set [_s1 v] to (join (_s1) (letter (_i4) of (string)))\n        change [_i4 v] by (1)\n    end\nend\n\ndefine _sortQuads (lo) (hi)\nif <(hi) > (lo)> then\n    _sortQuads (lo) ((round (((lo) + (hi)) / (2))) - (1))\n    _sortQuads (round (((lo) + (hi)) / (2))) (hi)\n    delete all of [_sorttmp v]\n    set [_sort1 v] to ((round (((lo) + (hi)) / (2))) - (1))\n    set [_sort3 v] to (hi)\n    set [_sort0 v] to (lo)\n    set [_sort2 v] to (round (((lo) + (hi)) / (2)))\n    repeat until <<(_sort0) > (_sort1)> or <(_sort2) > (_sort3)>>\n        if <(item (_sort2) of [_sortarea v]) > (item (_sort0) of [_sortarea v])> then\n            add (item (_sort2) of [_sortid v]) to [_sorttmp v]\n            add (item (_sort2) of [_sortarea v]) to [_sorttmp v]\n            change [_sort2 v] by (1)\n        else\n            add (item (_sort0) of [_sortid v]) to [_sorttmp v]\n            add (item (_sort0) of [_sortarea v]) to [_sorttmp v]\n            change [_sort0 v] by (1)\n        end\n    end\n    if <not <(_sort0) > (_sort1)>> then\n        repeat (((_sort1) - (_sort0)) + (1))\n            add (item (_sort0) of [_sortid v]) to [_sorttmp v]\n            add (item (_sort0) of [_sortarea v]) to [_sorttmp v]\n            change [_sort0 v] by (1)\n        end\n    end\n    set [_sort0 v] to [1]\n    set [_sort1 v] to (lo)\n    repeat ((length of [_sorttmp v]) / (2))\n        replace item (_sort1) of [_sortid v] with (item (_sort0) of [_sorttmp v])\n        replace item (_sort1) of [_sortarea v] with (item ((_sort0) + (1)) of [_sorttmp v])\n        change [_sort0 v] by (2)\n        change [_sort1 v] by (1)\n    end\nend\n\ndefine Sort Quads By Area\ndelete all of [_sortid v]\ndelete all of [_sortarea v]\n_sortAddQuad [1] (length of [3dquadtype v])\n_sortQuads [1] (length of [_sortid v])\ndelete all of [3dquadorder v]\nset [_sort0 v] to [1]\nrepeat (length of [_sortid v])\n    add (item (_sort0) of [_sortid v]) to [3dquadorder v]\n    change [_sort0 v] by (1)\nend\n\ndefine _sortAddQuad (lo) (hi)\nset [_sort0 v] to (round (((lo) + (hi)) / (2)))\nadd (_sort0) to [_sortid v]\nset [_id0 v] to ((4) * (_sort0))\nset [_sort1 v] to ([sqrt v] of ((((item ((_id0) - (2)) of [3dquadx v]) - (item ((_id0) - (3)) of [3dquadx v])) * ((item ((_id0) - (2)) of [3dquadx v]) - (item ((_id0) - (3)) of [3dquadx v]))) + ((((item ((_id0) - (2)) of [3dquady v]) - (item ((_id0) - (3)) of [3dquady v])) * ((item ((_id0) - (2)) of [3dquady v]) - (item ((_id0) - (3)) of [3dquady v]))) + (((item ((_id0) - (2)) of [3dquadz v]) - (item ((_id0) - (3)) of [3dquadz v])) * ((item ((_id0) - (2)) of [3dquadz v]) - (item ((_id0) - (3)) of [3dquadz v]))))) )\nset [_sort2 v] to ([sqrt v] of ((((item ((_id0) - (1)) of [3dquadx v]) - (item ((_id0) - (2)) of [3dquadx v])) * ((item ((_id0) - (1)) of [3dquadx v]) - (item ((_id0) - (2)) of [3dquadx v]))) + ((((item ((_id0) - (1)) of [3dquady v]) - (item ((_id0) - (2)) of [3dquady v])) * ((item ((_id0) - (1)) of [3dquady v]) - (item ((_id0) - (2)) of [3dquady v]))) + (((item ((_id0) - (1)) of [3dquadz v]) - (item ((_id0) - (2)) of [3dquadz v])) * ((item ((_id0) - (1)) of [3dquadz v]) - (item ((_id0) - (2)) of [3dquadz v]))))) )\nset [_sort3 v] to ([sqrt v] of ((((item ((_id0) - (3)) of [3dquadx v]) - (item ((_id0) - (1)) of [3dquadx v])) * ((item ((_id0) - (3)) of [3dquadx v]) - (item ((_id0) - (1)) of [3dquadx v]))) + ((((item ((_id0) - (3)) of [3dquady v]) - (item ((_id0) - (1)) of [3dquady v])) * ((item ((_id0) - (3)) of [3dquady v]) - (item ((_id0) - (1)) of [3dquady v]))) + (((item ((_id0) - (3)) of [3dquadz v]) - (item ((_id0) - (1)) of [3dquadz v])) * ((item ((_id0) - (3)) of [3dquadz v]) - (item ((_id0) - (1)) of [3dquadz v]))))) )\nset [_sort4 v] to (((_sort1) + ((_sort2) + (_sort3))) / (2))\nset [_sort4 v] to (round (((1e6) * ([sqrt v] of (((_sort4) * ((_sort4) - (_sort1))) * (((_sort4) - (_sort2)) * ((_sort4) - (_sort3)))) )) / (1e6)))\nif <not <(item (_id0) of [3dquadx v]) = [_]>> then\n    set [_sort4 v] to ((2) * (_sort4))\nend\nadd (_sort4) to [_sortarea v]\nif <(lo) < (round (((lo) + (hi)) / (2)))> then\n    _sortAddQuad (lo) ((round (((lo) + (hi)) / (2))) - (1))\nend\nif <(hi) > (round (((lo) + (hi)) / (2)))> then\n    _sortAddQuad ((round (((lo) + (hi)) / (2))) + (1)) (hi)\nend\n\nwhen I receive [loadlevel v]\nLoad Level Data (LevelData)\nif <(Error) = [none]> then\n    Update Graphics to Quality (3DQuality)\n    if <(EditorMode) = [true]> then\n        broadcast (initEditor v) and wait\n        broadcast (editorLoop v)\n    else\n        broadcast (gameLoop v)\n    end\nelse\n    set [editormode v] to [false]\n    broadcast (errorScreen v)\nend\n\nwhen I receive [mainmenu3d v]\nLoad Level Data [v1.0:day;0;0;0;0;7;bounce;20;-180;120;120;-180;100;20;-160;120;false;true;false;bounce;20;-160;120;120;-160;100;40;-160;220;false;true;false;bounce;20;-180;120;40;-180;220;20;-160;120;false;true;false;regular;90;-60;200;200;-60;220;90;-20;200;false;true;false;regular;100;-60;320;90;-60;200;100;-20;320;false;true;false;regular;90;-20;200;200;-20;220;100;-20;320;false;true;false;goal;120;80;300;180;80;240;120;-20;300;false;true;false;0;]\nbroadcast (simple3D v) and wait\n\nwhen I receive [update3dquality v]\nUpdate Graphics to Quality (3DQuality)\n\nwhen I receive [updatelevelaftereditor v]\nCalculate Quad Slopes\nFind Death Barriers\nSort Quads By Area\n\ndefine Find Death Barriers\nset [deathbarrierbottom v] to (item (2) of [locationspawn v])\nset [deathbarriertop v] to (DeathBarrierBottom)\nset [_i0 v] to [1]\nrepeat (length of [3dquadtype v])\n    if <(item (_i0) of [3dquadboundy v]) < (DeathBarrierBottom)> then\n        set [deathbarrierbottom v] to (item (_i0) of [3dquadboundy v])\n    end\n    if <(item ((_i0) + (1)) of [3dquadboundy v]) > (DeathBarrierTop)> then\n        set [deathbarriertop v] to (item ((_i0) + (1)) of [3dquadboundy v])\n    end\n    change [_i0 v] by (4)\nend\nchange [deathbarrierbottom v] by (-250)\nchange [deathbarriertop v] by (250)\n\ndefine Calculate Quad Slopes\ndelete all of [3dquadslope v]\nset [_i0 v] to [1]\nrepeat (length of [3dquadtype v])\n    if <(item ((_i0) + (3)) of [3dquadx v]) = [_]> then\n        _getPlaneOfTri (item (_i0) of [3dquadx v]) (item (_i0) of [3dquadz v]) (item (_i0) of [3dquady v]) (item ((_i0) + (1)) of [3dquadx v]) (item ((_i0) + (1)) of [3dquadz v]) (item ((_i0) + (1)) of [3dquady v]) (item ((_i0) + (2)) of [3dquadx v]) (item ((_i0) + (2)) of [3dquadz v]) (item ((_i0) + (2)) of [3dquady v])\n    else\n        _getPlaneOfTri (item (_i0) of [3dquadx v]) (item (_i0) of [3dquadz v]) (item (_i0) of [3dquady v]) (item ((_i0) + (1)) of [3dquadx v]) (item ((_i0) + (1)) of [3dquadz v]) (item ((_i0) + (1)) of [3dquady v]) (item ((_i0) + (3)) of [3dquadx v]) (item ((_i0) + (3)) of [3dquadz v]) (item ((_i0) + (3)) of [3dquady v])\n    end\n    add (_planeXSlope) to [3dquadslope v]\n    add [_] to [3dquadslope v]\n    add (_planeYSlope) to [3dquadslope v]\n    if <<(_planeXSlope) = ((1) / (0))> or <(_planeYSlope) = ((1) / (0))>> then\n        add ((1) / (0)) to [3dquadslope v]\n    else\n        if <(_planeXSlope) = [0]> then\n            add ([abs v] of (_planeYSlope) ) to [3dquadslope v]\n        else\n            if <(_planeYSlope) = [0]> then\n                add ([abs v] of (_planeXSlope) ) to [3dquadslope v]\n            else\n                set [_i1 v] to ((_planeYSlope) / (_planeXSlope))\n                add ((([abs v] of (_planeXSlope) ) + ([abs v] of ((_i1) * (_planeYSlope)) )) / ([sqrt v] of ((1) + ((_i1) * (_i1))) )) to [3dquadslope v]\n            end\n        end\n    end\n    change [_i0 v] by (4)\nend\n\n@Cloud\n\nwhen I receive [submittime v]\nif <not <(cloudAction) = [none]>> then\n    wait (2) seconds\n    stop [other scripts in sprite v]\nend\nset [cloudaction v] to [submit]\nSubmit Time (SubmitLevel) (levelTime) (username)\nset [cloudaction v] to [none]\n\ndefine Reset Cloud Data\nif <(username) = [-Rex-Test-]> then\n    set [_i0 v] to (join [0000000000000000000000000000000000000000] (join [99999999999] [0000000000000]))\n    set [_i1 v] to (join (join (_i0) (_i0)) (join (_i0) (_i0)))\n    set [☁ cloudlock v] to [1]\n    wait (0.11) seconds\n    set [☁ cloud0 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloud1 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloud2 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloud3 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloud4 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloud5 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloud6 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloud7 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloud8 v] to (_i1)\n    wait (0.11) seconds\n    set [☁ cloudlock v] to [0]\nend\n\ndefine Load Data (data)\nif <not <(length of (data)) = [256]>> then\n    set [error v] to [Cloud Error: Cannot Parse Cloud Data]\n    stop [this script v]\nend\nset [_i0 v] to [1]\nrepeat (4)\n    set [_s0 v] to []\n    repeat (20)\n        switch costume to ((join (letter (_i0) of (data)) (letter ((_i0) + (1)) of (data))) + (1))\n        if <(costume [number v]) > [1]> then\n            set [_s0 v] to (join (_s0) (letter (1) of (costume [name v])))\n        end\n        change [_i0 v] by (2)\n    end\n    add (_s0) to [cloud | names v]\n    set [_s0 v] to []\n    repeat (11)\n        set [_s0 v] to (join (_s0) (letter (_i0) of (data)))\n        change [_i0 v] by (1)\n    end\n    Parse to Float (_s0)\n    add (_out0) to [cloud | scores v]\n    set [_s0 v] to []\n    repeat (13)\n        set [_s0 v] to (join (_s0) (letter (_i0) of (data)))\n        change [_i0 v] by (1)\n    end\n    add ((1) * (_s0)) to [cloud | wins v]\nend\n\ndefine Serialize Float (num)\nif <<(num) = [0]> or <(num) = ((0) / (0))>> then\n    set [_out0 v] to [00000000000]\n    stop [this script v]\nend\nif <(num) = ((1) / (0))> then\n    set [_out0 v] to [99999999999]\n    stop [this script v]\nend\nif <(num) = ((-1) / (0))> then\n    set [_out0 v] to [99999999499]\n    stop [this script v]\nend\nset [_i1 v] to ([floor v] of ([log v] of ([abs v] of (num) ) ) )\nif <([abs v] of (num) ) < (join [1e] ((_i1) + (1)))> then\n    if <([abs v] of (num) ) < (join [1e] (_i1))> then\n        change [_i1 v] by (-1)\n    end\nelse\n    change [_i1 v] by (1)\nend\nif <(_i1) < [-250]> then\n    set [_out0 v] to [00000000000]\n    stop [this script v]\nend\nif <(_i1) > [249]> then\n    if <(num) > [0]> then\n        set [_out0 v] to [99999999999]\n    else\n        set [_out0 v] to [99999999499]\n    end\n    stop [this script v]\nend\nset [_i2 v] to (round ((1e7) * (([abs v] of (num) ) / (join [1e] (_i1)))))\nif <(length of (_i2)) > [8]> then\n    set [_i2 v] to [99999999]\nend\nrepeat ((8) - (length of (_i2)))\n    set [_i2 v] to (join (_i2) [0])\nend\nchange [_i1 v] by (250)\nif <(num) > [0]> then\n    change [_i1 v] by (500)\nend\nif <(length of (_i1)) > [3]> then\n    set [_i1 v] to [999]\nend\nrepeat ((3) - (length of (_i1)))\n    set [_i1 v] to (join [0] (_i1))\nend\nset [_out0 v] to (join (_i2) (_i1))\n\ndefine Parse to Float (str)\nif <(str) = [00000000000]> then\n    set [_out0 v] to ((1) * (0))\n    stop [this script v]\nend\nif <(str) = [99999999999]> then\n    set [_out0 v] to ((1) / (0))\n    stop [this script v]\nend\nif <(str) = [99999999499]> then\n    set [_out0 v] to ((-1) / (0))\n    stop [this script v]\nend\nset [_i1 v] to ((1) * (join (letter (9) of (str)) (join (letter (10) of (str)) (letter (11) of (str)))))\nset [_i2 v] to ((join (join (join (letter (1) of (str)) (letter (2) of (str))) (join (letter (3) of (str)) (letter (4) of (str)))) (join (join (letter (5) of (str)) (letter (6) of (str))) (join (letter (7) of (str)) (letter (8) of (str))))) / (1e7))\nif <(_i1) < [500]> then\n    set [_i2 v] to ((-1) * (_i2))\nelse\n    change [_i1 v] by (-500)\nend\nchange [_i1 v] by (-250)\nset [_out0 v] to ((_i2) * (join [1e] (_i1)))\n\nwhen I receive [loadclouddata v]\ndelete all of [cloud | names v]\ndelete all of [cloud | scores v]\ndelete all of [cloud | wins v]\nLoad Data (☁ Cloud0)\nLoad Data (☁ Cloud1)\nLoad Data (☁ Cloud2)\nLoad Data (☁ Cloud3)\nLoad Data (☁ Cloud4)\nLoad Data (☁ Cloud5)\nLoad Data (☁ Cloud6)\nLoad Data (☁ Cloud7)\nLoad Data (☁ Cloud8)\n\nwhen flag clicked\nhide\nset [cloudaction v] to [none]\nstop [other scripts in sprite v]\nif <<(username) = [-Rex-]> and <(☁ CloudLock) = [-1]>> then\n    set [☁ cloudlock v] to [0]\nend\n\ndefine Serialize List (lo) (hi)\nset [_out1 v] to []\nset [_i0 v] to (lo)\nrepeat (((hi) - (lo)) + (1))\n    Serialize Username (item (_i0) of [cloud | names v])\n    set [_out1 v] to (join (_out1) (_user))\n    Serialize Float (item (_i0) of [cloud | scores v])\n    set [_out1 v] to (join (_out1) (_out0))\n    Serialize Num (item (_i0) of [cloud | wins v])\n    set [_out1 v] to (join (_out1) (_out0))\n    change [_i0 v] by (1)\nend\n\ndefine Serialize Num (num)\nset [_out0 v] to (round (num))\nif <(_out0) < [0]> then\n    set [_out0 v] to [0]\nend\nif <(length of (_out0)) > [13]> then\n    set [_out0 v] to [9999999999999]\nend\nrepeat ((13) - (length of (_out0)))\n    set [_out0 v] to (join [0] (_out0))\nend\nset [_out0 v] to (join [] (_out0))\n\ndefine Submit Time (level) (time) (name)\nset [error v] to [none]\nif <<(level) < [1]> or <(level) > (length of [mainlevels v])>> then\n    set [error v] to [Cloud Error: Level Does Not Exist]\n    stop [this script v]\nend\nif <(time) < [0]> then\n    set [error v] to [Cloud Error: Invalid Completion Time]\n    stop [this script v]\nend\nif <<(name) = []> or <(☁ CloudLock) = [-1]>> then\n    set [error v] to [Cloud Error: Unable To Access Cloud Data]\n    stop [this script v]\nend\nrepeat (10)\n    Serialize Username (name)\n    set [_previous v] to (☁ CloudLock)\n    repeat until <(_previous) = [0]>\n        wait (1.5) seconds\n        if <(☁ CloudLock) = (_previous)> then\n            set [_previous v] to [0]\n        else\n            set [_previous v] to (☁ CloudLock)\n        end\n    end\n    set [☁ cloudlock v] to (_user)\n    if <(level) < [5]> then\n        Load Data (☁ Cloud0)\n    else\n        if <(level) < [9]> then\n            Load Data (☁ Cloud1)\n        else\n            if <(level) < [13]> then\n                Load Data (☁ Cloud2)\n            else\n                if <(level) < [17]> then\n                    Load Data (☁ Cloud3)\n                else\n                    if <(level) < [21]> then\n                        Load Data (☁ Cloud4)\n                    else\n                        if <(level) < [25]> then\n                            Load Data (☁ Cloud5)\n                        else\n                            if <(level) < [29]> then\n                                Load Data (☁ Cloud6)\n                            else\n                                if <(level) < [33]> then\n                                    Load Data (☁ Cloud7)\n                                else\n                                    if <(level) < [37]> then\n                                        Load Data (☁ Cloud8)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <not <(Error) = [none]>> then\n        stop [this script v]\n    end\n    set [_i0 v] to ((((level) - (1)) mod (4)) + (1))\n    if <(time) < (item (_i0) of [cloud | scores v])> then\n        replace item (_i0) of [cloud | scores v] with (time)\n        replace item (_i0) of [cloud | names v] with (name)\n    end\n    replace item (_i0) of [cloud | wins v] with ((item (_i0) of [cloud | wins v]) + (1))\n    Serialize List [1] [4]\n    if <not <(length of (_out1)) = [256]>> then\n        set [error v] to [Cloud Error: Data To Upload Is Corrupt]\n        stop [this script v]\n    end\n    wait (1) seconds\n    Serialize Username (name)\n    if <(☁ CloudLock) = (_user)> then\n        if <(level) < [5]> then\n            set [☁ cloud0 v] to (_out1)\n        else\n            if <(level) < [9]> then\n                set [☁ cloud1 v] to (_out1)\n            else\n                if <(level) < [13]> then\n                    set [☁ cloud2 v] to (_out1)\n                else\n                    if <(level) < [17]> then\n                        set [☁ cloud3 v] to (_out1)\n                    else\n                        if <(level) < [21]> then\n                            set [☁ cloud4 v] to (_out1)\n                        else\n                            if <(level) < [25]> then\n                                set [☁ cloud5 v] to (_out1)\n                            else\n                                if <(level) < [29]> then\n                                    set [☁ cloud6 v] to (_out1)\n                                else\n                                    if <(level) < [33]> then\n                                        set [☁ cloud7 v] to (_out1)\n                                    else\n                                        if <(level) < [37]> then\n                                            set [☁ cloud8 v] to (_out1)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        set [☁ cloudlock v] to [0]\n        stop [this script v]\n    end\nend\nset [error v] to [Cloud Error: Unable To Acquire Lock]\n\nwhen I receive [getlevelstats v]\nif <not <(cloudAction) = [none]>> then\n    wait (2) seconds\n    stop [other scripts in sprite v]\nend\nset [cloudaction v] to [getStats]\ndelete all of [levelstats v]\nGet Level Stats (CurrentLevel)\nif <(length of [levelstats v]) = [0]> then\n    add [error] to [levelstats v]\nend\nset [cloudaction v] to [none]\n\ndefine Get Level Stats (level)\nset [error v] to [none]\nif <<(level) < [1]> or <(level) > (length of [mainlevels v])>> then\n    set [error v] to [Cloud Error: Level Does Not Exist]\n    stop [this script v]\nend\nif <<(username) = []> or <(☁ CloudLock) = [-1]>> then\n    set [error v] to [Cloud Error: Unable To Access Cloud Data]\n    stop [this script v]\nend\ndelete all of [cloud | names v]\ndelete all of [cloud | scores v]\ndelete all of [cloud | wins v]\nif <(level) < [5]> then\n    Load Data (☁ Cloud0)\nelse\n    if <(level) < [9]> then\n        Load Data (☁ Cloud1)\n    else\n        if <(level) < [13]> then\n            Load Data (☁ Cloud2)\n        else\n            if <(level) < [17]> then\n                Load Data (☁ Cloud3)\n            else\n                if <(level) < [21]> then\n                    Load Data (☁ Cloud4)\n                else\n                    if <(level) < [25]> then\n                        Load Data (☁ Cloud5)\n                    else\n                        if <(level) < [29]> then\n                            Load Data (☁ Cloud6)\n                        else\n                            if <(level) < [33]> then\n                                Load Data (☁ Cloud7)\n                            else\n                                if <(level) < [37]> then\n                                    Load Data (☁ Cloud8)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nif <not <(Error) = [none]>> then\n    stop [this script v]\nend\nset [_i0 v] to ((((level) - (1)) mod (4)) + (1))\nadd (item (_i0) of [cloud | scores v]) to [levelstats v]\nadd (item (_i0) of [cloud | names v]) to [levelstats v]\nadd (item (_i0) of [cloud | wins v]) to [levelstats v]\n\ndefine Serialize Username (username)\nset [_user v] to []\nset [_i1 v] to [1]\nrepeat (20)\n    switch costume to (blank v)\n    switch costume to (join (letter (_i1) of (username)) [_])\n    set [_i2 v] to ((costume [number v]) - (1))\n    if <(length of (_i2)) > [2]> then\n        set [_i2 v] to [00]\n    end\n    repeat ((2) - (length of (_i2)))\n        set [_i2 v] to (join [0] (_i2))\n    end\n    set [_user v] to (join (_user) (_i2))\n    change [_i1 v] by (1)\nend\n\nwhen I receive [loadcloudall v]\nif <not <(cloudAction) = [none]>> then\n    wait (2) seconds\n    stop [other scripts in sprite v]\nend\nset [cloudaction v] to [loadAll]\nset [error v] to [none]\nif <<(username) = []> or <(☁ CloudLock) = [-1]>> then\n    set [error v] to [Cloud Error: Unable To Access Cloud Data]\n    set [cloudaction v] to [none]\n    stop [this script v]\nend\ndelete all of [cloud | names v]\ndelete all of [cloud | scores v]\ndelete all of [cloud | wins v]\nLoad Data (☁ Cloud0)\nLoad Data (☁ Cloud1)\nLoad Data (☁ Cloud2)\nLoad Data (☁ Cloud3)\nLoad Data (☁ Cloud4)\nLoad Data (☁ Cloud5)\nLoad Data (☁ Cloud6)\nLoad Data (☁ Cloud7)\nLoad Data (☁ Cloud8)\nset [cloudaction v] to [none]\n\nReset Cloud Data\n\n