aidanrwt / twitch-plays

Twitch IRC bot that takes input from the chat and presses the corresponding key.
MIT License
275 stars 59 forks source link

Anarchy/Democracy?? #4

Closed Krushchevawn closed 9 years ago

Krushchevawn commented 10 years ago

Is there Any plan to add anarchy/democracy slider or do you have any idea how to add the anarchy/democracy slider?

ynohtna92 commented 10 years ago

I can do this in my fork if you would like to assign me @aidraj .

aidanrwt commented 10 years ago

Go ahead ynohtna92. I wrote up a class for handling/drawing the bar already before, don't think I kept a backup of it. I'm not a big fan of the anarchy/democracy mode.

Krushchevawn commented 10 years ago

Will the Anarchy and Dempcracy thing be ready anytime soon? No rush. Id just really like to have it. Im interested in it for my streams!

ynohtna92 commented 10 years ago

Soon^tm.

Expect to see it to see it latest 24 hours from now. I'll try to work on it today if I have some time.

ynohtna92 commented 10 years ago

Almost done. Just need to put on those silly arrows image

Don't mind the positioning, Just testing now.

Krushchevawn commented 10 years ago

Is it possible you can show me to set the chat up and stuff just like that. Im just using screen regions for my stuff right now and its all over the place.

ynohtna92 commented 10 years ago

image

Something like that, obviously it needs more tuning to make it fit right.

Krushchevawn commented 10 years ago

Anyway you could help me with something like this?

Krushchevawn commented 10 years ago

Not trying to be demanding or anything. id just like some help since im gonna use the anarchy and democracy i have no place to put it. So thats why i was asking if you couls help me set something up like this. So i can actually have room to place it.

ynohtna92 commented 10 years ago

https://github.com/ynohtna92/twitch-plays/commit/70cf65b5d0f00132955e4d2460d5e61f9d25cf7b

Updated my fork. It should fit nicely in a 16:9 broadcast window along side the square pokemon window.

image

moieza commented 10 years ago

Hello ynohtna92, Sry for my english I can not launch twitchplays.py on your repo :

Traceback (most recent call last): File "C:\Users\Polzy\Desktop\twitch-plays-master\TwitchPlays.py", line 12, in import lib.bot as bot File "C:\Users\Polzy\Desktop\twitch-plays-master\lib\bot.py", line 1, in from ircbot import Irc File "C:\Users\Polzy\Desktop\twitch-plays-master\lib\ircbot.py", line 1, in import irc.bot ImportError: No module named irc.bot

moieza commented 10 years ago

How to install IRC Client and Tornado for Windows ?

ynohtna92 commented 10 years ago

Download each dependency.

Unzip the the folder and find the setup file.

Locate this directory in cmd and run the command 'python setup.py install'. (python should be where your installation is, so for example I would run 'C:/Python27/python.exe setup.py install')

Do this for each dependency.

Krushchevawn commented 10 years ago

I have it all installed but its really messed up it seems it shows this on the web interface and has errors! ss 2014-02-24 at 03 50 11 ss 2014-02-24 at 03 50 32

ynohtna92 commented 10 years ago

Oh forgot to add file references.. sorry I'll fix it now.

ynohtna92 commented 10 years ago

https://github.com/ynohtna92/twitch-plays/commit/4419a2b4914942697535803e61b97ba2e7ba32d9

Try again with this. It may still give a favicon warning but don't worry about it.

Krushchevawn commented 10 years ago

Well it worked. but now how do i get the time to start from 0?

ynohtna92 commented 10 years ago

In the file "lib/template/index.html" on line 190.

var start = new Date(1392947369 * 1000);

Change the 1392947369 to your starting epoch time stamp. You can make one here http://www.epochconverter.com/. I'll eventually add in a better way to do this.

Krushchevawn commented 10 years ago

How would i go about adjusting the web socket to look appropriate on the stream because right now it has the browser border around it and stuff and i dont know how to remove that. How would you go about doing that?

ynohtna92 commented 10 years ago

image

You have to use the sub region setting. You can get to this by right clicking on the source and selecting property. Then enable sub regions and click the 'Select Region' Button to create a window around the black box. After that is done you can resize to your liking using Edit Scene in OBS.

Krushchevawn commented 10 years ago

Okay and with the democracy and anarchy how many times would one have to say it before it goes to democracy i said democracy twice but Anarchy is still highlighted?

ynohtna92 commented 10 years ago

Change the config anarchy-democracy setting to a smaller number (50 perhaps). It always start in anarchy mode. The bar will move 1 point left or right depending on what is said, so it will take 16 democracy votes to change it with a size of 50 from starting the program.

You will also have to remove the '500 #' on line 40 of the bot.py file. I forgot to commit that change.

MrMcain commented 10 years ago

Hello, I can not install the dependencies, can you help me?

AUmrysh commented 10 years ago

Are you using pip and virtualenv?

MrMcain commented 10 years ago

Ok I found pip and i installed all programs :) Thanks ! (Sorry for my english)

AUmrysh commented 10 years ago

Good to see you got it installed. You don't need virtualenv, but it's a great tool to use with python in case you plan on installing multiple versions of python or multiple versions of libraries.

Technically, pip should be all you need to get twitch-plays working, so if you're not interested in learning virtualenv now, that is alright.

wreck3d commented 9 years ago

@ynohtna92, not sure how to contact you, but: I currently am using aidraj's TPP clone and I stumbled upon this page (for the modes). How can I add the feature where if someone types any of the directional commands (up, down, etc) it shows a tiny arrow to the direction they typed in the chat?

ynohtna92 commented 9 years ago

There are a couple of ways you could do this but the quickest would be just changing https://github.com/ynohtna92/twitch-plays/blob/master/lib/template/index.html#L293-310 so if the string is equal to up,down,left,right it will return a html tagged image with the corresponding arrow.

wreck3d commented 9 years ago

I'm familiar with some coding stuff, but how would I change those lines to make it point to an image? I know the basic HTML tags or whatever, but not sure where exactly to change stuff in those lines. Big help, though, and hopefully you could answer this question as well :) Also, how would I integrate that template into sunshinekitty's TPP clone?: https://github.com/sunshinekitty/TwitchPlaysPokemon/tree/master/TwitchPlaysBot Her/His clone is the only one I've actually been able to get working for me. Thanks!

On Sun, May 17, 2015 at 1:24 AM, ynohtna92 notifications@github.com wrote:

There are a couple of ways you could do this but the quickest would be just changing https://github.com/ynohtna92/twitch-plays/blob/master/lib/template/index.html#L293-310 so if the string is equal to up,down,left,right it will return a html tagged image with the corresponding arrow.

— Reply to this email directly or view it on GitHub https://github.com/aidraj/twitch-plays/issues/4#issuecomment-102749494.

-Branden-

ynohtna92 commented 9 years ago
function formatOutput(left, right){
  var buffer_size = 20;
  var buffer_used = 0;
  var whitespace_size = 1;
  var img = "";

  if (left == "down"){
    left = " " // Clear instruction
    img = '<img src="downarrow.png" height="16" width="16">'
  }

  buffer_used = right.toString().length + whitespace_size;
  var buffer_left = buffer_size - buffer_used;
  if (buffer_left > left.length) {
    whitespace_size += buffer_left - left.length;
  }
  var left_end = buffer_left;
  left = left.substring(0, left_end);
  return img + left + Array(whitespace_size + 1).join(" ") + right;
};

Would be what the function turns into. Note this is untested.

As for sunshines clone, i have no idea. Mine should work as long as you have configured it correctly and you have the required dependencies installed.

wreck3d commented 9 years ago

For some reason, I kept getting this error with yours. Picture attached. (Sent from e-mail)

Sent from my iPhone

On May 17, 2015, at 4:14 AM, ynohtna92 notifications@github.com wrote:

function formatOutput(left, right){ var buffer_size = 20; var buffer_used = 0; var whitespace_size = 1; var img = "";

if (left == "down"){ left = " " // Clear instruction img = '' }

buffer_used = right.toString().length + whitespace_size; var buffer_left = buffer_size - buffer_used; if (buffer_left > left.length) { whitespace_size += buffer_left - left.length; } var left_end = buffer_left; left = left.substring(0, left_end); return img + left + Array(whitespace_size + 1).join(" ") + right; }; Would be what the function turns into. Note this is untested.

As for sunshines clone, i have no idea. Mine should work as long as you have configured it correctly and you have the required dependencies installed.

— Reply to this email directly or view it on GitHub.

ynohtna92 commented 9 years ago
left = " " // Clear instruction
img = '<img src="downarrow.png" height="16" width="16">'

Opps these lines should be

left = " "; // Clear instruction
img = '<img src="downarrow.png" height="16" width="16">';

But yeah you will need to actually add in the image so it can be referenced.

And what errors are you getting you didn't submit any photo.

wreck3d commented 9 years ago

I cannot get your bot to start, though. Whenever I type "twitchplays.py" to start it, I get this:

EDIT: Also, would I just copy & paste the code below four times for each direction icon? unnamed

Code: if (left == "down"){ left = " "; // Clear instruction img = ''; }

ynohtna92 commented 9 years ago

Yes you would copy it 4 times obviously changing the text and img src.

You haven't installed the dependancies my fork requires. Please do these steps.

Dependencies

wreck3d commented 9 years ago

No, i did download the dependencies. I just put them all in the same folder, but still the same error message. As you can see, I moved the stuff from /lib folder to the main one, but either way, whether the scrips are in the lib folder or not, still the same error....Do I need to do anything with the IRC & Tornado downloads? I looked at the settings/config files, but didn't really see anything. error

ynohtna92 commented 9 years ago

That is not how you install python dependencies. Please read the install instructions for each of those dependencies.

When installed correctly you should be able to do the following in the python interpreter without any errors. image

wreck3d commented 9 years ago

For the IRC install, I'm getting this: ircerr

ynohtna92 commented 9 years ago

https://pypi.python.org/pypi/irc/8.5.4 Download this version as it is the one I used.

wreck3d commented 9 years ago

Not sure why it keeps saying the setup tools are too old. ircer

ynohtna92 commented 9 years ago

You are not giving the install script a command. It should be 'setup.py install' As for the setuptools error, i cannot help with that.

wreck3d commented 9 years ago

That "setup.py install" was all I needed. Installed them both perfectly :+1:

wreck3d commented 9 years ago

Alright....so, I got everything running perfectly. I do, however, have a question on something: When a directional command (up, down, etc.) is entered, the arrows still do not show. And nothing shows up when I CTRL+O that "indexhtml" file in the /template folder. How can I have the arrows show when a direction is commanded? I currently just have a Window Capture set up on my CMD terminal where the commands come through for my stream. Thanks! Oh, & here's how I have the code (starting at line 293 on index file): EDIT: lol @ my image links getting turned to the actual arrows.

    function formatOutput(left, right){
  var buffer_size = 20;
  var buffer_used = 0;
  var whitespace_size = 1;
  var img = "";

if (left == "down"){ left = " "; // Clear instruction img = ''; }

if (left == "left"){

left = " "; // Clear instruction img = ''; }

if (left == "right"){

left = " "; // Clear instruction img = ''; }

if (left == "up"){

left = " "; // Clear instruction img = ''; }

ynohtna92 commented 9 years ago

What shows instead?

wreck3d commented 9 years ago

The regular full name of the direction.

Sent from my iPhone

On May 17, 2015, at 11:01 PM, ynohtna92 notifications@github.com wrote:

What shows instead?

— Reply to this email directly or view it on GitHub.

ynohtna92 commented 9 years ago

Did you read the instructions? You have to go to http://127.0.0.1:8888 for the UI. The command prompt will only display text.

wreck3d commented 9 years ago

I mean, yeah, I did that, but it was showing like 400 days on the timer or something. I'll try it again And I know the CMD Prompt will only display text, but I didn't know if it got converted to show the image on something...idk what I was thinking :p

EDIT: That IP URL is giving me an error page, which is odd, since I was on it earlier.

wreck3d commented 9 years ago

I also have a request for this: Could you somehow make it so people can enter commands such as: up3, down2, left6, etc.? Where the number is how many times it'll be pressed.

ynohtna92 commented 9 years ago

The start time on the timer is hardcoded into index.html, please read above as I have explained how to change it.

The page will give you an error if the python script has been closed, so it has to stay open.

Make a request by starting a new issue, but i'm sure aijraj is no longer working on this and neither am I. Sorry but if you want any features you will have to add them yourself, the project is opensource for a reason.

wreck3d commented 9 years ago

Alright, will do. Thank-you.

wreck3d commented 9 years ago

Hm... Ok, so I got the http://127.0.0.1:8888 page open...but when I enter a command, it doesn't show up on that page at all. tper