Konnected's main feature is that it simplifies connecting to Python, ActionScript, Mesh and the Internet.
Tell me if you want to help! I have already started, but I need some people to help program.
Programmers:
nickbrickmaster
TRocket
-
idea people:
nickbrickmaster
-
-
Last edited by nickbrickmaster (2011-12-27 18:11:48)
Offline
Oo! Do you have the simplified Python connection already done?
Offline
Magnie wrote:
Oo! Do you have the simplified Python connection already done?
I'm making blocks and a module for Python 3.2
Offline
Boom
Under
Maple
People
Offline
Servine wrote:
can you put me in the credits for the mods name?
![]()
Sure.
Offline
Unless I learn Squeak better or get some more help, this will go very slowly.
That's for the wiki. take this sentence out if you quote!
also, it will support Texture Packs!
Offline
TRocket wrote:
I have made a java scratch connector
Nice! What's the Java-side code?
Offline
TRocket wrote:
nickbrickmaster wrote:
TRocket wrote:
I have made a java scratch connector
Nice! What's the Java-side code?
i'll post it soon, please give credit if you use it.
Sure.
Offline
nickbrickmaster wrote:
TRocket wrote:
nickbrickmaster wrote:
Nice! What's the Java-side code?
i'll post it soon, please give credit if you use it.
Sure.
javadoc
library (jar)
scratch.TRocket.ScratchRemoteSonsorConnetions
yes it is sonsor since it seems i still can't spell
Last edited by TRocket (2011-12-27 06:20:21)
Offline
TRocket wrote:
nickbrickmaster wrote:
TRocket wrote:
i'll post it soon, please give credit if you use it.Sure.
javadoc
library (jar)
scratch.TRocket.ScratchRemoteSonsorConnetions
yes it is sonsor since it seems i still can't spell![]()
Could you just post the code in a post? I just am kind've a virus-phobe. sorry.
Offline
ok 184 lines of code and javadoc:
package scratch.TRocket.ScratchRemoteSonsorConnections;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
/**
* for connecting to the scratch program at scratch.mit.edu which uses the remote sensor connections protocol
* @author TRocket
*
*
* @version 1.0 - 1.4/1.4.1/1.3
*/
public class ScratchRemoteSensorConnection{
/**
* the socket connected to scratch
*/
private Socket scratchSocket;
//int lastread = 0;
//Socket scratchSocket = new Socket();
/**
* Connects to scratch running remotely/locally on the default port:42001
* @author TRocket
* @param host the hostname/ip of the computer running scratch to connect to
* @throws Exception
*/
public ScratchRemoteSensorConnection(String host) throws IOException{//constructor
try {
scratchSocket = new Socket(host, 42001);
} catch (IOException e) {
throw e;
}
}
/**
* Connects to scratch running remotely/locally on the specified port
* @author TRocket
* @param host hostname/ip of the computer running scratch to connect to
* @param port port scratch is listening on
* @throws IOException
*/
public ScratchRemoteSensorConnection(String host, int port) throws IOException{//constructor
try {
scratchSocket = new Socket(host, port);
} catch (IOException e) {
throw e;
}
}
/**
* Connects to scratch running locally on the default port:42001
* @author TRocket
* @throws IOException
*/
public ScratchRemoteSensorConnection() throws IOException{//constructor
try {
scratchSocket = new Socket("127.0.0.1", 42001);
} catch (IOException e) {
throw e;
}
}
/**
* send the message
* @author TRocket
* @param message the message to be sent
* @throws Exception
*/
public void send(String message) throws IOException{//write
PrintWriter out;
try {
out = new PrintWriter(scratchSocket.getOutputStream());
int[] tosend = new int[4];
int[] tosend2 = new int[message.length()];
tosend[0] =(byte)( message.length() >> 24 );
tosend[1] =(byte)( (message.length() << 8) >> 24 );
tosend[2] =(byte)( (message.length() << 16) >> 24 );
tosend[3] =(byte)( (message.length() << 24) >> 24 );
for (int i = 0; i < message.length(); i++) {
tosend2[i] = message.charAt(i);
}
for (int i = 0; i < tosend2.length; i++) {
//System.out.println(tosend2[i]);
}
for (int i = 0; i < tosend.length; i++) {
out.write(tosend[i]);
}
for (int i = 0; i < tosend2.length; i++) {
out.write(tosend2[i]);
}
out.flush();
} catch (IOException e) {
throw e;
}
}
/**
* reads next massage:
* <br>
* broadcast "broadcast name"
* <br>
* sensor-update "variable/sensor name" "value"
* <br>
* <br>
* locks thread until message recived
* @author TRocket
* @return the read message
* @throws IOException
* @throws Exception
*/
public String read() throws IOException {
BufferedInputStream in;
try {
in = new BufferedInputStream(scratchSocket.getInputStream());
int[] bytes = new int[4];
bytes[0] = in.read();
bytes[1] = in.read();
bytes[2] = in.read();
bytes[3] = in.read();
int length = bytes[0] + bytes[1] + bytes[2] + bytes[3];
int[] bytes2 = new int[length];
for (int i = 0; i < bytes2.length; i++) {
bytes2[i] = in.read();
}
for (int i = 0; i < bytes2.length; i++) {
}
String out = null;
char outCurrent = (char)bytes2[0];
out = Character.toString(outCurrent);
for (int i = 1; i < bytes2.length; i++) {
outCurrent = (char)bytes2[i];
out = out + Character.toString(outCurrent);
}
return out;
} catch (java.net.SocketException e) {
throw e;
} catch (IOException e) {
throw e;
}
}
/**
* broadcasts the broadcast with the specified name
* @author TRocket
* @param broadcastName the name of the broadcast to be sent
* @throws Exception
*/
public void broadcast(String broadcastName) throws Exception{//broadcast
this.send("broadcast \"" + broadcastName + "\"");
}
/**
* updates the specified sensor value
* @author TRocket
* @param sensorName name of the sensor to update
* @param value the value to update the sensor to
* @throws Exception
*/
public void sensorupdate(String sensorName, String value) throws Exception{
this.send("sensor-update \"" + sensorName + "\" " + value + " ");
}
//private void error(Exception e) throws Exception{
// throw e;
//}
/**
* @author TRocket
* @return weather this Connection is connected
*/
public boolean connected(){
try{
return scratchSocket.isConnected();
}catch(NullPointerException e){return false;}
}
}Offline
ZeroLuck wrote:
TRocket wrote:
ok 184 lines of code and javadoc:
[...]You are new to Java, aren't you?
Because it looks so![]()
used it a bit for four years , what's wrong with it?
Last edited by TRocket (2011-12-27 13:17:49)
Offline
TRocket wrote:
ok 184 lines of code and javadoc:
Code:
package scratch.TRocket.ScratchRemoteSonsorConnections; import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; /** * for connecting to the scratch program at scratch.mit.edu which uses the remote sensor connections protocol * @author TRocket * * * @version 1.0 - 1.4/1.4.1/1.3 */ public class ScratchRemoteSensorConnection{ /** * the socket connected to scratch */ private Socket scratchSocket; //int lastread = 0; //Socket scratchSocket = new Socket(); /** * Connects to scratch running remotely/locally on the default port:42001 * @author TRocket * @param host the hostname/ip of the computer running scratch to connect to * @throws Exception */ public ScratchRemoteSensorConnection(String host) throws IOException{//constructor try { scratchSocket = new Socket(host, 42001); } catch (IOException e) { throw e; } } /** * Connects to scratch running remotely/locally on the specified port * @author TRocket * @param host hostname/ip of the computer running scratch to connect to * @param port port scratch is listening on * @throws IOException */ public ScratchRemoteSensorConnection(String host, int port) throws IOException{//constructor try { scratchSocket = new Socket(host, port); } catch (IOException e) { throw e; } } /** * Connects to scratch running locally on the default port:42001 * @author TRocket * @throws IOException */ public ScratchRemoteSensorConnection() throws IOException{//constructor try { scratchSocket = new Socket("127.0.0.1", 42001); } catch (IOException e) { throw e; } } /** * send the message * @author TRocket * @param message the message to be sent * @throws Exception */ public void send(String message) throws IOException{//write PrintWriter out; try { out = new PrintWriter(scratchSocket.getOutputStream()); int[] tosend = new int[4]; int[] tosend2 = new int[message.length()]; tosend[0] =(byte)( message.length() >> 24 ); tosend[1] =(byte)( (message.length() << 8) >> 24 ); tosend[2] =(byte)( (message.length() << 16) >> 24 ); tosend[3] =(byte)( (message.length() << 24) >> 24 ); for (int i = 0; i < message.length(); i++) { tosend2[i] = message.charAt(i); } for (int i = 0; i < tosend2.length; i++) { //System.out.println(tosend2[i]); } for (int i = 0; i < tosend.length; i++) { out.write(tosend[i]); } for (int i = 0; i < tosend2.length; i++) { out.write(tosend2[i]); } out.flush(); } catch (IOException e) { throw e; } } /** * reads next massage: * <br> * broadcast "broadcast name" * <br> * sensor-update "variable/sensor name" "value" * <br> * <br> * locks thread until message recived * @author TRocket * @return the read message * @throws IOException * @throws Exception */ public String read() throws IOException { BufferedInputStream in; try { in = new BufferedInputStream(scratchSocket.getInputStream()); int[] bytes = new int[4]; bytes[0] = in.read(); bytes[1] = in.read(); bytes[2] = in.read(); bytes[3] = in.read(); int length = bytes[0] + bytes[1] + bytes[2] + bytes[3]; int[] bytes2 = new int[length]; for (int i = 0; i < bytes2.length; i++) { bytes2[i] = in.read(); } for (int i = 0; i < bytes2.length; i++) { } String out = null; char outCurrent = (char)bytes2[0]; out = Character.toString(outCurrent); for (int i = 1; i < bytes2.length; i++) { outCurrent = (char)bytes2[i]; out = out + Character.toString(outCurrent); } return out; } catch (java.net.SocketException e) { throw e; } catch (IOException e) { throw e; } } /** * broadcasts the broadcast with the specified name * @author TRocket * @param broadcastName the name of the broadcast to be sent * @throws Exception */ public void broadcast(String broadcastName) throws Exception{//broadcast this.send("broadcast \"" + broadcastName + "\""); } /** * updates the specified sensor value * @author TRocket * @param sensorName name of the sensor to update * @param value the value to update the sensor to * @throws Exception */ public void sensorupdate(String sensorName, String value) throws Exception{ this.send("sensor-update \"" + sensorName + "\" " + value + " "); } //private void error(Exception e) throws Exception{ // throw e; //} /** * @author TRocket * @return weather this Connection is connected */ public boolean connected(){ try{ return scratchSocket.isConnected(); }catch(NullPointerException e){return false;} } }
thanks man. huge credit.
Offline
nickbrickmaster wrote:
TRocket wrote:
ok 184 lines of code and javadoc:
Code:
package scratch.TRocket.ScratchRemoteSonsorConnections; import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; /** * for connecting to the scratch program at scratch.mit.edu which uses the remote sensor connections protocol * @author TRocket * * * @version 1.0 - 1.4/1.4.1/1.3 */ public class ScratchRemoteSensorConnection{ /** * the socket connected to scratch */ private Socket scratchSocket; //int lastread = 0; //Socket scratchSocket = new Socket(); /** * Connects to scratch running remotely/locally on the default port:42001 * @author TRocket * @param host the hostname/ip of the computer running scratch to connect to * @throws Exception */ public ScratchRemoteSensorConnection(String host) throws IOException{//constructor try { scratchSocket = new Socket(host, 42001); } catch (IOException e) { throw e; } } /** * Connects to scratch running remotely/locally on the specified port * @author TRocket * @param host hostname/ip of the computer running scratch to connect to * @param port port scratch is listening on * @throws IOException */ public ScratchRemoteSensorConnection(String host, int port) throws IOException{//constructor try { scratchSocket = new Socket(host, port); } catch (IOException e) { throw e; } } /** * Connects to scratch running locally on the default port:42001 * @author TRocket * @throws IOException */ public ScratchRemoteSensorConnection() throws IOException{//constructor try { scratchSocket = new Socket("127.0.0.1", 42001); } catch (IOException e) { throw e; } } /** * send the message * @author TRocket * @param message the message to be sent * @throws Exception */ public void send(String message) throws IOException{//write PrintWriter out; try { out = new PrintWriter(scratchSocket.getOutputStream()); int[] tosend = new int[4]; int[] tosend2 = new int[message.length()]; tosend[0] =(byte)( message.length() >> 24 ); tosend[1] =(byte)( (message.length() << 8) >> 24 ); tosend[2] =(byte)( (message.length() << 16) >> 24 ); tosend[3] =(byte)( (message.length() << 24) >> 24 ); for (int i = 0; i < message.length(); i++) { tosend2[i] = message.charAt(i); } for (int i = 0; i < tosend2.length; i++) { //System.out.println(tosend2[i]); } for (int i = 0; i < tosend.length; i++) { out.write(tosend[i]); } for (int i = 0; i < tosend2.length; i++) { out.write(tosend2[i]); } out.flush(); } catch (IOException e) { throw e; } } /** * reads next massage: * <br> * broadcast "broadcast name" * <br> * sensor-update "variable/sensor name" "value" * <br> * <br> * locks thread until message recived * @author TRocket * @return the read message * @throws IOException * @throws Exception */ public String read() throws IOException { BufferedInputStream in; try { in = new BufferedInputStream(scratchSocket.getInputStream()); int[] bytes = new int[4]; bytes[0] = in.read(); bytes[1] = in.read(); bytes[2] = in.read(); bytes[3] = in.read(); int length = bytes[0] + bytes[1] + bytes[2] + bytes[3]; int[] bytes2 = new int[length]; for (int i = 0; i < bytes2.length; i++) { bytes2[i] = in.read(); } for (int i = 0; i < bytes2.length; i++) { } String out = null; char outCurrent = (char)bytes2[0]; out = Character.toString(outCurrent); for (int i = 1; i < bytes2.length; i++) { outCurrent = (char)bytes2[i]; out = out + Character.toString(outCurrent); } return out; } catch (java.net.SocketException e) { throw e; } catch (IOException e) { throw e; } } /** * broadcasts the broadcast with the specified name * @author TRocket * @param broadcastName the name of the broadcast to be sent * @throws Exception */ public void broadcast(String broadcastName) throws Exception{//broadcast this.send("broadcast \"" + broadcastName + "\""); } /** * updates the specified sensor value * @author TRocket * @param sensorName name of the sensor to update * @param value the value to update the sensor to * @throws Exception */ public void sensorupdate(String sensorName, String value) throws Exception{ this.send("sensor-update \"" + sensorName + "\" " + value + " "); } //private void error(Exception e) throws Exception{ // throw e; //} /** * @author TRocket * @return weather this Connection is connected */ public boolean connected(){ try{ return scratchSocket.isConnected(); }catch(NullPointerException e){return false;} } }thanks man. huge credit.
you're welcome
Offline
Download link?


Offline
cocolover76 wrote:
Download link?
lawl its far from done.
Offline
TRocket wrote:
please can I help with the development of the mod?
Sure! I can't really upload, but if you know squeak well and have some ideas for blocks, then you could post the code.
Offline
- added konnect menu
- changed title
- added 6 new sensing blocks
- that's all really...
hope you like it
download the scratch source and replace these files:
http://www.sendspace.com/filegroup/pK34 … 9yN84t1zRg
Last edited by TRocket (2011-12-28 09:09:49)
Offline
TRocket wrote:
- added konnect menu
- changed title
- added 6 new sensing blocks
- that's all really...
hope you like it![]()
download the scratch source and replace these files:
http://www.sendspace.com/filegroup/pK34 … 9yN84t1zRg
I already started, sorry. can you just post the code and blockspecs? I'm sorry for being such a hassle.
Offline