so if i want to add a space bar function how would i say press [space-bar] or something like that. like what words would i type in there to indicate i want the space bar pressed? Thank you.
The space key
Here’s an example from the default keybindings:
{ "keys": ["ctrl+shift+space"], "command": "expand_selection", "args": {"to": "scope"} },
if msg == “w”: w.holdForSeconds(msg, 0.3);
if msg == “s”: keyholder.holdForSeconds(msg, 0.3);
if msg == “a”: keyholder.holdForSeconds(msg, 0.1);
if msg == “d”: keyholder.holdForSeconds(msg, 0.1);
if msg == “e”: keyholder.holdForSeconds(msg, 0.5);
if msg == “q”: keyholder.holdForSeconds(msg, 0.1);
if msg == “t”: keyholder.holdForSeconds(msg, 0.5);
if msg == “jump” : keyholder.holdforseconds(keys[UP], 3.0);
here is an example of what my code is. how do i say instead of keyholder. (spacebar).holdforseconds?
This doesn’t look related to Sublime Text at all, but we might be able to help you if you told us what you are working with (i.e. what language or toolset).
My guess would be
keyholder.holdForSeconds(" ", 3.0);
here is my whole code, if you type something into twitch it makes me do that. so the idea is if my twitch chat says w i move forward. I want to get my space bar to work, so if they type something i jump. I dont know if you can help me with this but it would be amazing if you can. Thank you!
import twitch
import keypresser
import keyholder
t = twitch.Twitch();
k = keypresser.Keypresser();
#Enter your twitch username and oauth-key below, and the app connects to twitch with the details.
#Your oauth-key can be generated at http://twitchapps.com/tmi/
username = “tommydee”;
key = “oauth:”;
t.twitch_connect(username, key);
#The main loop
while True:
#Check for new mesasages
new_messages = t.twitch_recieve_messages();
if not new_messages:
#No new messages...
continue
else:
for message in new_messages:
#Wuhu we got a message. Let's extract some details from it
msg = message['message'].lower()
username = message['username'].lower()
print(username + ": " + msg.encode('utf-8'));
#This is where you change the keys that shall be pressed and listened to.
#The code below will simulate the key q if "q" is typed into twitch by someone
#.. the same thing with "w"
#Change this to make Twitch fit to your game!
if msg == "w": keyholder.holdForSeconds(msg, 0.3);
if msg == "s": keyholder.holdForSeconds(msg, 0.3);
if msg == "a": keyholder.holdForSeconds(msg, 0.1);
if msg == "d": keyholder.holdForSeconds(msg, 0.1);
if msg == "e": keyholder.holdForSeconds(msg, 0.5);
if msg == "q": keyholder.holdForSeconds(msg, 0.1);
if msg == "t": keyholder.holdForSeconds(msg, 0.5);
if msg == "jump" : keyholder.holdforseconds(" ", 3.0);