예제 #1
0
    def hold_digital_duration(self, val="", duration=0):

        global Vjoy
        global joyState

        score = 0
        if self.buttons["a"] or val == "a": score += 1
        if self.buttons["b"] or val == "b": score += 1
        if self.buttons["select"] or val == "select": score += 1
        if self.buttons["start"] or val == "start": score += 1
        if score >= 4:
            self.release_digital("a")
            self.release_digital("b")
            self.release_digital("select")
            sendmessage("No resetting ;P")
        else:
            if val != "point":
                SetButton(joyState[self.id], INPUTS[val], Vjoy.BUTTON_DOWN)
            else:
                SetButton(joyState[self.id], INPUTS[val], Vjoy.BUTTON_UP)
            self.buttons[val] = True
            UpdateJoyState(self.id, joyState[self.id])

            time.sleep(duration / 1000)
            if val != "point":
                SetButton(joyState[self.id], INPUTS[val], Vjoy.BUTTON_UP)
            else:
                SetButton(joyState[self.id], INPUTS[val], Vjoy.BUTTON_DOWN)
            UpdateJoyState(self.id, joyState[self.id])
            self.buttons[val] = False
예제 #2
0
def memes(user, message, args=[]):
    memes = sorted([meme["name"] for meme in MEMES])
    if len(memes) < 20:
        return ", ".join(memes)
    elif len(memes) < 40:
        sendmessage(", ".join(memes[0:20]))
        sendmessage(", ".join(memes[20:]))
    elif len(memes) < 60:
        sendmessage(", ".join(memes[0:20]))
        sendmessage(", ".join(memes[20:40]))
        sendmessage(", ".join(memes[40:]))
예제 #3
0
def macros(user, message, args=[]):
    macros = sorted([macro["name"] for macro in MACROS])
    if len(macros) < 20:
        return ", ".join(macros)
    elif len(macros) < 40:
        sendmessage(", ".join(macros[0:20]))
        sendmessage(", ".join(macros[20:]))
    elif len(macros) < 60:
        sendmessage(", ".join(macros[0:20]))
        sendmessage(", ".join(macros[20:40]))
        sendmessage(", ".join(macros[40:]))
예제 #4
0
def commands(user, message, args=[]):
    commands = sorted([command["name"] for command in COMMANDS if user["level"] >= command["level"]])
    if len(commands) < 20:
        return ", ".join(commands)
    elif len(commands) < 40:
        sendmessage(", ".join(commands[0:20]))
        sendmessage(", ".join(commands[20:]))
    elif len(commands) < 60:
        sendmessage(", ".join(commands[0:20]))
        sendmessage(", ".join(commands[20:40]))
        sendmessage(", ".join(commands[40:]))
예제 #5
0
    def hold_digital_duration(self, button):
        global Vjoy
        global joyState

        score = 0
        if self.buttons["a"] or button["name"] == "a": score += 1
        if self.buttons["b"] or button["name"] == "b": score += 1
        if self.buttons["select"] or button["name"] == "select": score += 1
        if self.buttons["start"] or button["name"] == "start": score += 1
        if score >= 4:
            self.release_digital({"name": "a"})
            self.release_digital({"name": "b"})
            self.release_digital({"name": "select"})
            sendmessage("No resetting ;P")
        else:
            if button["name"].startswith("LOADSTATE") or button["name"].startswith("SAVESTATE"):
                SetButton(joyState[1], INPUTS[button["name"]], Vjoy.BUTTON_DOWN)
            elif button["name"] != "point":
                SetButton(joyState[self.id], INPUTS[button["name"]], Vjoy.BUTTON_DOWN)
            else:
                SetButton(joyState[self.id], INPUTS[button["name"]], Vjoy.BUTTON_UP)
            self.buttons[button["name"]] = True

            if button["name"].startswith("LOADSTATE") or button["name"].startswith("SAVESTATE"):
                UpdateJoyState(1, joyState[1])
                time.sleep(0.2)
            else:
                UpdateJoyState(self.id, joyState[self.id])
                time.sleep(button["duration"]/1000)

            if button["name"].startswith("LOADSTATE") or button["name"].startswith("SAVESTATE"):
                SetButton(joyState[1], INPUTS[button["name"]], Vjoy.BUTTON_UP)
            elif button["name"] != "point":
                SetButton(joyState[self.id], INPUTS[button["name"]], Vjoy.BUTTON_UP)
            else:
                SetButton(joyState[self.id], INPUTS[button["name"]], Vjoy.BUTTON_DOWN)

            if button["name"].startswith("LOADSTATE") or button["name"].startswith("SAVESTATE"):
                UpdateJoyState(1, joyState[1])
            else:
                UpdateJoyState(self.id, joyState[self.id])
            self.buttons[button["name"]] = False
예제 #6
0
def chat(user, message):

    global CW

    try:
        sendmessage("@" + user.name + " " + CW.say(message))
    except:
        sendmessage("Error gathering response. Trying again...")
        try:
            CW = CleverWrap(CLEVERBOT_API_KEY)
            sendmessage("@" + user.name + " " + CW.say(message))
        except:
            sendmessage("Unable to get a response.")
예제 #7
0
def send_list(send_list):

	i = 0
	send_str = ""
	send_messages = [""]

	for thing in send_list:
		send_str += thing + ", "
		i +=1

		if i % 30 == 0:
			send_messages.append(send_str[0:-2])
			send_str = ""
		elif i < 30:
			send_messages[0] = send_str

	if len(send_messages) == 1:
		sendmessage(send_messages[0][0:-2])
	else:
		for i in range(0,len(send_messages)):
			if i != 0:
				sendmessage(send_messages[i])
		try:
			sendmessage(send_str[:-2])
		except:
			pass
예제 #8
0
    def hold_digital_indefinite(self, button):
        global Vjoy
        global joyState

        score = 0
        if self.buttons["a"] or button["name"] == "a": score += 1
        if self.buttons["b"] or button["name"] == "b": score += 1
        if self.buttons["select"] or button["name"] == "select": score += 1
        if self.buttons["start"] or button["name"] == "start": score += 1
        if score >= 4:
            self.release_digital({"name": "a"})
            self.release_digital({"name": "b"})
            self.release_digital({"name": "select"})
            sendmessage("No resetting ;P")
        else:
            if button["name"] != "point":
                SetButton(joyState[self.id], INPUTS[button["name"]], Vjoy.BUTTON_DOWN)
            else:
                SetButton(joyState[self.id], INPUTS[button["name"]], Vjoy.BUTTON_UP)
            UpdateJoyState(self.id, joyState[self.id])

            self.buttons[button["name"]] = True
예제 #9
0
def roulette(user, message, message_with_case=""):

	global ROULETTE_CHAMBERS
	global ROULETTE_TIMER

	if time.clock() - ROULETTE_TIMER > ROULETTE_TIMER_THRESHOLD:
		if random.randrange(0,ROULETTE_CHAMBERS) == 0:
			sendmessage("☠ BANG! ☠")
			sendmessage("/timeout " + user.name + " 10")
			ROULETTE_CHAMBERS = 6
			ROULETTE_TIMER = time.clock()
		else:
			ROULETTE_CHAMBERS -= 1
			sendmessage("..." + str(ROULETTE_CHAMBERS) + " shots remain...")
	else:
		return "Not active right now. Try again later."