Alice Community  

Go Back   Alice Community > Alice 2 > Works-In-Progress

Reply
 
Thread Tools Display Modes
It was here first
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default It was here first - 06-05-2010, 06:06 PM

This thread is by zonedabone, the FIRST person to write file access programs in Alice using Jython. (Tell me if you want to argue.)

Ok. I've been on hiatus working on this and that IRL. I decided today that I'd work on multiplayer through ftp. Anyway, I'm working on a set of routines that will let you easily upload files to ftp servers, and then download and read them from any computer. I've set aside a section of my IP for testing. The details, which will bring you to a folder of happyness, limited to 1 MB will be given to those who give me a reason for experiments.

Anyway, here's the code for the ftp currently. It's pretty mcuh done, minus a few extra methods that I added in the demo.
PHP Code:
connected false
from ftplib import FTP
def connect
(host,username,password):
        global 
ftp
        
global connected
        
if connected == false:
                
ftp FTP(host,username,password)
                
connected true
def upload
(filename,name):
        global 
ftp
        
global connected
        
if connected == true:
                
test open(filename'r')
                
ftp.storbinary('STOR ' nametest)
                
test.close()
def download(filename,path):
        global 
ftp
        
global connected
        
if connected == true:
                
dir open(path'w')
                
file ftp.retrbinary('RETR ' filenamedir.write)
                
dir.close()
def close():
        global 
ftp
        
global connected
        
if connected == true:
                
ftp.quit()
                 
connected false
def getwelcome
():
        global 
ftp
        
global connected
        
if connected == true:
                
world.output ftp.getwelcome()
def rename(oldfile,newfile):
        global 
ftp
        
global connected
        
if connected == true:
                
ftp.rename(oldfile,newfile)
def delete(file):
        global 
ftp
        
global connected
        
if connected == true:
                
ftp.delete(file)
def setdir(dir):
        global 
ftp
        
global connected
        
if connected == true:
                
ftp.cwd(dir)
def makedir(dir):
        global 
ftp
        
global connected
        
if connected == true:
                
mkd(dir)
def deldir(dir):
        global 
ftp
        
global connected
        
if connected == true:
                
ftp.rmd(dir
With this code, I created a world that allows two computers to communicate. In fact, all computers usng this program will see what others are saying. Enjoy! Pressing U lets you add your message to it. Now with history thanks to Dameria's suggstion! New features! C = change user! D = disconnect.
intercom.a2w

If you don't have an account and can't download the file, it is also available on wikisend:
intercom.a2w


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.

Last edited by zonedabone; 06-06-2010 at 01:24 PM.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 06-06-2010, 09:19 AM

This is good, but there are a lot of problems. One major problem is that it freezes for a few seconds until it finally shows the text, and altogether the whole program is very slow. Also, you should make it so that it is more like a chatroom where there is a list of, lets say, the previous 10 comments by people instead of only 1 comment that can be changed by anyone.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Why it is...
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default Why it is... - 06-06-2010, 09:36 AM

During the beginning, with the grey stuff, that's Alice connecting to the FTP server. About the chat-room idea, it's possible, but not easy. Sadly, there's no way to get rid of the wait at the beginning. Think of it as connecting to server.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 06-06-2010, 01:35 PM

It is a little better now, but I have another suggestion. Right now, it just creates a new line of code in the same 3d text whenever someone new talks. Maybe you can have a set list of 15 3d texts, and whenever someone says something new, it just assigns the string from the 3d text above to the one below, I think you can do this in a simple for all in order loop. You can have each string be sent to the server and saved as a string there, and then when the server accesses the other people's computers it assigns each of the strings from the sever to the strings in the program of the individual computer.

Also maybe you can have a list on the side showing which users are on so we know who is on.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Hmm.
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default Hmm. - 06-06-2010, 02:40 PM

Actually, the server does nothing. It's just everyone saving a file on the server. With the login list thing, the problem is that people can exit the program without logging out. At first, I tried having a list of texts, but it was really glitchy.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 06-06-2010, 05:45 PM

Another suggesting (sorry for posting so many times), can you add a simple alert noise for whenever somebody enters the chatroom or talks? So that we can leave up our Alice worlds and do something else, and when somebody enters the chatroom we can hear the alert and start talking to them.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 06-06-2010, 06:06 PM

Yeahh. I was thinking about that. It'll be in the next version, but right now just found out how to hack alice, so I'm making a list of every hack code in there!


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 06-07-2010, 12:36 AM

A suggestion to remove some redundancies is to replace the "if connected == true:" lines with "if connected:" and the "if connected == false:" with "if not connected:".

Using '==' or '!=' condition statements with boolean types can lead to the program to be slower than it can actually go since it's going through more (lower level) lines when it could easily skip it all .
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 06-09-2010, 08:24 PM

Quote:
Originally Posted by Niteshifter View Post
A suggestion to remove some redundancies is to replace the "if connected == true:" lines with "if connected:" and the "if connected == false:" with "if not connected:".

Using '==' or '!=' condition statements with boolean types can lead to the program to be slower than it can actually go since it's going through more (lower level) lines when it could easily skip it all .
Yeah. It's not the greatest code, but it works. I'll start working on this code once I've got the new system set up. It involves a constantly running server to keep track of which peoples are on, and then alert people and all that other wierd stuffs.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
noahx23
Senior Member
 
noahx23's Avatar
 
Status: Offline
Posts: 81
Join Date: Nov 2009
Location: outside of the box
Default 06-10-2010, 12:00 PM

wow this works pretty well, though the problem I had was that if someone wrote a large comment then it wouldn't it wouldn't fit onto the screen. But other than that nice job
   
Reply With Quote
Reply

Tags
ftp, jython, multiplayer, scripting, zonedabone

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.