This is the official forum page for ScratchChat, a global chat/IM program under development using a slightly modified version of Panther.
Scratch chat has different channels, which let you have private chats with friends. All you have to do is tell it what channel to use, and it will automatically create it if it is not in use, or join it if it is.
Also, for privacy reasons, the source code of ScratchChat will most likely NOT be released, as this would make it easy for people to hack into the systems.
This project uses escratch.org for functions such as update downloads and news.
The interface for ScratchChat is fairly similar to the interface for my project iChat,which uses scratch's mesh feature to chat.
To use ScratchChat, you NEED a scratch account. It will ask you for the username and password, but I can GUARANTEE that it does NOT store your password AT ALL. The only reason I require Scratch accounts is so that the server does not become overloaded with non-Scratchers. Your username will be shown upon entry to rooms and beside messages when you chat.
Current version: 1.2 - available NOW!
Available Downloads:
Main downloads
Version 1.1 (Dropbox)
Download!
Version 1.2 (Dropbox)
Download!
Version 1.3 BETA (N/A)
Available through auto-updater. Please give feedback!
Source code
Version 1.2 source* (Dropbox)
Download!
*In source versions, certain blocks are omitted for one of two reasons. 1) You need a modified version of Panther or it will be obsolete 2) They have been replaced to protect privacy. This means that they will not function, causing errors instead.
Users in the collabortation:
gbear605 (site management, php and panther programming, help with Mac versions)
dominic1 (site management, panther programming, forum thread manager)
Planned Features and Changelog
v1.1 (old)
-First public release
-Added private messages
-Fixed some bugs
v1.2
-escratch.org integration
--Automatic updates
-Updates will clear and reset config file
-Minor bugfixes
-Also, I changed the icon from the Bingo icon to a chat bubble!
v1.3 (available as beta)
-A chance to try out that brand new auto-updater in v1.2!
-COMPLETELY scrapping the config file system - more on this after release
-You will be prompted as to what channel you want to join after login
We are currently looking for anyone who would like to offer help-weather it be php coding to the actual Panther coding or even just ideas and suggestions
If you would like to help, please email me at scratchchatcolab@gmail.com-Please be sure to put your Scratch username!
Last edited by Dominic1 (2011-11-26 10:45:47)
Offline
I'm making something like this in Scratch! (You need mesh enabled.)
Offline
Claw can do this easy... here
Offline
^^ Yes. I once made a chat in Claw. ^^
Offline
johnnydean1 wrote:
Claw can do this easy... here
I'll try it!
I tried using your MySQL blocks in the block library, but the website was blocked by my antivirus. Can you help me recode ot for another MySQL server?
Offline
Yes, I have the code.. I will post here...
Offline
set.php
<title>Scratch-Live <?php
$title = 'Variables';
echo($title);?></title>
<?php
$SQLhost = "xxx";
$SQLuser = "xxx";
$SQLpass = "xxx";
$SQLdatabase = "xxx";
$SQLtable = "xxx";
$con = mysql_connect($SQLhost,$SQLuser,$SQLpass);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
echo "Database Connected";
echo "<br />";
$user = $_GET["user"];
$pass = $_GET["pass"];
$value = $_GET["value"];
echo $user;
echo "<br />";
echo $pass;
echo "<br />";
echo $value;
echo "<br />";
if ($pass == 1)
{
$val = strlen($value);
if ($val > 0)
{
echo "Acting on request";
$act = "set";
}
else
{
echo "Getting request";
$act = "get";
}
echo "<br />";
//**************************
//******DATABASE STUFF******
//**************************
mysql_select_db($SQLdatabase, $con);
if(1==0)
{
$sql = "CREATE TABLE" . $SQLtable. "
(
Username varchar(20),
Value varchar(20),
)";
mysql_query($sql,$con);
echo "<br />";
echo "Table made";
echo "<br />";
}
$you = "
SELECT *
FROM Users";
$you4 = $you;
$result = mysql_query($you4)
or die(mysql_error());
$n = 0;
$get = "";
$x = 0;
while($row = mysql_fetch_array($result))
{
$x = $x + 1;
$you = $row['Username'];
if ($you == $user)
{
$n = $x;
if ($act == "get")
{
$get = $row['Value'];
}
}
}
if ($n==0)
{
$you = "INSERT INTO ";
$you2 = $SQLtable;
$you3 = " (Username, Value)";
$you = $you . $you2 .$you3;
$you2 = ",";
$you3 = ")";
$you4 = "'";
$you5 = " VALUES (";
$query = $you . $you5 . $you4. $user . $you4 . $you2 . $you4. $value. $you4. $you3;
mysql_query($query);
}
echo "<br />";
echo "\n";
if ($act == "get")
{
echo $get;
}
if ($act == "set")
{
$you = "UPDATE ";
$you2 = $SQLtable;
$you3 = " SET Value = '";
$you = $you . $you2 .$you3 . $value;
$you2 = "' WHERE Username = '";
$you3 = $user;
$you4 = "'";
$query = $you . $you2 . $you3 . $you4;
mysql_query($query);
echo "Updated";
}
}
mysql_close($con);
?>Offline
Replace the "xxx" with your info. BTW even though it is called set.php it can get and set variables (See code in block library)
Offline
clear.php (WILL CLEAR ALL RESULTS WHEN ACCESSED)
<title>Scratch Live - <?php
$title = 'Clear all';
echo($title);?></title>
<?php
$run = $_GET["clear"];
if ($run == 1)
{
$SQLhost = "xxx";
$SQLuser = "xxx";
$SQLpass = "xxx";
$SQLdatabase = "xxx";
$SQLtable = "xxx";
$con = mysql_connect($SQLhost,$SQLuser,$SQLpass);
mysql_select_db($SQLdatabase, $con);
$query1 = "DELETE FROM ";
$query2 = $SQLtable;
$query4 = $query1 . $query2;
$result = mysql_query($query4);
mysql_close($con);
echo "table ";
echo $SQLtable;
echo " cleared";
}
?>Last edited by johnnydean1 (2011-06-13 15:54:24)
Offline
just a little tip:
When using die() you don't need to check if the previous thing gave a result, you can just use or die.
for example in set.php you put:
$con = mysql_connect($SQLhost,$SQLuser,$SQLpass);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}if writing it how I suggest you put it:
$con = mysql_connect($SQLhost,$SQLuser,$SQLpass) or die('Could not connect: ' . mysql_error());(I could be completely wrong but I think thats how you do it)
Offline
Well this is my style of coding PHP, same as I have my own way of coding JavaScript.
Offline
johnnydean1 wrote:
set.php
Code:
<title>Scratch-Live <?php $title = 'Variables'; echo($title);?></title> <?php $SQLhost = "xxx"; $SQLuser = "xxx"; $SQLpass = "xxx"; $SQLdatabase = "xxx"; $SQLtable = "xxx"; $con = mysql_connect($SQLhost,$SQLuser,$SQLpass); if (!$con) { die('Could not connect: ' . mysql_error()); } echo "Database Connected"; echo "<br />"; $user = $_GET["user"]; $pass = $_GET["pass"]; $value = $_GET["value"]; echo $user; echo "<br />"; echo $pass; echo "<br />"; echo $value; echo "<br />"; if ($pass == 1) { $val = strlen($value); if ($val > 0) { echo "Acting on request"; $act = "set"; } else { echo "Getting request"; $act = "get"; } echo "<br />"; //************************** //******DATABASE STUFF****** //************************** mysql_select_db($SQLdatabase, $con); if(1==0) { $sql = "CREATE TABLE" . $SQLtable. " ( Username varchar(20), Value varchar(20), )"; mysql_query($sql,$con); echo "<br />"; echo "Table made"; echo "<br />"; } $you = " SELECT * FROM Users"; $you4 = $you; $result = mysql_query($you4) or die(mysql_error()); $n = 0; $get = ""; $x = 0; while($row = mysql_fetch_array($result)) { $x = $x + 1; $you = $row['Username']; if ($you == $user) { $n = $x; if ($act == "get") { $get = $row['Value']; } } } if ($n==0) { $you = "INSERT INTO "; $you2 = $SQLtable; $you3 = " (Username, Value)"; $you = $you . $you2 .$you3; $you2 = ","; $you3 = ")"; $you4 = "'"; $you5 = " VALUES ("; $query = $you . $you5 . $you4. $user . $you4 . $you2 . $you4. $value. $you4. $you3; mysql_query($query); } echo "<br />"; echo "\n"; if ($act == "get") { echo $get; } if ($act == "set") { $you = "UPDATE "; $you2 = $SQLtable; $you3 = " SET Value = '"; $you = $you . $you2 .$you3 . $value; $you2 = "' WHERE Username = '"; $you3 = $user; $you4 = "'"; $query = $you . $you2 . $you3 . $you4; mysql_query($query); echo "Updated"; } } mysql_close($con); ?>
Thx for the code. What directories/files would I need to make, though? In the blocks it says the website is "scratchlive.xtreemhost.com", but I know that there is probably more than just one php page for this...
Offline
Nope just one .php page and a SQL server.
Offline
Dominic1 wrote:
johnnydean1 wrote:
Nope just one .php page and a SQL server.
Ok- So if the php file is at escratch.org/scratchchat/, I just put that exact URL in the block coding?
I'm working on it, and I already got this part down.
It uses variables to get a server name (channel name) to put inside a get from URL block. I will use the get file at URL block to also retrieve data, but in a slightly different way -- I will change the php page to being a php page that writes to a log file, and then the program will read.
Offline
gbear605 wrote:
Dominic1 wrote:
johnnydean1 wrote:
Nope just one .php page and a SQL server.
Ok- So if the php file is at escratch.org/scratchchat/, I just put that exact URL in the block coding?
I'm working on it, and I already got this part down.
It uses variables to get a server name (channel name) to put inside a get from URL block. I will use the get file at URL block to also retrieve data, but in a slightly different way -- I will change the php page to being a php page that writes to a log file, and then the program will read.
Thanks gbear605!
Offline
If your using claw, goto the Scratch Live menu and set the URL to the "escratch.org/scratchchat/" you chose.
Offline
johnnydean1 wrote:
If your using claw, goto the Scratch Live menu and set the URL to the "escratch.org/scratchchat/" you chose.
I never knew I could do that... Maybe I'll make a version for Panther and Claw because both have different advantages and disadvantages.
eg:
Panther has a CYOB interface, and a block library, but Claw comes with many different blocks that aren't in the block library or would take forever to code.
Thanks for the tip!
Offline
gbear605 wrote:
Dominic1 wrote:
johnnydean1 wrote:
Nope just one .php page and a SQL server.
Ok- So if the php file is at escratch.org/scratchchat/, I just put that exact URL in the block coding?
I'm working on it, and I already got this part down.
It uses variables to get a server name (channel name) to put inside a get from URL block. I will use the get file at URL block to also retrieve data, but in a slightly different way -- I will change the php page to being a php page that writes to a log file, and then the program will read.
I just tried to use the set.php page gbear605 created, but when trying the host site as "www.escratch.org/scratchchat/" or "www.escratch.org/scratchchat/set.php", it wouldn't work...
jonnydean1, would you like to join the colaboration? If you do, email me at scratchchatcolab@gmail.com
EDIT: Never mind, I forgot that it was escratch.org/scratchchat/dev/
Last edited by Dominic1 (2011-06-15 15:49:49)
Offline