Can't use XML?

A

Alrindel

Guest
Hi. If you have a DAoC-related web site and you'd like to put some real time information on it but you can't use GOA's XML pages directly (usually because your web host doesn't let you do anything but static HTML) I have made a little php script hosted on my server that will let you use javascript.

Just drop this line of code into your web page:
Code:
<script language="JavaScript" src="http://silent-death.net/xml/realm.php?server=Prydwen&realm=Albion"></script>
and change the server and realm to your own.

It will display the current state of all the relics, plus any enemy forts that your realm has captured, plus any of your realm's forts currently in enemy hands, as well as the server state and population, and the time of the last XML update. You can tweak the look of it by adding a stylesheet - there's a sample here at
http://silent-death.net/xml/realm.htm

As long as there aren't 1,000 sites getting a million hits a day, I should be able to host this without any problems.
 
A

angara-ffs

Guest
Thanks a lot :)
One question:
I onyl see the relics appear, and not the outposts?
Or is it just me and didnt i read i good enough :p

Can u explain that a bit plz.
 
A

Alrindel

Guest
The way I wrote it is that the only outposts that appear are
1) Enemy outposts currently captured by your realm, and
2) Your realm's keeps that are currently being occupied by the enemy.

If all your keeps are controlled by you and you do not control any enemy keeps, then you don't see any in the list, only relics. The logic of this is that it is supposed to be a rapid summary of the current situation, just telling you what you need to know.

If anybody really wants it done differently (ie. the whole list of keeps every time) they should send me a private message and I will see if I have the time to change the script.
 
A

angara-ffs

Guest
Thanks again Alrindel :)
As exc/hib got all the outposts themselfs, so i will wait for a raid from alb/mid and then see what is happening.

Anyway i am glad it works
And it looks nice to
Chek it out Al at MK website :clap:
 
A

Alrindel

Guest
You can tinker with the font and colours used by putting this style sheet into your page and changing it until you are happy.
Code:
<style type="text/css" title="default">
<!--
  .daoc             { font-family: Arial, Helvetica; font-size: 10pt; }
  .daocrelicgood    { color: #00cc00; font-weight: bold; }
  .daocrelicbad     { color: #cc0000; font-weight: bold; }
  .daocrelicneutral { color: #000000; }
  .daocgood         { color: #00cc00; }
  .daocbad          { color: #cc0000; }
  .daocneutral      { color: #000000; }
  .daocstatusgood   { color: #000000; }
  .daocstatusbad    { color: #cc0000; }
  .daocstatusdate   { font-size: 9pt; font-style: italic; }
// -->
</style>
Other than that, there's not really much to change, but you can still embed it in HTML if you want to dress it up a bit (put it in a table with a background colour or whatever).
 
A

Alrindel

Guest
As exc/hib got all the outposts themselfs, so i will wait for a raid from alb/mid and then see what is happening.
Middies just took Crauch. Have a look now and you'll see how it works.
 
K

Kazzam

Guest
Alrindel,

Very nice work mate.

www.bod-guild.com

Just one question though.

Do you intend to update the script when the XMl gets updated and we get guild claimants etc?

Just that a full list of keeps with the guild who claimed it and other details would be very impressive.

Im more than willing to host the PHP script on my site if needed, in case yours gets too busy, its just changing the script whic ii cant do :)

Kazzam
 
A

Alrindel

Guest
Yes, I will add "claimed by guild" as soon as it is added to the XML. I may actually make three or four different scripts like this:

1) Just gives server status (up/down) and population
2) Lists only relics and server status
3) Lists relics, server status and captured keeps (the one now)
4) Lists relics, server status and ALL keeps

That's about the limit of what I'm willing to maintain ;). And if anyone wants the PHP source, just drop me a line.

The source to this page: http://silent-death.net/xml/server.php?server=Excalibur&realm=Hibernia

is available here: http://silent-death.net/xml/server.php.txt
 
K

Kazzam

Guest
Cool,

I have written a html page using VBscript, which i will load to my website tonight and post the address here.

It shows all relic and keep info (currently for Prywden, Midgard) with a good and bad colour scheme depending on the relam you select.

Anyone is welcome to copy it and use it on there sites, or reference it from Prywden Midgard when its uploaded later, and just change the relative fields to show your realm and server details.

Kazzam
 
K

Kazzam

Guest
Well,

I have written a page using VBScript which works when i have it on my harddrive, but when its uploaded to my site i get a script error saying access denied.

I take it this is my host not allowing me to run this, so what are my options now?

The page is located at www.bod-guild.com/server.htm.

If anyone wants to copy this page and use it feel free.

It will show relic and keep information and has a realm and server option to change in the code.

Kazzam
 
T

Thorarin

Guest
Kazzam,

The problem is that a normal website is not a trusted source to execute scripts from, so you can't go and instantiate objects that might be potentially harmful..

There's no elegant way around this, but...
Why are you executing the code client side? Your server supports ASP, there's a good chance it will run server side?
 
K

Kazzam

Guest
This was the only way i knew how to do it :(

Im just not that good.

Kazzam
 
K

Kazzam

Guest
Script

Heres the script if anyone wants to use it.

Just change the style sheet details to change the colours to whatever you want.

**********************************************
<style type="text/css">
<!--
.title { font-family: Arial, Helvetica, sans-serif; font-size: 18px; color: #000000; background-color: FF9900}
.desc { font-size: 18px; font-weight: bold}
.data { font-size: 16px; font-style: italic; color: #0000FF}
.datawarn { font-size: 16px; font-style: italic; color: #FF0000}
.divrow { background-color: #FFCC00}
.datagood { font-size: 16px; font-style: italic; color: #99CC33}
-->
</style>
</head>
<body>

<Input name=status type="hidden" value="Up">





<Input name=realm type="hidden" value="Midgard">



<Input name=server type="hidden" value="5">
<!-- Values are
"0" = Excalibur
"1" = Broceliande
"2" = Avalon
"3" = Lyonesse
"4" = Ys
"5" = Prywden
"6" = Stonehenge
"7" = Logres
"8" = orcanie -->


<Script type="text/vbscript" class="title">
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("http://www.camelot-europe.com/herald/nb_connected.xml")
document.write("<table width='100%'><tr class='title'>")
document.write("Server status : " & xmlDoc.documentElement.childNodes(document.all.server.value).getAttribute("name"))
document.write("</tr></table>")
document.write("
")
document.write("<table><tr>")
document.write("<td class='desc'>Population : </td><td class='data'>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(0).text & "</td>")
document.write("<td class='desc'>Status : </td>")
if xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(1).text = document.all.status.value then
document.write("<td class='datagood'>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(1).text & "</td>")
else
document.write("<td class='datawarn'>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(1).text & "</td>")
end if
document.write("</tr></table>")
</script>





<script type="text/vbscript" class="datagood">
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("http://www.camelot-europe.com/herald/servers.xml")

document.write("<table width='100%'><tr class='title'>")
document.write("Relics")
document.write("</tr></table>
")
document.write("<table width='80%' cellpadding='0' cellspacing='0'>")
document.write("<tr class='desc'><td class='divrow'>Relic Name</td><td class='divrow'>Type</td><td class='divrow'>Realm</td><td class='divrow'>Owner</td></tr>")
y=1

while (y<7)
document.write("<tr><td>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+1).getAttribute("name") & "</td>")
document.write("<td>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+1).getAttribute("type") & "</td>")
document.write("<td>" & xmlDoc.documentElement.childNodes(0).childnodes(y+1).getAttribute("realm") & "</td>")

if xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+1).text = xmlDoc.documentElement.childNodes(0).childnodes(y+1).getAttribute("realm") then
document.write("<td class='data'>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+1).text & "</td></tr>")
else
if xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+1).text = document.all.realm.value then
document.write("<td class='datagood'>" & xmlDoc.documentElement.childNodes(5).childnodes(y+1).text & "</td></tr>")
else
document.write("<td class='datawarn'>" & xmlDoc.documentElement.childNodes(5).childnodes(y+1).text & "</td></tr>")
end if
end if

y=y+1
wend

document.write("</table>")
document.write("

")
document.write("<table width='100%'><tr class='title'>")
document.write("Keeps")
document.write("</tr></table>")
document.write("<table width='80%' cellspacing='0' cellpadding='0'>")
document.write("<tr class='desc'><td class='divrow'>Albion</td><td class='divrow'>Owner</td></tr>")
y=1
while (y<22)
if y = 8 then
document.write("<tr class='desc'><td class='divrow'>Midgard</td><td class='divrow'>Owner</td></tr>")
end if
if y = 15 then
document.write("<tr class='desc'><td class='divrow'>Hibernia</td><td class='divrow'>Owner</td></tr>")
end if

document.write("<tr><td>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+7).getAttribute("name") & "</td>")

if xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+7).text = xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+7).getAttribute("realm") then
document.write("<td class='data'>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+7).text & "</td></tr>")
else
if xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+7).text = document.all.realm.value then
document.write("<td class='datagood'>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+7).text & "</td></tr>")
else
document.write("<td class='datawarn'>" & xmlDoc.documentElement.childNodes(document.all.server.value).childnodes(y+7).text & "</td></tr>")
end if
end if
y=y+1
wend
document.write("</table>")

</script>

*************************************************

Kazzam
 

Users who are viewing this thread

Top Bottom