Heres a idea, how about we get together and make a very easy online multiplayer PHP.
Used in any mod that can get info from a webpage I propose these new blocks:
set name to %s
Sets the name of the client to a string
set game to %s
The name of the game you are playing
store %v online
Stores the chosen variable online using PHP, seperate for every user and seprated by game names
(get %v of player %s online)
Gets the variable of the selected player using PHP
(get all of %v seperated by %s)
Gets all copys of the chosen variable and the name seperated by the string
e.g
get hi seperated by /
would return:
/player1/6/player2/7/
(all players online seperated by %s)
Would return all players online seperated by a string
and they could also be used by
add all players online to list %L
add all of variable %v to list %L
so the lists would do the same as normal but the / is a newline
So anyone willing to code these in PHP please say, I can help with the Scratch side.
Offline
Try here
I dont know any PHP but if you can get the code done I think I can make a scrach block to access the webpage.
Offline
I made a account there and I got this:
$mysql_host = "mysql14.000webhost.com";
$mysql_database = "a5071744_Scratch";
$mysql_user = "a5071744_Scratch";
$mysql_password = "Scratch1";
Its a PHP thing I think. Its a empty database.
Offline
I am no expert on php, but I don't think it's possible for Panther to send info to a page. Pages can only be triggered by a block reading from it.
the only way I can think of writing info to an online store, is for each page to be IP sensitive, and say, have individual pages for all the characters on a keyboard and some other pages for things like "submit" "newline" and then get Panther to visit the correct pages in the right order and get the php to write a line corresponding to your IP with the pages in order of visit until that IP visits the submit page, then it clears the line and saves the content to a list pages for things like status, message, colour etc. you would have command pages that are visited to give meaning to a string.
here's an example of a status being updated:
page visited:
clear (clears previous string)
i
a
m
h
a
p
p
y
status
so visiting the pages in that order will clear the line representing your IP on the store page, then as you visit each character page, it will write that character to your line.
in this case "I am happy" is written to it. When you visit the status page, the php script can grab the string from your line in the store page and because you visited the "status" page, it can write that string to your line on a status page that other projects can read and display. other end commands could include "username", "speech", "send to" (if each user had a page to themselves the string could be sent to their "inbox")
this is all purely theoretical, I have no knowledge of php, but I do think that should work.... let me know what you think
Offline
Hm I think that should work, and with my VERY limited knowlage of PHP I may be able to make a mock up.
Offline
Heres my attempt:
http://scratchphp.webege.com/
It has 2 cookies that save data inputed as Sparks said with the save function adding it permenatly, I cant get the submit script working any ideas?
Offline
Yes, using Sparks' meathod I am making a website that saves text to cookies and then can share the cookie in a table in a database.
Offline
fullmoon, in case you misunderstood, this method should not call for the need of any new blocks, by reading the correct webpage with and of the blocks that report webpage contents, the page is visited and the online php script is triggered. No new blocks are technically needed I hope ^.^
Offline
sparks wrote:
fullmoon, in case you misunderstood, this method should not call for the need of any new blocks, by reading the correct webpage with and of the blocks that report webpage contents, the page is visited and the online php script is triggered. No new blocks are technically needed I hope ^.^
Well...the URL blocks in Panther, for instance, really aren't designed for this sort of thing. You essentially have two methods to pass data to a PHP script: GET and POST.
You probably recognize data being passed via GET. Take this URL, for example:
http://scratch.mit.edu/forums/post.php?tid=42022&qid=478551
Everything after the "?" is GET data. Each pair, separated by an ampersand, is a variable=value pair that was passed to the page. To you and I, "tid" and "qid" mean nothing, but to the Scratch forums' post.php script, it identifies the topic you wish to post to. In PHP, you can retrieve these using the $_GET global array.
$tid = $_GET['tid']; $qid = $_GET['qid'];
POST is a little trickier, since the data that it passes is not part of the URL, but is stuffed in the headers of the webpage, something we don't get to see. This makes it more secure than GET, and it also lets you pass longer messages. Passing these in most programming languages, or with HTML, is pretty much the same as GET, you just specify the method to use. Then the PHP script can access them with the $_POST superglobal array, just like $_GET.
The problem here is that Panther doesn't have any support for POST. You can tack variable pairs (like "string=hello") onto the end of a URL and then request it using the "contents of file" block, but problems arise once you start putting anything other than letters or numbers into the variables, because you are expected to replace them with their hexadecimal codes (%20 for a space, for instance). The other problem with GET is that it's not very secure. Since it is simply an extension of a URL it makes it very easy for people to open a browser and give their own input to your scripts. It's also worthless as an authentication system, which is why you never see a URL like this:
http://facebook.com/login.php?email=myemail@gmail.com&password=watermelons
So, to use Panther as a multiplayer client, my opinion is that you need POST support

Offline
Could you not use a database/table?
And do you think you can do it?
Offline
johnnydean1 wrote:
Could you not use a database/table?
And do you think you can do it?
Yes, but the only way to input data into that database is via a server script, and for that you sort of need to be able to send POST variables to the script.

Offline
Could you not do this:
On the A page
$letter = "A";
$IP = IP adress;
connect to database;
search table for IP;
$old = item (IP + 1) of database;
$new write = $old . $letter;
write $new to item (IP + 1) of database;
Offline
johnnydean1 wrote:
Could you not do this:
On the A page
$letter = "A";
$IP = IP adress;
connect to database;
search table for IP;
$old = item (IP + 1) of database;
$new write = $old . $letter;
write $new to item (IP + 1) of database;
Yes, but sending a string one letter at a time is too slow to be practical.

Offline
Well if you could do that I could look at the code and work from there.
Offline
I would have these blocks:
'Register'
Requests player to create an account. An command block.
'login to server %server'
Requets player to login. An command block.
'online players on server %server'
Reports a list of online players on selected server. An list reporter - shared.
'play online game %onlineGamesDownloaded'
Finds other players to play with. Then it plays selected online game. An command block.
'rank'
Reports rank on winning games. An variable reporter.
'chat'
Reports chat history, able to add text to list. An list reporter - shared.
'status'
Reports status. You can change it to online, brb, idle, busy, away or offline. An variable reporter.
'log off'
Logs player off the server.
All go in a new category called 'online' Color = grey
There is a problem with my enter key. (not anymore)
Last edited by rdococ (2010-08-01 16:18:56)
Offline
right... for one thing, you cannot add ONE new catagory, you need to do them it twos. Secondly, the blocks would clutter the space if they were supplied as part of the image, custom blocks is the way to go, as only a few of our users will want to use it. We can certainly advertise it on our site if we think it's safe and good
Any reporters will be very easy because they are just read URL blocks with a specified address, but I don't know how to squeak code a writing command. when playing online games, would they be one-sprite sprites stored online? (they can be multi sprite games by using the clone feature)
Offline
rdococ wrote:
I would have these blocks:
'Register'
Requests player to create an account. An command block.
JD1:
All this would need be would be 2 ask blocks (user and pass) and then a PHP script that writes them to a database
'login to server %server'
Requets player to login. An command block.
JD1:
All this would need to be is a block to acess a PHP script to write the IP to a database
'online players on server %server'
Reports a list of online players on selected server. An list reporter - shared.
JD1:
Just a simple webpage reporter.
'play online game %onlineGamesDownloaded'
Finds other players to play with. Then it plays selected online game. An command block.
JD1:
This may not be easy but can be done with other blocks. E.G these blocks make the game
'rank'
Reports rank on winning games. An variable reporter.
JD1:
Easy reads of a webpage.
Basic PHP to change a variable in a database when ranking up.
'chat'
Reports chat history, able to add text to list. An list reporter - shared.
JD1:
Reports a database used for chatting. Same as rank for code.
'status'
Reports status. You can change it to online, brb, idle, busy, away or offline. An variable reporter.
JD1:
Same as chat
'log off'
Logs player off the server.
JD1:
Simple PHP to remove IP from database
All go in a new category called 'online' Color = grey
There is a problem with my enter key. (not anymore)
Offline
sparks wrote:
what was the point of that? I was explaning why a new catagory does not work, why custom blocks can be used and generally ANSWERING IT! No need to repeat
![]()
I explained how to do every block.
And you can add 1 new catagory NXIII did it in a tutorial.
Offline
Well, if real HTTP support is coming to Panther, then it would be nice to see something like this:
http://scratch.mit.edu/forums/viewtopic.php?id=37130
Just saying
Any Jonnydean, if you're serious about the one-letter-per-script idea, I could write the PHP for it, I suppose.

Offline