This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#151 2011-12-24 15:33:38

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

Here's the updated PYthon poster...

Code:

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!


Fork Clamor on GitHub!

Offline

 

#152 2011-12-24 16:18:22

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

http://imageflock.com/img/1324761363.png
My listener may need some work  big_smile


Fork Clamor on GitHub!

Offline

 

#153 2011-12-24 16:49:29

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

Updated transmitter, now fully equipped with login!
Executable: here
Source: here

To sign up: here


Fork Clamor on GitHub!

Offline

 

#154 2011-12-24 17:04:11

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

Signup Source: here


Fork Clamor on GitHub!

Offline

 

#155 2011-12-24 20:25:31

ProgrammingPro01
Scratcher
Registered: 2011-07-30
Posts: 1000+

Re: Chat.PY and Other Features

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:
http://i1112.photobucket.com/albums/k490/The01er/chatguestscript.png

The "pick random" block can be set to whatever you want.

Last edited by ProgrammingPro01 (2011-12-24 20:32:44)


Bye 1.4!
http://www.reactiongifs.com/wp-content/uploads/2013/04/sobbing.gifhttp://25.media.tumblr.com/tumblr_mbfh6bIamQ1qky11ho1_500.png

Offline

 

#156 2011-12-26 04:48:59

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

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.  smile

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.  big_smile

-----

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 ).  smile

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

 

#157 2011-12-26 16:32:53

FreshStudios
Scratcher
Registered: 2011-04-11
Posts: 500+

Re: Chat.PY and Other Features

nice updates Magnie  smile  everything is really coming along  smile


http://i43.tinypic.com/24ymnbn.png

Offline

 

#158 2011-12-26 18:39:19

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: Chat.PY and Other Features

~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)


I am currently http://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=imagehttp://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=text and I finally got over 1000 posts.

Offline

 

#159 2011-12-26 18:53:17

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

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

 

#160 2011-12-26 20:02:31

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: Chat.PY and Other Features

Me too  big_smile
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.


I am currently http://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=imagehttp://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=text and I finally got over 1000 posts.

Offline

 

#161 2011-12-27 00:13:34

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

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  wink


Fork Clamor on GitHub!

Offline

 

#162 2011-12-27 00:54:20

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

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  wink

Sadly I don't seem to.  tongue

Offline

 

#163 2011-12-27 03:32:13

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Chat.PY and Other Features

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.  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#164 2011-12-27 10:40:56

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

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.  smile

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

 

#165 2011-12-27 10:44:13

huds
Scratcher
Registered: 2010-02-11
Posts: 23

Re: Chat.PY and Other Features

Wait a minute, I'm getting confused by all this. Am I supposed to make a connection or something? I did exactly the steps.

Offline

 

#166 2011-12-27 10:44:30

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Chat.PY and Other Features

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.  smile

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++


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#167 2011-12-27 10:49:08

rabbit1131
Scratcher
Registered: 2009-10-16
Posts: 1000+

Re: Chat.PY and Other Features

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.


The Intergalactic Adventures of Revesilia! I hope you will partake in this gigantic undertaking, to build the sequel to the hit map The Adventures of Revesilia! The Intergalactic Adventures of Revesilia Map Builders Application thread! http://internetometer.com/image/35004.png

Offline

 

#168 2011-12-27 11:08:09

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

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

 

#169 2011-12-27 21:43:51

cocolover76
Scratcher
Registered: 2011-10-09
Posts: 500+

Re: Chat.PY and Other Features

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.


http://i.imgur.com/HfEPZ.gifhttp://i.imgur.com/pvKb6.png

Offline

 

#170 2011-12-28 01:12:14

ohaiderstudios
Scratcher
Registered: 2010-10-31
Posts: 100+

Re: Chat.PY and Other Features

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  big_smile


Fork Clamor on GitHub!

Offline

 

#171 2011-12-28 10:29:26

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Chat.PY and Other Features

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.)


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#172 2011-12-28 11:54:50

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Chat.PY and Other Features

There's someone on the chat who was being really obnoxious who's usename is I. Just the letter I.

Last edited by zippynk (2011-12-28 11:55:08)


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#173 2011-12-28 12:13:23

cocolover76
Scratcher
Registered: 2011-10-09
Posts: 500+

Re: Chat.PY and Other Features

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:

Code:

/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)


http://i.imgur.com/HfEPZ.gifhttp://i.imgur.com/pvKb6.png

Offline

 

#174 2011-12-28 22:35:00

zippynk
Scratcher
Registered: 2011-07-23
Posts: 500+

Re: Chat.PY and Other Features

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)


https://dl.dropbox.com/u/60598636/trifocal_interlude_soundcloud_button.png

Offline

 

#175 2011-12-28 22:39:54

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Chat.PY and Other Features

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 ban

Is there an error on the server that's making it repeat the text?

Lol... He's not spoofing... I think that's his M0db0T.  tongue

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

 

Board footer