slinger wrote:
.class doesn't work on my machine...
What do you mean? Navigate to the directory, then do "java philosoraptor" or make the .bat file.
Offline
slinger wrote:
What do you mean by do "java philosoraptor"?
in command prompt. do "cd <directory>" until you get to the place you downloaded the files, then use the command "java philosoraptor" to run the file.
Offline
just scrape through with 184 lines:
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;}
}
}scratch java connector please give credit if you use it.
Offline
I got mad at a kid at school today, so I opened up Notepad and made a bit of a "trolololol" virus that would crash his computer. I named it Medal of Duty so it would look legit
start Medal of Duty.bat @echo off echo WARNING WARNING VIRUS DETECTED Medal of Duty.bat
It opens, says WARNING WARNING VIRUS DETECTED, then keeps duplicating itself until it crashes your pc
Offline
bananaman99 wrote:
I got mad at a kid at school today, so I opened up Notepad and made a bit of a "trolololol" virus that would crash his computer. I named it Medal of Duty so it would look legit
![]()
Code:
start Medal of Duty.bat @echo off echo WARNING WARNING VIRUS DETECTED Medal of Duty.batIt opens, says WARNING WARNING VIRUS DETECTED, then keeps duplicating itself until it crashes your pc
![]()
Lol I've done that before!
Offline
bananaman99 wrote:
I got mad at a kid at school today, so I opened up Notepad and made a bit of a "trolololol" virus that would crash his computer. I named it Medal of Duty so it would look legit
![]()
Code:
start Medal of Duty.bat @echo off echo WARNING WARNING VIRUS DETECTED Medal of Duty.batIt opens, says WARNING WARNING VIRUS DETECTED, then keeps duplicating itself until it crashes your pc
![]()
Heres one for linux/mac
#!/bin/sh # virus.sh echo "ERROR virus detected" ./virus.sh
Offline
I recreated Pong with exactly 335 lines of java code, link is over in the official topic.
Offline
I added a few lines to my chatbot and I'll share the code now.
@echo off cls echo The Rdococian Chatbot title The Rdococian Chatbot - Start echo Press any key to chat... pause > null set msg="Hey there! What should we talk about?" cls echo Please login... set /p username="Username: " cls goto chat :chat title The Rdococian Chatbot - Chatting echo Computer: %msg% set /p chat="%username%: " set chat="%chat%" set oldmsg=%msg% if /i %chat%=="hello" set msg="What should we talk about?" if /i %chat%=="hi" set msg="Hey there! Who are you?" if /i %chat%=="hey" set msg="Hello! What should we talk about?" if /i %chat%=="lets talk about scratch" set msg="Oh, I love that application!" if /i %chat%=="i love it too" set msg="Cool. So what else?" if /i %chat%=="yes" set msg="Cool!" if /i %chat%=="go on scratch" set msg="Go on it! Yeah!" if /i %chat%=="lol" set msg="Hehehe, lol." if /i %chat%=="rofl" set msg="Haha... LOL!!!" if /i %chat%=="youre weird" set msg="So hilarious." if /i %chat%=="youre crazy" set msg="So are you! Lol." if /i %chat%=="scratch is bab" set msg="Go away!" if /i %chat%=="i hate scratch" set msg="..." if /i %chat%=="i dislike scratch" set msg="I love Scratch, but I respect your opinion." if /i %chat%=="i like scratch" set msg="I don't like it. Instead, I love it." if /i %chat%=="scratch is lovely" set msg="It and you is lovely too!" if /i %chat%=="bye" set msg="See you soon!" if /i %chat%=="goodbye" set msg="Cya. Out the door you go..." if /i %chat%=="*" set msg="Huh? What is weird?" if /i %chat%=="i love scratch" set msg="So do I!" if /i %chat%=="lolwut" set msg="Very funny, isn't it?" if /i %chat%=="hehe" set msg="...lol." if /i %chat%=="haha" set msg="Hahaha! It is so funny!" if /i %chat%=="scratch" set msg="I love Scratch!" if /i %chat%=="so do i" set msg="Cool!" if /i %chat%=="i love squeak" set msg="Squeak is the best programming language in the world!" if /i %chat%=="i like squeak" set msg="I agree. But I love it, not like it." if /i %chat%=="i hate squeak" set msg="Hate is a strong word, but I respect your opinion." if /i %chat%=="i dislike squeak" set msg="I like Squeak, but I respect your opinion." if /i %chat%=="i agree" set msg="Cool." if /i %chat%=="i disagree" set msg="Still cool. xP" if /i %chat%=="go on squeak" set msg="I might." if /i %chat%=="i love smalltalk" set msg="I don't really go on Smalltalk..." if /i %chat%=="i like smalltalk" set msg="I don't know Smalltalk syntax, I don't program on it." if /i %chat%=="i hate smalltalk" set msg="Hate is a strong word, but I don't use it anyway." if /i %chat%=="i dislike smalltalk" set msg="I don't use Smalltalk." if /i %chat%=="go on smalltalk" set msg="I might." if /i %msg%==%oldmsg% set msg="Huh? I said... %oldmsg%. Or did you repeat what you said?" goto chat
Oh? Something weird with my computer. Oh, it's just a client-side error that occured. The text blanked out, it's just an error.
Last edited by rdococ (2012-03-01 06:01:58)
Offline
Sorry, it was a client-side error with my computer. Nothing server-side.
Offline
I updated my code! It can now log chat history in a specified file.
I also added a few more sentences that the bot can understand.
@echo off cls set logs=0 echo The Rdococian Chatbot title The Rdococian Chatbot - Start echo Press any key to chat... pause > null set msg="Hey there! What should we talk about?" cls echo Please login... set /p username="Username: " cls goto chat :chat title The Rdococian Chatbot - Chatting echo Computer: %msg% set /p chat="%username%: " set chat="%chat%" set oldmsg=%msg% if /i %chat%=="hello" set msg="What should we talk about?" if /i %chat%=="hi" set msg="Hey there! Who are you?" if /i %chat%=="hey" set msg="Hello! What should we talk about?" if /i %chat%=="lets talk about scratch" set msg="Oh, I love that application!" if /i %chat%=="i love it too" set msg="Cool. So what else?" if /i %chat%=="yes" set msg="Cool!" if /i %chat%=="go on scratch" set msg="Go on it! Yeah!" if /i %chat%=="lol" set msg="Hehehe, lol." if /i %chat%=="rofl" set msg="Haha... LOL!!!" if /i %chat%=="youre weird" set msg="So hilarious." if /i %chat%=="youre crazy" set msg="So are you! Lol." if /i %chat%=="scratch is bab" set msg="Go away!" if /i %chat%=="i hate scratch" set msg="..." if /i %chat%=="i dislike scratch" set msg="I love Scratch, but I respect your opinion." if /i %chat%=="i like scratch" set msg="I don't like it. Instead, I love it." if /i %chat%=="scratch is lovely" set msg="It and you is lovely too!" if /i %chat%=="bye" set msg="See you soon!" if /i %chat%=="goodbye" set msg="Cya. Out the door you go..." if /i %chat%=="*" set msg="Huh? What is weird?" if /i %chat%=="i love scratch" set msg="So do I!" if /i %chat%=="lolwut" set msg="Very funny, isn't it?" if /i %chat%=="hehe" set msg="...lol." if /i %chat%=="haha" set msg="Hahaha! It is so funny!" if /i %chat%=="scratch" set msg="I love Scratch!" if /i %chat%=="squeak" set msg="I love Squeak!" if /i %chat%=="smalltalk" set msg="I don't go on Smalltalk." if /i %chat%=="go on java" set msg="No thank you." if /i %chat%=="i love java" set msg="I don't go on Java..." if /i %chat%=="i like java" set msg="I don't know Java syntax, I don't program on it." if /i %chat%=="i hate java" set msg="Hate is a strong word, but I don't use it anyway." if /i %chat%=="i dislike java" set msg="I don't use Java." if /i %chat%=="so do i" set msg="Cool!" if /i %chat%=="i love squeak" set msg="Squeak is the best programming language in the world!" if /i %chat%=="i like squeak" set msg="I agree. But I love it, not like it." if /i %chat%=="i hate squeak" set msg="Hate is a strong word, but I respect your opinion." if /i %chat%=="i dislike squeak" set msg="I like Squeak, but I respect your opinion." if /i %chat%=="i agree" set msg="Cool." if /i %chat%=="i disagree" set msg="Still cool. xP" if /i %chat%=="go on squeak" set msg="I might." if /i %chat%=="i love smalltalk" set msg="I don't really go on Smalltalk..." if /i %chat%=="i like smalltalk" set msg="I don't know Smalltalk syntax, I don't program on it." if /i %chat%=="i hate smalltalk" set msg="Hate is a strong word, but I don't use it anyway." if /i %chat%=="i dislike smalltalk" set msg="I don't use Smalltalk." if /i %chat%=="go on smalltalk" set msg="I might." if /i %chat%=="!help" goto help if /i %chat%=="!log" goto log if /i %msg%==%oldmsg% set msg="Huh? I said... %oldmsg%. Or did you repeat what you said?" if /i %logs%==1 goto logtest :logtest if exist %logsname% echo Computer: %msg% >> %logsname% if not exist %logsname% echo Computer: %msg% > %logsname% goto chat :help cls echo Rdococian Chatbot Help echo. echo Talk about your favourite echo programming language, whether echo it be Scratch, Smalltalk, echo or Squeak! I am implementing echo talking about Java too. pause cls goto chat :log if %logs%==0 set logs=1 & set /p logsname="File to place log in:" if %logs%==1 set logs=0 echo Logging successifully toggled. pause cls goto chat
Offline
I updated it AGAIN to show what the user says in the log.
@echo off cls set logs=0 echo The Rdococian Chatbot title The Rdococian Chatbot - Start echo Press any key to chat... pause > null set msg="Hey there! What should we talk about?" cls echo Please login... set /p username="Username: " cls goto chat :chat title The Rdococian Chatbot - Chatting echo Computer: %msg% set /p chat="%username%: " set chat="%chat%" set oldmsg=%msg% if /i %chat%=="hello" set msg="What should we talk about?" if /i %chat%=="hi" set msg="Hey there! Who are you?" if /i %chat%=="hey" set msg="Hello! What should we talk about?" if /i %chat%=="lets talk about scratch" set msg="Oh, I love that application!" if /i %chat%=="i love it too" set msg="Cool. So what else?" if /i %chat%=="yes" set msg="Cool!" if /i %chat%=="go on scratch" set msg="Go on it! Yeah!" if /i %chat%=="lol" set msg="Hehehe, lol." if /i %chat%=="rofl" set msg="Haha... LOL!!!" if /i %chat%=="youre weird" set msg="So hilarious." if /i %chat%=="youre crazy" set msg="So are you! Lol." if /i %chat%=="scratch is bab" set msg="Go away!" if /i %chat%=="i hate scratch" set msg="..." if /i %chat%=="i dislike scratch" set msg="I love Scratch, but I respect your opinion." if /i %chat%=="i like scratch" set msg="I don't like it. Instead, I love it." if /i %chat%=="scratch is lovely" set msg="It and you is lovely too!" if /i %chat%=="bye" set msg="See you soon!" if /i %chat%=="goodbye" set msg="Cya. Out the door you go..." if /i %chat%=="*" set msg="Huh? What is weird?" if /i %chat%=="i love scratch" set msg="So do I!" if /i %chat%=="lolwut" set msg="Very funny, isn't it?" if /i %chat%=="hehe" set msg="...lol." if /i %chat%=="haha" set msg="Hahaha! It is so funny!" if /i %chat%=="scratch" set msg="I love Scratch!" if /i %chat%=="squeak" set msg="I love Squeak!" if /i %chat%=="smalltalk" set msg="I don't go on Smalltalk." if /i %chat%=="go on java" set msg="No thank you." if /i %chat%=="i love java" set msg="I don't go on Java..." if /i %chat%=="i like java" set msg="I don't know Java syntax, I don't program on it." if /i %chat%=="i hate java" set msg="Hate is a strong word, but I don't use it anyway." if /i %chat%=="i dislike java" set msg="I don't use Java." if /i %chat%=="so do i" set msg="Cool!" if /i %chat%=="i love squeak" set msg="Squeak is the best programming language in the world!" if /i %chat%=="i like squeak" set msg="I agree. But I love it, not like it." if /i %chat%=="i hate squeak" set msg="Hate is a strong word, but I respect your opinion." if /i %chat%=="i dislike squeak" set msg="I like Squeak, but I respect your opinion." if /i %chat%=="i agree" set msg="Cool." if /i %chat%=="i disagree" set msg="Still cool. xP" if /i %chat%=="go on squeak" set msg="I might." if /i %chat%=="i love smalltalk" set msg="I don't really go on Smalltalk..." if /i %chat%=="i like smalltalk" set msg="I don't know Smalltalk syntax, I don't program on it." if /i %chat%=="i hate smalltalk" set msg="Hate is a strong word, but I don't use it anyway." if /i %chat%=="i dislike smalltalk" set msg="I don't use Smalltalk." if /i %chat%=="go on smalltalk" set msg="I might." if /i %chat%=="!help" goto help if /i %chat%=="!log" goto log if /i %msg%==%oldmsg% set msg="Huh? I said... %oldmsg%. Or did you repeat what you said?" if /i %logs%==1 goto logtest :logtest if exist %logsname% echo You: %chat% >> %logsname% if not exist %logsname% echo You: %chat% > %logsname% if exist %logsname% echo Computer: %msg% >> %logsname% if not exist %logsname% echo Computer: %msg% > %logsname% goto chat :help cls echo Rdococian Chatbot Help echo. echo Talk about your favourite echo programming language, whether echo it be Scratch, Smalltalk, echo or Squeak! I am implementing echo talking about Java too. pause cls goto chat :log if %logs%==0 set logs=1 & set /p logsname="File to place log in:" if %logs%==1 set logs=0 echo Logging successifully toggled. pause cls goto chat
Offline
bananaman99 wrote:
I got mad at a kid at school today, so I opened up Notepad and made a bit of a "trolololol" virus that would crash his computer. I named it Medal of Duty so it would look legit
![]()
Code:
start Medal of Duty.bat @echo off echo WARNING WARNING VIRUS DETECTED Medal of Duty.batIt opens, says WARNING WARNING VIRUS DETECTED, then keeps duplicating itself until it crashes your pc
![]()
Make it do 4 more medal of duty.bat launches before re-iterating, it duplicates at exponents of 4 then (4 programs, 16, 64, 256, 1024...)
Yeah, fastcrash.
Offline
slinger wrote:
Really old AI chat bot I just fixed up, it's called "learnbot".
Code:
program LearnBot; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes { you can add units after this }; {$R *.res} procedure spacer; // creates a space begin writeln; writeln; end; procedure intro; // feel free to edit :P begin writeln('LearnBot is currently under development by Slinger.'); end; procedure instructions; begin writeln('This is LearnBot a chatbot AI.'); writeln('Type "teach" to teach me something and type "wipe" to clear my memory'); writeln('Press <Enter> to continue'); readln; end; var command: string; wipe: integer; teachLoop: integer; lookUpLoop: integer; phraseMemory: array[1..100] of string; responseMemory: array[1..100] of string; begin intro; spacer; instructions; spacer; teachLoop := 1; repeat write('Command: '); readln(command); if command = 'wipe' then //wipes the memory begin wipe := 1; repeat phraseMemory[wipe] := ''; responseMemory[wipe] := ''; wipe := wipe + 1; until wipe > 100 ; writeln('Memory wiped.'); teachLoop := 1; end; if command = 'teach' then begin write('Teach me what? '); readln(phraseMemory[teachLoop]); write('How should I respond? '); readln(responseMemory[teachLoop]); writeln; teachLoop := teachLoop + 1; end else begin lookUpLoop := 0; repeat lookUpLoop := lookUpLoop + 1; until (command = phraseMemory[lookUpLoop]) or (lookUpLoop > 101); writeln(responseMemory[lookUpLoop]); end; until command = 'done'; end.If you want the program it's on sourceforge (the fixed up one) right here.
Offline
bananaman99 wrote:
I got mad at a kid at school today, so I opened up Notepad and made a bit of a "trolololol" virus that would crash his computer. I named it Medal of Duty so it would look legit
![]()
Code:
start Medal of Duty.bat @echo off echo WARNING WARNING VIRUS DETECTED Medal of Duty.batIt opens, says WARNING WARNING VIRUS DETECTED, then keeps duplicating itself until it crashes your pc
![]()
i ran this and had to plug it out xD
Offline