Here's the updated PYthon poster...
import socket import time from array import array def sendScratchCommand(cmd): n = len(cmd) a = array('c') a.append(chr((n >> 24) & 0xFF)) a.append(chr((n >> 16) & 0xFF)) a.append(chr((n >> 8) & 0xFF)) a.append(chr(n & 0xFF)) return (a.tostring() + cmd) sock = socket.socket() sock.connect((socket.gethostbyname("scratch.playfultest.tk"), 6112)) name = raw_input("Name: ") sock.send(sendScratchCommand('sensor-update "Name" "' + name + '"')) msg = raw_input("Message: ") while msg != "quit": sock.send(sendScratchCommand('broadcast "<chat ' + name + ': ' + msg + '"')) msg = raw_input("Message: ") sock.close()
Or the executable: here
Use it together with my listener, and you have a replacement for Scratch!
Offline
Try my Guest modification! You log in as Guest[random numbers here] everytime you pick the guest option. Just replace the blocks already there in the if block with the blocks in the image below:
The "pick random" block can be set to whatever you want.
Last edited by ProgrammingPro01 (2011-12-24 20:32:44)
Offline
New Update!
There are now messages that display "[Your Name] has joined!" and "[Your Name] has left!" and the online list everyone has been wanting, has been added. There have also been a few very minor updates for my commands ( I can now set ranks for people without needing to reset the server ).
This has no meaning to very many people besides developers that want to host their own server: I've updated the "style" of the code and moved a few things around to work better.
I've also updated the Chat.PY client with a fixed version of the Authentication System and it also complies with the new standard for sending a "join" message. I've also added comments to some of the blocks/scripts to explain a little more on how it works so users can easily modify it to their own needs/wants.
Hope you all enjoy the update! Any more ideas and suggestions are welcome! I'm also interested in everyone else's mods of the Chat.PY client.
-----
If anyone is interested in creating their own little "sub-chat", I plan on adding something like "channels" to show a little more of what you can do with the server, since it's not just a chat server, it has features that you can use to create your own little games with it ( two-player pong would probably work, but may be a little slow ).
I've had an idea on adding a new standard for the "^follow_update" broadcast, so it coordinates with the variable that is actually updating, so the broadcast looks like "^follow_update: [updated variable]". This way, you don't have to check if it's that specific variable that's being updated. Though a disadvantage of this is that you can't get updates for any variable.
Everything below the ----- line is just an idea though.
Offline
~Magnie
Wow. I remember you telling me that I could do something like this a while ago. I am very interested in it now. Could you give me a link to a tutorial on Python? Then I could help you guys with adding some features.
Also, have you considered using c++? I know that it is a pain in the neck to understand, but it is a lot faster than Python. I am learning c++ and I am pretty good at it. It can do a lot more than Python and will do the same stuff that you're doing ten times faster. Just a suggestion.
Will any of you guys be von the chat tonight beteeen 7-8pm (United States, Washington, not sure what time zone this is)?
Last edited by GP1 (2011-12-26 18:41:49)
Offline
GP1 wrote:
~Magnie
Wow. I remember you telling me that I could do something like this a while ago. I am very interested in it now. Could you give me a link to a tutorial on Python? Then I could help you guys with adding some features.
Also, have you considered using c++? I know that it is a pain in the neck to understand, but it is a lot faster than Python. I am learning c++ and I am pretty good at it. It can do a lot more than Python and will do the same stuff that you're doing ten times faster. Just a suggestion.
Will any of you guys be von the chat tonight beteeen 7-8pm (United States, Washington, not sure what time zone this is)?
I think the best place to learn Python is from a book, my Dad got me one called "Python For The Absolute Beginner, Second Edition", it explains how to use Python and nearly all it's most basic and powerful features.
I've done some experiments with C and C++ and the most complicated problem I've had is figuring out how to compile the code in a format that Linux uses so I can run the program on there instead. Though it is faster, as you have explain, it is kind of complicated for my preference.
Washington is in the PST or MST time zone. Many of the "dedicated users" ( like Ohaider, MathWizz, Me, and some others ) are usually on between 6PM - 11PM. Though once school starts up again, I'm sure that we will be on less.
Offline
Me too
C is Linux's primary language, and it comes with a compiler. I think that there are a ton of other C and c++ compilers for linux. I got Windows 7, so I use microsoft visual c++.
I would go on the chat right now, but I'm on a tablet (my parents only allow me on my computer between 7-8pm)
As for school, I just got out last Wednesday, and I go back in a week! But my times will be the same.
Offline
Magnie wrote:
GP1 wrote:
~Magnie
Wow. I remember you telling me that I could do something like this a while ago. I am very interested in it now. Could you give me a link to a tutorial on Python? Then I could help you guys with adding some features.
Also, have you considered using c++? I know that it is a pain in the neck to understand, but it is a lot faster than Python. I am learning c++ and I am pretty good at it. It can do a lot more than Python and will do the same stuff that you're doing ten times faster. Just a suggestion.
Will any of you guys be von the chat tonight beteeen 7-8pm (United States, Washington, not sure what time zone this is)?I think the best place to learn Python is from a book, my Dad got me one called "Python For The Absolute Beginner, Second Edition", it explains how to use Python and nearly all it's most basic and powerful features.
I've done some experiments with C and C++ and the most complicated problem I've had is figuring out how to compile the code in a format that Linux uses so I can run the program on there instead. Though it is faster, as you have explain, it is kind of complicated for my preference.
Washington is in the PST or MST time zone. Many of the "dedicated users" ( like Ohaider, MathWizz, Me, and some others ) are usually on between 6PM - 11PM. Though once school starts up again, I'm sure that we will be on less.
Yes, I try to get on as much as possible. OF course I do have a life outside of my computer
Offline
ohaiderstudios wrote:
Magnie wrote:
GP1 wrote:
~Magnie
Wow. I remember you telling me that I could do something like this a while ago. I am very interested in it now. Could you give me a link to a tutorial on Python? Then I could help you guys with adding some features.
Also, have you considered using c++? I know that it is a pain in the neck to understand, but it is a lot faster than Python. I am learning c++ and I am pretty good at it. It can do a lot more than Python and will do the same stuff that you're doing ten times faster. Just a suggestion.
Will any of you guys be von the chat tonight beteeen 7-8pm (United States, Washington, not sure what time zone this is)?I think the best place to learn Python is from a book, my Dad got me one called "Python For The Absolute Beginner, Second Edition", it explains how to use Python and nearly all it's most basic and powerful features.
I've done some experiments with C and C++ and the most complicated problem I've had is figuring out how to compile the code in a format that Linux uses so I can run the program on there instead. Though it is faster, as you have explain, it is kind of complicated for my preference.
Washington is in the PST or MST time zone. Many of the "dedicated users" ( like Ohaider, MathWizz, Me, and some others ) are usually on between 6PM - 11PM. Though once school starts up again, I'm sure that we will be on less.Yes, I try to get on as much as possible. OF course I do have a life outside of my computer
Sadly I don't seem to.
Offline
GP1 wrote:
Also, have you considered using c++? I know that it is a pain in the neck to understand, but it is a lot faster than Python. I am learning c++ and I am pretty good at it. It can do a lot more than Python and will do the same stuff that you're doing ten times faster. Just a suggestion.
For things like this, switching to C++ wouldn't make much of a difference, as the main thing slowing it down is the network. For something where speed is critical, like a game, it would make a lot of difference, although even in some games you can use Python and still get decent performance.
Offline
blob8108 wrote:
GP1 wrote:
Also, have you considered using c++? I know that it is a pain in the neck to understand, but it is a lot faster than Python. I am learning c++ and I am pretty good at it. It can do a lot more than Python and will do the same stuff that you're doing ten times faster. Just a suggestion.
For things like this, switching to C++ wouldn't make much of a difference, as the main thing slowing it down is the network. For something where speed is critical, like a game, it would make a lot of difference, although even in some games you can use Python and still get decent performance.
And adding onto this, Python can run a decent game server ( maybe a hundred clients if you have good internet ). It's mainly Scratch that slows everything down, it's so slow that when you broadcast "two broadcasts at once" it combines them into a single network packet and sends it ( making it harder to parse ). Though, in general it's Scratch's problem when anything on the network is slow.
Offline
Magnie wrote:
blob8108 wrote:
GP1 wrote:
Also, have you considered using c++? I know that it is a pain in the neck to understand, but it is a lot faster than Python. I am learning c++ and I am pretty good at it. It can do a lot more than Python and will do the same stuff that you're doing ten times faster. Just a suggestion.
For things like this, switching to C++ wouldn't make much of a difference, as the main thing slowing it down is the network. For something where speed is critical, like a game, it would make a lot of difference, although even in some games you can use Python and still get decent performance.
And adding onto this, Python can run a decent game server ( maybe a hundred clients if you have good internet ). It's mainly Scratch that slows everything down, it's so slow that when you broadcast "two broadcasts at once" it combines them into a single network packet and sends it ( making it harder to parse ). Though, in general it's Scratch's problem when anything on the network is slow.
However, I do think it would be worth the effort translating the server into C++
Offline
huds wrote:
Wait a minute, I'm getting confused by all this. Am I supposed to make a connection or something? I did exactly the steps.
You will connect to his server, and there is a temp chat there. So do the steps, then run the project and you SHOULD be able to chat.
Offline
huds wrote:
Wait a minute, I'm getting confused by all this. Am I supposed to make a connection or something? I did exactly the steps.
I saw you online, but no one replied. You need to wait longer, we aren't on 24/7. Sorry.
Offline
ohaiderstudios wrote:
http://imageflock.com/img/1324581447.png
That's what I got when I ran it, and then when I ran your chat program, nothing happened when I sent messages.
You're name there is Adrian.
Anyway, the chat program is standalone without the Python, only the online Java.
Offline
cocolover76 wrote:
ohaiderstudios wrote:
http://imageflock.com/img/1324581447.png
That's what I got when I ran it, and then when I ran your chat program, nothing happened when I sent messages.You're name there is Adrian.
Anyway, the chat program is standalone without the Python, only the online Java.
Not my name
Offline
zippynk wrote:
Is there a list of users that are on? (Because I've been having problems lately with figuring out if anyone is on, and therefore I'm not sure if I'm talking to anyone or not.)
Chat:
/list
-------------------------
I can't seem to hear myself, or other people hear me, but I can hear other people.
EDIT:STOP MUTING ME!!!!!!!!!!
Last edited by cocolover76 (2011-12-28 14:12:33)
Offline
it seems like something weird is happening. ohaidar keeps saying the same thing -- I wonder if someone is spoofing him?
Here's the chat:
zippynk and ohaider wrote:
zippynk has joined!
Ohaider, Lucario621, zippynk.
Ohaider, Lucario621, zippynk.
[03:28:55]+zippynk: anyone here?
[03:29:02]~Ohaider: Magnie always knows O.o
[03:29:13]+zippynk: huh?
[03:29:32]~Ohaider: spoofing = ip ban
[03:29:36]+zippynk:
[03:29:48]+zippynk: oops I had to do that to bring back the ask box
[03:30:02]~Ohaider: I totally agree!
[03:30:32]~Ohaider: sup peeps
[03:30:36]+zippynk: you have this on autopilot, don't you?
[03:31:02]~Ohaider: Magnie always knows O.o
[03:31:32]~Ohaider: hmmm
[03:31:39]+zippynk: ohaider, if you're here and you're here, could you please say so? thanks! zippynk
[03:32:02]~Ohaider: Magnie always knows O.o
[03:32:03]+zippynk: oops! "if you're here and you're here"
[03:32:32]~Ohaider: mhmm
[03:33:02]~Ohaider: I like pie, pi, and py(thon)
[03:33:32]~Ohaider: I totally agree!
[03:34:02]~Ohaider: spoofing = ip ban
Is there an error on the server that's making it repeat the text?
Last edited by zippynk (2011-12-28 22:37:50)
Offline
zippynk wrote:
it seems like something weird is happening. ohaidar keeps saying the same thing -- I wonder if someone is spoofing him?
Here's the chat:zippynk and ohaider wrote:
zippynk has joined!
Ohaider, Lucario621, zippynk.
Ohaider, Lucario621, zippynk.
[03:28:55]+zippynk: anyone here?
[03:29:02]~Ohaider: Magnie always knows O.o
[03:29:13]+zippynk: huh?
[03:29:32]~Ohaider: spoofing = ip ban
[03:29:36]+zippynk:
[03:29:48]+zippynk: oops I had to do that to bring back the ask box
[03:30:02]~Ohaider: I totally agree!
[03:30:32]~Ohaider: sup peeps
[03:30:36]+zippynk: you have this on autopilot, don't you?
[03:31:02]~Ohaider: Magnie always knows O.o
[03:31:32]~Ohaider: hmmm
[03:31:39]+zippynk: ohaider, if you're here and you're here, could you please say so? thanks! zippynk
[03:32:02]~Ohaider: Magnie always knows O.o
[03:32:03]+zippynk: oops! "if you're here and you're here"
[03:32:32]~Ohaider: mhmm
[03:33:02]~Ohaider: I like pie, pi, and py(thon)
[03:33:32]~Ohaider: I totally agree!
[03:34:02]~Ohaider: spoofing = ip banIs there an error on the server that's making it repeat the text?
Lol... He's not spoofing... I think that's his M0db0T.
Ohaider: If you want the bot with a different name, you can set up an account for it and I can rank it to Mod.
Last edited by Magnie (2011-12-28 22:42:17)
Offline