Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Making a Simple HTML page with DarkBasic (for top scores page, etc)

Author
Message
3D Coding
17
Years of Service
User Offline
Joined: 15th Jan 2007
Location: My 3D Spaceship
Posted: 21st Jan 2007 23:03
heres a simple way to make a html page with your program. For top list, or player summary, or whatever, in case anybody needs it.

path=path exist("c:\playerdata")
if path=0 then make directory "c:\playerdata"
set dir "playerdata"
files=file exist("topscores.html")
if files=0 then make file "topscores.html"

Above: You have to make a directory and a file before you can use it. the path exist tests to see if the directory is already created, if returns zero (false) it makes one.

delete file "c:\topscores.html" <---- you have to delete the old one to update it - or so it seems
open to write 1,"c:\topscores.html"
write string 1,"<center>" <--- you can put html code to make it sit on page right
write string 1,"<B>YOUR GAME NAME (c) YOUR COMPANY 2007<p>" <-- <B>=bold
write string 1,"<h3>PLAYER SUMMARY REPORT FOR:<br>" <-- <h3>=medium headline typeface
write string 1, playernumber$(1)+"."+playername$(1)+"</h3></B><p>"

ABOVE: </h3> is the end... everything between <h3> and </h3> will be printed on the page at that size. <h1> is the largest.

write string 1,"Your Points:"+str$(score(1))+" Your Rank:"+str$(ranking(1))+"<br>" <---- <br>= carriage return <p>=paragraph
write string 1,"DATE:--January, 2007(or put date$ here)<br>"
write string 1,"</center>" <--- tells browser to stop centering text
...then continue writing in scores, or other info as desired...

close file 1 <---- we're all done with the file... closing out

code without the remarks is here:

3D Coding
17
Years of Service
User Offline
Joined: 15th Jan 2007
Location: My 3D Spaceship
Posted: 21st Jan 2007 23:08
I noticed an extra delete file command... heres the corrected code
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 21st Jan 2007 23:11
Why do you make a file only to delete it?



This makes an html file with the high score in it, but it wouldn't be useful for a high scores list since people would have to keep e-mailing the website to whoever can post it on the correct site.

3D Coding
17
Years of Service
User Offline
Joined: 15th Jan 2007
Location: My 3D Spaceship
Posted: 21st Jan 2007 23:19
A code like this would probably be used for remote hosting a game (which I plan to do.) A player wants to check their stats and so the game produces a html page. I think BlueGUI does stuff like this but I haven't looked at it yet.

When I was testing this out, it seems you have to delete the old copy to do an update. Otherwise the old page continues to live.

Login to post a reply

Server time is: 2024-09-25 15:31:20
Your offset time is: 2024-09-25 15:31:20