ID:267913
 
I'm in need of some help.

I've gotten Dantom's CGI script.
I need a way to make an kind of chatroom.
Players will be able to, from a computer without BYOND, to connect to a site, and then, remotely, sending / receiving chats from my game, Calypso.

Chat : How are you?


Phoenix Man : Hello.
Guy : Hey Phoenix!


Like the template a bit.

Is there any possible way of doing this?
eheheheh...


Well... in my oppinion... hell no...

You're pretty clever though. You should find some way of directly contacting Byond.com Administrators. You could ask someone like that.

I doubt that anything like this has ever been done before.

GO PHOENIX MAN!!!
In response to Cheesy
I think people have done, or at least tried to do this action before.
I just want to know how the CGI system works, and perhaps create an CGI libary with it that makes it possible for me to overlook Calypso via school.
In response to Phoenix Man
It's possible. You'd need a BYOND CGI server (which at the moment only Dantom has, as far as I know). Then you could use world.Export() to send messages between the CGI program and the BYOND world, and world.Topic() (I think) to receive them and do something with them.
In response to Crispy
http://www.maz.byond.com/Castle/?cotw
This page gets changed to give details of when a game is hosted, player count and other things. Is this what you were tinking about, or was it more like DWO's one?
In response to Maz
Sorry, maz.byond.com does not have any data from a Castle Online server. Castle of the Winds Online is probably currently not neing hosted.

*coughtypocough*
In response to Airjoe
And that is why I never gave out the link. ;) >.>
In response to Jon88
By the way.

I heard about BYONDBwicki (I use it myself) and I wanna know how I can get it too. ;)
In response to Phoenix Man
Ask someone who programmed it/knows who programmed it.
http://bwicki.byond.com/ByondBwicki.dmb?ByondBwicki seems to point to Deadron.
In response to Phoenix Man
Ah man...I can't seem to get it right.

Can anyone lend me an hand?

I need an small example how to send / receive messages.

My code (index.dmb):
#define DEBUG
var
chathistory = "Chat Opened<br>"
CalypsoWorld = "byond://10.0.0.8:1000"
loggedin
guests = 1
list
discontent[0]
users = list()

world
New()
..() //Default actions (proper loading follows)
Del() //When the site is closed
..()
mob
Login()

..()

// if(src.key == "guest") //If they're a guest
//
// loggedin = "Guest - <a href=?login>Login</a>" //give them a login link
//
// else
//
// loggedin = "[src.key] - <a href=?logout>Logout</a>" //If they're logged in..
var/Form/SendMessage/D = new()
D.DisplayForm()
//Give them a logout link
Logout() //When the leave the site
..()
del(src) //Clear their stuff from the server


CGI
Topic(href) //Called when any ?[blah] link is clicked
if(!href) //If no link is found

href = "News" //Default to the news page

else //if there's a link found
if(href == "logout") //And the logout link is clicked
var/CGI/C = new() //create a new CGI object for use
C.Logout() //Call the CGI object's logout proc.
else if(href == "login") //If it's login
//Do the same except login.
var/CGI/C = new()
C.Login()
else if(href == "sent")
if(usr.key == "guest")
if(guests == 1)
..()
var/Form/SendMessage/D = new()
D.DisplayForm()
else if(href == "receive")
var/msg2 = world.Import()
world << msg2
//The default layout for the webpage with the content variable, loggedin variable, and a part of the href variable embedded into it.
/* usr << browse({"<HTML>
<HEAD>
<TITLE>Calypso</TITLE>
<link href=\"http://www.jozefboer.nl/nadrewcom.css\" rel=\"stylesheet\"
</HEAD>
<BODY BACKGROUND=\"http://www.jozefboer.nl/nbg.png\" TEXT=\"WHITE\">
<table border=\"1\" cellspacing=\"0\" bordercolor=\"black\" width=100% height=100%>
<tr><td align=right height=100><img src=\"http://www.jozefboer.nl/logo.png\"></td></tr>
<tr><td valign=top height=20 align=center><b><small>[chathistory]</td></tr>
<tr><td valign=top height=20 align=center><b><a href=\"?sent\">Send a Message</a></td></tr>
<tr><td align=center height=10>|-Logged in as [loggedin]-|</td></tr>
<tr><td align=center height=60></td></tr></table>"})*/

Form/SendMessage
form_reusable = 1
var/sent = ""
submit = "Say"
HtmlLayout() return \
{"[chathistory]<br><br>

[sent] [submit]"}
ProcessForm()
if(!sent||sent == "")
var/Form/SendMessage/D = new()
D.DisplayForm()
else
sent = "Phoenix Man : [sent]"
world << sent
world.Export("10.0.0.8:1000?shout:[sent]")
var/Form/SendMessage/D = new()
D.DisplayForm()


My code (receive.dmb):

world/Topic(href)
if(href == "shout")
var/sent = world.Import()
world << "[sent]"


Any help?
In response to Phoenix Man
Looking at it closely, you do
world.Export("10.0.0.8:1000?shout:[sent]")
in the CGI dmb.
In your world's dmb you have
world/Topic(href)
if(href == "shout")
var/sent = world.Import()
world << "[sent]"

That's not really the way to do it.
Here's an example of how you can do what you want, direct from the DM Reference on world/Topic().
world/Topic(T)
if(findtext(T,"shout:") = 1)
world << copytext(T,7)

It's not the best way, but it works.
In response to Jon88
It doesn't seem to work...

Can you give me a little bit more specific text?

#define DEBUG
CGI/Topic(T)
if(findtext(T,"receive:"))
world << copytext(T,7)
var
chathistory = "Chat Opened<br>"
CalypsoWorld = "byond://10.0.0.8:1000"
loggedin
guests = 1
list
discontent[0]
users = list()

world
New()
..() //Default actions (proper loading follows)
OpenPort(1001)
Del() //When the site is closed
..()
mob
Login()
..()
var/sent = "*** Administrator has logged in! ***"
world.Export("byond://10.0.0.8:1000?shout:[sent]")
var/Form/SendMessage/D = new()
D.DisplayForm()
//Give them a logout link
Logout() //When the leave the site
..()
del(src) //Clear their stuff from the server


Form/SendMessage
form_reusable = 1
var/sent = ""
submit = "Say"
HtmlLayout() return \
{"[chathistory]<br><br>

[sent] [submit]"}
ProcessForm()
if(!sent||sent == "")
var/Form/SendMessage/D = new()
D.DisplayForm()
else
sent = "Phoenix Man : [sent]"
world << sent
world.Export("byond://10.0.0.8:1000?shout:[sent]")
var/Form/SendMessage/D = new()
D.DisplayForm()

Replace with...?

OOC(msg as text)
if(usr.smiley == null)
world << "<font color=blue>[usr] : [sd.ProcessHTML(msg)]"
else
world << "<font color=blue>\[[sd.ProcessHTML(usr.smiley)]] [usr] : [sd.ProcessHTML(msg)]"
var/msg2 = "[usr] : [msg]"
world.Export("byond://10.0.0.8:1001?receive:[msg2]")

Replace with...?
In response to Phoenix Man
The modifications I was talking about were meant for your world's dmb. Not your CGI one.
In response to Jon88
Great! It works!
It successfully sent the message "Hi" to Calypso, outputting it there.

Now, I come to another problem.
How am I going to let the page have an input, telling what and how to input it.

CGI.DMB
var
CalypsoWorld = "10.0.0.8:1000"
chathistory = "Chat opened<br>"
loggedin
hits = 0
news = "<b>\[10/20/03\]</b> Har! I quit school, guess I didn't like it, but that's okay, I'll try again sometime, heh..I updated the site's code a bit, and worked on a few small projects off-and-on, good ol' freetime, how boring ;), anyways, that's all I'm up too! <dd><i>-James</i>"
navigation
list
discontent[0]
users = list()


proc //A few procs I use to determine unique users that visit the site

loadhits() //The loading proc for the savefile that holds the IP's that visit the site

var/savefile/F = new("hits.data") //Save the file in a .data file (it's a normal BYOND savefile)

var/list/uselist[0] //The list the users are loaded into before actually loading them

F["uhits"] >> hits //Load up the hits

F["users"] >> uselist //Load up the users list into the uselist local variable

if(!uselist) //Make sure uselist has something

users = list() //If not, make "users" a blank list

else //If so.

users = uselist //load the list fully.

savehits() //The saving proc

var/savefile/F = new("hits.data") //Create a new savefile if it doesn't exist

F["uhits"] << hits //Save the hits as "uhits" in the savefile

F["users"] << users //Save the "users" list.




world
New() //When the webpage is loaded
..() //Default actions (proper loading follows)
loadhits() //Load the hits

//Set the non-dynamic pages within the code
Del() //When the site is closed
..()
savehits() //Save the stuff

mob
Login()
..()
var/Form/Example/frm = new()
frm.DisplayForm()
if(!users.Find(src.client.address)) //Check the users list for the person's IP
//if it's not found
users.Add(src.client.address) //Add it to the list
hits++ //Add a hit
savehits() //And save
else //If it's found
return //Don't add a hit
Logout() //When the leave the site
..()
del(src) //Clear their stuff from the server
CGI
Topic(href) //Called when any ?[blah] link is clicked

var
content //set up a local variable for content display
content << "."
if(!href) //If no link is found

href = "News" //Default to the news page

content = news //Make content equal the news variable

else //if there's a link found

if(discontent.Find(href)) //if the global content list finds the link clicked

content = discontent[href] //content will equal the proper pointer to the global content list

else //if not

if(href == "logout") //And the logout link is clicked

var/CGI/C = new() //create a new CGI object for use

C.Logout() //Call the CGI object's logout proc.

else if(href == "login") //If it's login

//Do the same except login.
var/CGI/C = new()

C.Login()
else if(href == "sendmsg")
world << "called"
var/msg = "Hi"
chathistory += "[msg]<br>"
world.Export("[CalypsoWorld]?shout:[msg]")

href = "News" //And return the user to the news area

content = news

Form/Example
form_reusable = 1
form_cgi_mode = 1
// form_method = "post"
var/msg
ProcessForm()
var/end = "Administrator : [msg]"
world.Export("[CalypsoWorld]?shout:[end]")
HtmlLayout()
return \
{"[msg] [submit]"}
In response to Phoenix Man
Anyone?