Esempio n. 1
0
def test_sound():
    sound.say("Hello, I am car robot. Hope you enjoy the camp!")
    time.sleep(5)
    sound.say("Let me play music for 10 seconds")
    sound.play_mp3("./music/rainbow.mp3", loops=-1)
    time.sleep(10)
    sound.stop()
    def Process(self, btn, idx, split_line):
        delay = btn.symbols[SYM_PARAMS][1]  # @@@ update this

        if delay == None or delay <= 0:
            sound.stop()
        else:
            sound.fadeout(int(delay))
Esempio n. 3
0
def police_thread(sound_on=True):
    global done
    done = False
    if sound_on:
        sound.play_mp3('{}/music/police.mp3'.format(path), loops=-1)
    while not done:
        flashing()
    sound.stop()
Esempio n. 4
0
 def __play_cb(self, widget, playButtonImg, pauseButtonImg):
     if widget.get_active():
         widget.set_icon_widget(pauseButtonImg)
         sound.play()
         self.montage.play()
     else:
         widget.set_icon_widget(playButtonImg)
         sound.stop()
         self.montage.stop()
Esempio n. 5
0
def on_message(ws, message):
    obj = json.loads(message)
    if obj.has_key('callsign'):
        global my_callsign
        my_callsign = obj['callsign']
    if obj.has_key('signal'):
        signal = obj['signal']
        if signal: sound.play()
        else: sound.stop()
Esempio n. 6
0
def test():
    setup()
    play = True
    print('Press Ctrl-C to quit.')
    try:
        while play:
            # Color wipe animations.
            if play:
                print('colorWipe(strip, Color(255, 0, 0))')
                colorWipe(strip, Color(255, 0, 0))  # Red wipe
            if play:
                print('colorWipe(strip, Color(0, 255, 0))')
                colorWipe(strip, Color(0, 255, 0))  # Blue wipe
            if play:
                print('colorWipe(strip, Color(0, 0, 255))')
                colorWipe(strip, Color(0, 0, 255))  # Green wipe
            # Theater chase animations.
            if play:
                print('theaterChase(strip, Color(127, 127, 127))')
                theaterChase(strip, Color(127, 127,
                                          127))  # White theater chase
            if play:
                print('theaterChase(strip, Color(127,   0,   0))')
                theaterChase(strip, Color(127, 0, 0))  # Red theater chase
            if play:
                print('theaterChase(strip, Color(  0,   0, 127))')
                theaterChase(strip, Color(0, 0, 127))  # Blue theater chase
            # Rainbow animations.
            if play:
                print('rainbow(strip)')
                rainbow(strip)
            if play:
                print('rainbowCycle(strip)')
                rainbowCycle(strip)

            if play:
                print('theaterChaseRainbow(strip')
                theaterChaseRainbow(strip)
            if play:
                print('flashing_on("left")')
                flashing_on("left")
            if play:
                time.sleep(5)
            if play:
                print('flashing_on("right")')
                flashing_on("right")
            if play:
                time.sleep(2)

    except KeyboardInterrupt:
        play = False
        flashing_off()
        colorWipe(strip, Color(0, 0, 0))
        sound.stop()
Esempio n. 7
0
def rainbowCycle(strip, wait_ms=20, iterations=5, sound_on=True):
    """Draw rainbow that uniformly distributes itself across all pixels."""
    if sound_on:
        sound.play_mp3('{}/music/rainbow.mp3'.format(path), loops=-1)
    for j in range(256 * iterations):
        for i in range(strip.numPixels()):
            strip.setPixelColor(
                PIXELS[i], wheel((int(i * 256 / strip.numPixels()) + j) & 255))
        strip.show()
        time.sleep(wait_ms / 1000.0)
    if sound_on:
        sound.stop()
    side_off()
Esempio n. 8
0
def police_on(times=-1, sound_on=True):
    # Turn on the police flashing mode in times (2 x times [s])
    # If times = -1, flashing until police_off() is called.
    if times == 0:
        both_off()
    elif times > 0:
        if sound_on:
            sound.play_mp3('{}/music/police.mp3'.format(path), loops=-1)
        for i in range(0, int(times)):
            flashing()
        sound.stop()
    else:
        police_threading = thread.Thread(target=police_thread, args=[sound_on])
        police_threading.setDaemon(True)
        police_threading.start()
Esempio n. 9
0
def levelUp(xpGain):
    xpGain = int(xpGain)
    changestats.get("level")

    level = int(changestats.get("level"))
    xp = int(changestats.get("experience"))
    print("XP gained:", xpGain)
    time.sleep(2)
    print('\n' * 40)
    sound.play("exp.wav")
    time.sleep(.25)
    for i in range(xpGain):

        xp += 1.000 / (1 + level * .1)
        xpGain -= 1

        randomEvents.progress(xp, xpGain)
        time.sleep(.004 - (level * .00005) + (i / 2000000))
        if xp >= 100:
            sound.stop()

            print('\n' * 30)
            print("------------------------------------------")
            print("\n Level up! Your level is now", level)
            print("------------------------------------------")
            randomEvents.progress(xp, xpGain)
            xp = 0
            level += 1
            playsound("ding.wav")

            sound.play("exp.wav")
            print('\n' * 40)
    sound.stop()
    time.sleep(2)
    xp = int(xp)
    changestats.modify("experience", str(xp))
    changestats.modify("level", str(level))
    travel(False)
Esempio n. 10
0
def events(ws):
    global partner, tmp_partner
    for ev in pygame.event.get():
        if ev.type == pygame.QUIT:
            terminate(ws)
        elif ev.type == pygame.KEYDOWN:
            if ev.key == 27: terminate(ws) #ESC
            elif partner == None:
                if ev.key == 13: #Enter
                    partner = tmp_partner
                    sound.play()
                    time.sleep(0.05)
                    sound.stop()
                elif ev.key in xrange(ord('a'), ord('z') + 1) or ev.key in xrange(ord('0'), ord('9') + 1):
                    if len(tmp_partner) < max_partner_length:
                        tmp_partner += chr(ev.key).upper()
                elif ev.key == 8: #Backspace
                    tmp_partner = tmp_partner[:-1]
            elif ev.key == key:
                send_signal(ws, partner, True)
        elif ev.type == pygame.KEYUP:
            if ev.key == key:
                 send_signal(ws, partner, False)
Esempio n. 11
0
def map():
    print('\n' * 12)

    bank = changestats.get("bank").strip('][').split(', ')
    inv = simplify()
    randomEvents.map()
    print(
        "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Where would you like to go? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n"
    )

    cont = 0
    while cont == 0:
        say = input('''
        Type 'city' to go downtown.                    Type 'd' to go to the digsite.
        Type 'north' to go to the North Pole.          Type 'home' to go back home.
        
        Type 'close' to close the map
  
        
        ''')

        if say == "home":
            sound.stop()
            cont = 1
            home(inv, bank)
        if say == "north":
            sound.stop()
            cont = 1
            northern(inv, bank)
        if say == "d":
            sound.stop()
            cont = 1
            digsite(inv, bank)
        if say == "city":
            sound.stop()
            cont = 1
            city(inv, bank)
        if say == "close":
            travel(True)
Esempio n. 12
0
def northern(inv, bank, music=False):

    #Play music if it is not already playing. This prevents a restart.
    if music == False:
        sound.play("trip.wav")

    print('\n' * 12)
    changestats.modify("location", 'northern')
    inv = simplify()
    randomEvents.north()
    print(
        "~~~~~~~~~~~~~~~~~~~~~~~~~~~ Welcome to the north pole!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n"
    )
    cont = 0
    while cont == 0:
        say = input('''
        Type f to look for a fight!             Type 'map' to open the map!
        Type home to go back home.
        Type 'sleep' to take a rest!
        Type 'inv' to open your bag!
        Type 'fish' to go fishing!
        Type 'trip' to go on a fishing trip!
        ''')
        if say == "f":
            cont = 1
            fighting()
        if say == "home":
            cont = 1
            home(inv, bank)
        if say == "sleep":
            print("zzZZzZZz...")
            time.sleep(3)
            print("You feel refreshed!")
            time.sleep(1)
            cont = 1
            northern(inv, bank, True)
        if say == "inv":
            print("Opening the bag!")
            time.sleep(1)
            cont = 1
            inventory(northern, inv, bank, True)
        if say == "map":
            cont = 1
            map()
        if say == "fish":
            #play music
            sound.stop()
            sound.play("fish.wav")
            print("Gone fishing!")
            xpReward = randomEvents.fishing(6, 14, 4, 1.5, inv)
            time.sleep(1)
            #stop music
            sound.stop()
            levelUp(xpReward)

            cont = 1
            time.sleep(1)
            northern(inv, bank)
        if say == "trip":
            choice = input(
                "How long? press '1' for minutes and '2' for much longer. \n")
            #play music
            sound.play("trip.wav")
            if choice == '1':
                print("\n We'll be back in no time!")
            else:
                print("\n Prepare for a long expedition...")
            xpReward = 0
            for i in range(5):
                if choice == '1':
                    xpReward += randomEvents.fishing(7, 15, 4, 2, inv)
                else:
                    xpReward += randomEvents.fishing(16, 23, 10, 6, inv,
                                                     'ocean2')
                if i < 3:
                    print(4 - i, "trips remaining.")
                elif i == 3:
                    print("1 trip remaining.")
                else:
                    print("Time to go home!")
            #stop music
            time.sleep(2)
            sound.stop()

            cont = 1

            levelUp(xpReward)
            northern(inv, bank)
Esempio n. 13
0
def home(inv, bank, music=False):
    print('\n' * 12)

    #Play music if it is not already playing. This prevents a restart.
    if music == False:
        sound.play(path + "home.wav")

    changestats.modify("location", 'home')
    bank = changestats.get("bank").strip('][').split(', ')
    inv = simplify()
    randomEvents.house()
    print(
        "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Welcome home! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n"
    )

    #print("Bank:",bank)
    print("Would you like to enter the town?")
    cont = 0
    while cont == 0:
        say = input('''
        Type 'todo' to see to-do list.                 Type 'b' to bank! 
        Type 'north' to go to the North Pole.          Type 'c' to play cards against a monster!
        Type 'sleep' to take a rest!                   Type 'm' to create a monster!
        Type 'inv' to open your bag!                   Type 'fish' to go fishing!
        Type 'map' to open the map!
        Type 'pack' to open a card pack.
        
        ''')

        if say == "f":
            sound.stop()
            cont = 1
            fighting()
        if say == "north":
            sound.stop()
            cont = 1
            northern(inv, bank)
        if say == "sleep":
            print("zzZZzZZz...")
            time.sleep(3)
            print("You feel refreshed!")
            time.sleep(1)
            cont = 1
            home(inv, bank, True)
        if say == "todo":
            randomEvents.todo()
            cont = 1
            home(inv, bank, True)
        if say == "inv":
            print("Opening the bag!")
            time.sleep(1)
            cont = 1
            inventory(home, inv, bank)
        if say == "pack":
            pack(inv, bank)
            cont = 1
            home(inv, bank, True)
        if say == "m":
            monsters.createMonster()
            cont = 1
            time.sleep(2)
            home(inv, bank, True)
        if say == "map":
            cont = 1
            map()
        if say == "c":

            monsters.viewMonster()
            print("Choose a difficulty from 0-9: ")
            x = input(
                "Or type 'tournament' for a challenge... 'xt' to lose all your cards!\n"
            )
            sound.stop()
            if x == "tournament":
                for i in range(3):
                    cards(inv, bank, 1, 1)
            elif x == "xt":
                for i in range(20):
                    cards(inv, bank, 6, .1)
            else:
                cards(inv, bank, int(x), 1.5)
            cont = 1
            time.sleep(2)
            home(inv, bank)
        #Bank your items.
        if say == "b":
            sound.stop()
            cont = 1
            bank += inv
            #inv=['Beer']

            # Save the stats in the .ini file.
            changestats.save(inv, "inv")
            changestats.save(bank, "bank")

            #refresh the inventory
            home(inv, bank, True)
        if say == "fish":
            #play music

            print("Gone fishing!")
            randomEvents.fishing(1, 7, 0, 1, inv)

            #stop music
            cont = 1
            time.sleep(1.5)
            home(inv, bank, True)
Esempio n. 14
0
        def main_logic(idx):
            nonlocal m_pos
            
            if check_kill(x, y, is_async):
                return idx + 1
                
            line = script_lines[idx]
            if line == "":
                return idx + 1
            if line[0] == "-":
                print("[scripts] " + coords + "    Comment: " + line[1:])
            else:
                split_line = line.split(" ")
                if split_line[0] == "STRING":
                    type_string = " ".join(split_line[1:])
                    print("[scripts] " + coords + "    Type out string " + type_string)
                    kb.write(type_string)
                elif split_line[0] == "DELAY":
                    print("[scripts] " + coords + "    Delay for " + split_line[1] + " seconds")
                    delay = float(split_line[1])
                    if not safe_sleep(delay, x, y, is_async):
                        return -1
                elif split_line[0] == "TAP":
                    key = kb.sp(split_line[1])
                    releasefunc = lambda: kb.release(key)
                    if len(split_line) <= 2:
                        print("[scripts] " + coords + "    Tap key " + split_line[1])
                        kb.tap(key)
                    elif len(split_line) <= 3:
                        print("[scripts] " + coords + "    Tap key " + split_line[1] + " " + split_line[2] + " times")
                        taps = int(split_line[2])
                        for tap in range(taps):
                            if check_kill(x, y, is_async, releasefunc):
                                return idx + 1
                            kb.tap(key)
                    else:
                        print("[scripts] " + coords + "    Tap key " + split_line[1] + " " + split_line[2] + " times for " + str(split_line[3]) + " seconds each")
                        taps = int(split_line[2])
                        delay = float(split_line[3])
                        for tap in range(taps):
                            if check_kill(x, y, is_async, releasefunc):
                                return -1
                            kb.press(key)
                            if not safe_sleep(delay, x, y, is_async, releasefunc):
                                return -1
                elif split_line[0] == "PRESS":
                    print("[scripts] " + coords + "    Press key " + split_line[1])
                    key = kb.sp(split_line[1])
                    kb.press(key)
                elif split_line[0] == "RELEASE":
                    print("[scripts] " + coords + "    Release key " + split_line[1])
                    key = kb.sp(split_line[1])
                    kb.release(key)
                elif split_line[0] == "WEB":
                    link = split_line[1]
                    if "http" not in link:
                        link = "http://" + link
                    print("[scripts] " + coords + "    Open website " + link + " in default browser")
                    webbrowser.open(link)
                elif split_line[0] == "WEB_NEW":
                    link = split_line[1]
                    if "http" not in link:
                        link = "http://" + link
                    print("[scripts] " + coords + "    Open website " + link + " in default browser, try to make a new window")
                    webbrowser.open_new(link)
                elif split_line[0] == "CODE":
                    args = " ".join(split_line[1:])
                    print("[scripts] " + coords + "    Running code: " + args)
                    try:
                        subprocess.run(args)
                    except Exception as e:
                        print("[scripts] " + coords + "    Error with running code: " + str(e))
                elif split_line[0] == "SOUND":
                    if len(split_line) > 2:
                        print("[scripts] " + coords + "    Play sound file " + split_line[1] + " at volume " + str(split_line[2]))
                        sound.play(split_line[1], float(split_line[2]))
                    else:
                        print("[scripts] " + coords + "    Play sound file " + split_line[1])
                        sound.play(split_line[1])
                elif split_line[0] == "SOUND_STOP":
                    if len(split_line) > 1:
                        delay = split_line[1]
                        print("[scripts] " + coords +
                              "    Stopping sounds with " + delay + " milliseconds fadeout time")
                        sound.fadeout(int(delay))
                    else:
                        print("[scripts] " + coords + "    Stopping sounds")
                        sound.stop()
                elif split_line[0] == "WAIT_UNPRESSED":
                    print("[scripts] " + coords + "    Wait for script key to be unpressed")
                    while lp_events.pressed[x][y]:
                        sleep(DELAY_EXIT_CHECK)
                        if check_kill(x, y, is_async):
                            return idx + 1             
                elif split_line[0] == "M_STORE":
                    print("[scripts] " + coords + "    Store mouse position")
                    m_pos = ms.get_pos()
                elif split_line[0] == "M_RECALL":
                    if m_pos == tuple():
                        print("[scripts] " + coords + "    No 'M_STORE' command has been run, cannot do 'M_RECALL'")
                    else:
                        print("[scripts] " + coords + "    Recall mouse position " + str(m_pos))
                        ms.set_pos(m_pos[0], m_pos[1])
                elif split_line[0] == "M_RECALL_LINE":
                    x1, y1 = m_pos

                    delay = None
                    if len(split_line) > 1:
                        delay = float(split_line[1]) / 1000.0

                    skip = 1
                    if len(split_line) > 2:
                        skip = int(split_line[2])

                    if (delay == None) or (delay <= 0):
                        print("[scripts] " + coords + "    Recall mouse position " + str(m_pos) + " in a line by " + str(skip) + " pixels per step")
                    else:
                        print("[scripts] " + coords + "    Recall mouse position " + str(m_pos) + " in a line by " + str(skip) + " pixels per step and wait " + split_line[1] + " milliseconds between each step")

                    x_C, y_C = ms.get_pos()
                    points = ms.line_coords(x_C, y_C, x1, y1)
                    for x_M, y_M in points[::skip]:
                        if check_kill(x, y, is_async):
                            return -1
                        ms.set_pos(x_M, y_M)
                        if (delay != None) and (delay > 0):
                            if not safe_sleep(delay, x, y, is_async):
                                return -1
                elif split_line[0] == "M_MOVE":
                    if len(split_line) >= 3:
                        print("[scripts] " + coords + "    Relative mouse movement (" + split_line[1] + ", " + str(split_line[2]) + ")")
                        ms.move_to_pos(float(split_line[1]), float(split_line[2]))
                    else:
                        print("[scripts] " + coords + "    Both X and Y are required for mouse movement, skipping...")
                elif split_line[0] == "M_SET":
                    if len(split_line) >= 3:
                        print("[scripts] " + coords + "    Set mouse position to (" + split_line[1] + ", " + str(split_line[2]) + ")")
                        ms.set_pos(float(split_line[1]), float(split_line[2]))
                    else:
                        print("[scripts] " + coords + "    Both X and Y are required for mouse positioning, skipping...")
                elif split_line[0] == "M_SCROLL":
                    if len(split_line) > 2:
                        print("[scripts] " + coords + "    Scroll (" + split_line[1] + ", " + split_line[2] + ")")
                        ms.scroll(float(split_line[2]), float(split_line[1]))
                    else:
                        print("[scripts] " + coords + "    Scroll " + split_line[1])
                        ms.scroll(0, float(split_line[1]))
                elif split_line[0] == "M_LINE":
                    x1 = int(split_line[1])
                    y1 = int(split_line[2])
                    x2 = int(split_line[3])
                    y2 = int(split_line[4])

                    delay = None
                    if len(split_line) > 5:
                        delay = float(split_line[5]) / 1000.0

                    skip = 1
                    if len(split_line) > 6:
                        skip = int(split_line[6])

                    if (delay == None) or (delay <= 0):
                        print("[scripts] " + coords + "    Mouse line from (" + split_line[1] + ", " + split_line[2] + ") to (" + split_line[3] + ", " + split_line[4] + ") by " + str(skip) + " pixels per step")
                    else:
                        print("[scripts] " + coords + "    Mouse line from (" + split_line[1] + ", " + split_line[2] + ") to (" + split_line[3] + ", " + split_line[4] + ") by " + str(skip) + " pixels per step and wait " + split_line[5] + " milliseconds between each step")

                    points = ms.line_coords(x1, y1, x2, y2)
                    for x_M, y_M in points[::skip]:
                        if check_kill(x, y, is_async):
                            return -1
                        ms.set_pos(x_M, y_M)
                        if (delay != None) and (delay > 0):
                            if not safe_sleep(delay, x, y, is_async):
                                return -1
                elif split_line[0] == "M_LINE_MOVE":
                    x1 = int(split_line[1])
                    y1 = int(split_line[2])

                    delay = None
                    if len(split_line) > 3:
                        delay = float(split_line[3]) / 1000.0

                    skip = 1
                    if len(split_line) > 4:
                        skip = int(split_line[4])

                    if (delay == None) or (delay <= 0):
                        print("[scripts] " + coords + "    Mouse line move relative (" + split_line[1] + ", " + split_line[2] + ") by " + str(skip) + " pixels per step")
                    else:
                        print("[scripts] " + coords + "    Mouse line move relative (" + split_line[1] + ", " + split_line[2] + ") by " + str(skip) + " pixels per step and wait " + split_line[3] + " milliseconds between each step")

                    x_C, y_C = ms.get_pos()
                    x_N, y_N = x_C + x1, y_C + y1
                    points = ms.line_coords(x_C, y_C, x_N, y_N)
                    for x_M, y_M in points[::skip]:
                        if check_kill(x, y, is_async):
                            return -1
                        ms.set_pos(x_M, y_M)
                        if (delay != None) and (delay > 0):
                            if not safe_sleep(delay, x, y, is_async):
                                return -1
                elif split_line[0] == "M_LINE_SET":
                    x1 = int(split_line[1])
                    y1 = int(split_line[2])

                    delay = None
                    if len(split_line) > 3:
                        delay = float(split_line[3]) / 1000.0

                    skip = 1
                    if len(split_line) > 4:
                        skip = int(split_line[4])

                    if (delay == None) or (delay <= 0):
                        print("[scripts] " + coords + "    Mouse line set (" + split_line[1] + ", " + split_line[2] + ") by " + str(skip) + " pixels per step")
                    else:
                        print("[scripts] " + coords + "    Mouse line set (" + split_line[1] + ", " + split_line[2] + ") by " + str(skip) + " pixels per step and wait " + split_line[3] + " milliseconds between each step")

                    x_C, y_C = ms.get_pos()
                    points = ms.line_coords(x_C, y_C, x1, y1)
                    for x_M, y_M in points[::skip]:
                        if check_kill(x, y, is_async):
                            return -1
                        ms.set_pos(x_M, y_M)
                        if (delay != None) and (delay > 0):
                            if not safe_sleep(delay, x, y, is_async):
                                return -1
                elif split_line[0] == "LABEL":
                   print("[scripts] " + coords + "    Label: " + split_line[1])
                   return idx + 1
                elif split_line[0] == "IF_PRESSED_GOTO_LABEL":
                    print("[scripts] " + coords + "    If key is pressed goto LABEL " + split_line[1])
                    if lp_events.pressed[x][y]:
                        return labels[split_line[1]]
                elif split_line[0] == "IF_UNPRESSED_GOTO_LABEL":
                    print("[scripts] " + coords + "    If key is not pressed goto LABEL " + split_line[1])
                    if not lp_events.pressed[x][y]:
                        return labels[split_line[1]]
                elif split_line[0] == "GOTO_LABEL":
                    print("[scripts] " + coords + "    Goto LABEL " + split_line[1])
                    return labels[split_line[1]]
                elif split_line[0] == "REPEAT_LABEL":
                    print("[scripts] " + coords + "    Repeat LABEL " + split_line[1] + " " + split_line[2] + " times max")
                    if idx in repeats:
                        if repeats[idx] > 0:
                            print("[scripts] " + coords + "        " + str(repeats[idx]) + " repeats left.")
                            repeats[idx] -= 1
                            return labels[split_line[1]]
                        else:
                            print("[scripts] " + coords + "        No repeats left, not repeating.")
                    else:
                        repeats[idx] = int(split_line[2])
                        repeats_original[idx] = int(split_line[2])
                        print("[scripts] " + coords + "        " + str(repeats[idx]) + " repeats left.")
                        repeats[idx] -= 1
                        return labels[split_line[1]]
                elif split_line[0] == "IF_PRESSED_REPEAT_LABEL":
                    print("[scripts] " + coords + "    If key is pressed repeat LABEL " + split_line[1] + " " + split_line[2] + " times max")
                    if lp_events.pressed[x][y]:
                        if idx in repeats:
                            if repeats[idx] > 0:
                                print("[scripts] " + coords + "        " + str(repeats[idx]) + " repeats left.")
                                repeats[idx] -= 1
                                return labels[split_line[1]]
                            else:
                                print("[scripts] " + coords + "        No repeats left, not repeating.")
                        else:
                            repeats[idx] = int(split_line[2])
                            print("[scripts] " + coords + "        " + str(repeats[idx]) + " repeats left.")
                            repeats[idx] -= 1
                            return labels[split_line[1]]
                elif split_line[0] == "IF_UNPRESSED_REPEAT_LABEL":
                    print("[scripts] " + coords + "    If key is not pressed repeat LABEL " + split_line[1] + " " + split_line[2] + " times max")
                    if not lp_events.pressed[x][y]:
                        if idx in repeats:
                            if repeats[idx] > 0:
                                print("[scripts] " + coords + "        " + str(repeats[idx]) + " repeats left.")
                                repeats[idx] -= 1
                                return labels[split_line[1]]
                            else:
                                print("[scripts] " + coords + "        No repeats left, not repeating.")
                        else:
                            repeats[idx] = int(split_line[2])
                            print("[scripts] " + coords + "        " + str(repeats[idx]) + " repeats left.")
                            repeats[idx] -= 1
                            return labels[split_line[1]]
                elif split_line[0] == "@SIMPLE":
                    print("[scripts] " + coords + "    Simple keybind: " + split_line[1])
                    #PRESS
                    key = kb.sp(split_line[1])
                    releasefunc = lambda: kb.release(key)
                    kb.press(key)
                    #WAIT_UNPRESSED
                    while lp_events.pressed[x][y]:
                        sleep(DELAY_EXIT_CHECK)
                        if check_kill(x, y, is_async, releasefunc):
                            return idx + 1
                    #RELEASE
                    kb.release(key)
                elif split_line[0] == "@LOAD_LAYOUT":
                    layout_name = " ".join(split_line[1:])
                    print("[scripts] " + coords + "    Load layout " + layout_name)
                    layout_path = os.path.join(files.LAYOUT_PATH, layout_name)
                    if not os.path.isfile(layout_path):
                        print("[scripts] " + coords + "        ERROR: Layout file does not exist.")
                        return -1
                    try:
                        layout = files.load_layout(layout_path, popups=False, save_converted=False)
                    except files.json.decoder.JSONDecodeError:
                        print("[scripts] " + coords + "        ERROR: Layout is malformated.")
                        return -1
                    if files.layout_changed_since_load:
                        files.save_lp_to_layout(files.curr_layout)
                    files.load_layout_to_lp(layout_path, popups=False, save_converted=False, preload=layout)
                elif split_line[0] == "OPEN":
                    path_name = " ".join(split_line[1:])
                    print("[scripts] " + coords + "    Open file or folder " + path_name)
                    files.open_file_folder(path_name)
                elif split_line[0] == "RELEASE_ALL":
                    print("[scripts] " + coords + "    Release all keys")
                    kb.release_all()
                elif split_line[0] == "RESET_REPEATS":
                    print("[scripts] " + coords + "    Reset all repeats")
                    for i in repeats:
                        repeats[i] = repeats_original[i]
                else:
                    print("[scripts] " + coords + "    Invalid command: " + split_line[0] + ", skipping...")
            return idx + 1