How do I do something lol

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.
Post Reply
Avenging Angel
Neophyte Poster
Posts: 33
Joined: Sat Aug 19, 2006 12:47 pm

How do I do something lol

Post by Avenging Angel »

I have seen on some shards that they have a link on there website that shows who is online player wise and then another link that shows the server information. How do I get that for my shard?
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

You have to enable the webserver in POL.cfg then create webpage scripts in your scripts/www path. Use the functions in http.em to create a webpage from whatever you can get in your scripts.
Avenging Angel
Neophyte Poster
Posts: 33
Joined: Sat Aug 19, 2006 12:47 pm

Post by Avenging Angel »

What do you mean a http.em? This is my first time I have even attempted to do this.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

http://poldoc.fem.tu-ilmenau.de/pol095/index.php

all the commands are listed there.

HTTP.EM is the second from the bottom on the right where it says QueryIP
Avenging Angel
Neophyte Poster
Posts: 33
Joined: Sat Aug 19, 2006 12:47 pm

Post by Avenging Angel »

I dont see any commands. And if there are commands where do I type the commands?
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

If you look down that page you'll find a place where it says "Select HTTP.EM function: ". At that drop down box you can select individual functions or you can click on the link that says "All of HTTP.EM" and see all the functions and constants that are defibed in HTTP.EM.

You use those function calls in scripts. They are not commands you type in the game. If you use any functions from that EM you must enter at the top of your script "use http;" without the quotation marks.
Avenging Angel
Neophyte Poster
Posts: 33
Joined: Sat Aug 19, 2006 12:47 pm

Post by Avenging Angel »

Ok it has that and I compiled the .src files. I still cant seem to get it to work can someone please tell me what by chance I am doing wrong?
Use uo;
Use os;
Use http;

Include "include/time";

Const BYTES_IN_KILO := 1024.0;
Const BYTES_IN_MEG := 1048576.0;

Program Server_Status( )

Var system := PolCore();
Var itemcount := PolCore().itemcount;
Var mobcount := PolCore().mobilecount;
Var load := system.load;
Var totalplayers, players;
Var Seconds := system.systime;
Var Uptim := system.uptime;

Var LongestTime := GetGlobalProperty( "LongestUptime" );
If( Uptim > LongestTime )
SetGlobalProperty( "LongestUptime", Uptim );
LongestTime := GetGlobalProperty( "LongestUptime" );
Endif

Var vers := system.version;
Var Accts := ListAccounts( );
Var TotalAccts := Len( Accts );
Var Guilds := ListGuilds( );
Var TotalGuilds := Len( Guilds );
Var Uptime := PolCore().uptime;
/*
WriteHtml( "<html><head><title>Unreal Legends</title>"
+"<style>"
+"table, tr, td {background-color: #000000;border: 1px solid #000066;}"
+"font {font-family: tahoma;font-size: 11px;}"
+"</style>"
+"</head>"
+"<body bgcolor=000000 background=http://www.montuz.com/images/I_central_fundo.jpg text=FFFFFF link=CBA300 vlink=CBA300 alink=CBA300>"
);
*/
Writehtml(
"<center><font size=2>Server Hardware</font>"
+"<table width=100% border=1 align=center cellpadding=0 cellspacing=0>"
+"<tr>"
+"<td width=100><div align=center><font size=2>CPU</font></div></td>"
+"<td width=300><div align=center><font size=2>AMD Athlon 64 3200+ / 2.01GHz (2000MHz FSB)</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=100><div align=center><font size=2>RAM</font></div></td>"
+"<td width=300><div align=center><font size=2>2.5GB DDR PC3200 400MHz CL3</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=100><div align=center><font size=2>Video</font></div></td>"
+"<td width=300><div align=center><font size=2>Leadtek GeForce 6600 256MB DDR (PCI Express)</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=100><div align=center><font size=2>HDD</font></div></td>"
+"<td width=300><div align=center><font size=2>80Gb SCSI 10000RPM</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=100><div align=center><font size=2>OS</font></div></td>"
+"<td width=300><div align=center><font size=2>Windows XP Professional with SP2</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=100><div align=center><font size=2>Connection</font></div></td>"
+"<td width=300><div align=center><font size=2>6.0Mbps Down/384Kb Up</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=100><div align=center><font size=2>Developer</font></div></td>"
+"<td width=300><div align=center><font size=2><a href=mailto:MontuZ@Gmail.com>Unreal</a></font></div></td>"
+"</tr>"
+"</table></center>"
);

Writehtml(
"<br><center><font size=2>Shard Statistics</font>"
+"<table width=100% border=1 align=center cellpadding=0 cellspacing=0>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Accounts</font></div></td>"
+"<td width=200><div align=center><font size=2>" + TotalAccts + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Guilds</font></div></td>"
+"<td width=200><div align=center><font size=2>" + TotalGuilds + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>NPC Count</font></div></td>"
+"<td width=200><div align=center><font size=2>" + mobcount + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Item Count</font></div></td>"
+"<td width=200><div align=center><font size=2>" + itemcount + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Megabits Sent/Received</font></div></td>"
+"<td width=200><div align=center><font size=2>" + FormatBytes( system.bytes_sent ) + "/" + FormatBytes( system.bytes_received ) + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Uptime</font></div></td>"
+"<td width=200><div align=center><font size=2>" + GetUpTimeString( Uptim ) + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Longest Uptime</font></div></td>"
+"<td width=200><div align=center><font size=2>" + GetUpTimeString( LongestTime ) + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Core Version</font></div></td>"
+"<td width=200><div align=center><font size=2>" + vers + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Scripts Base</font></div></td>"
+"<td width=200><div align=center><font size=2>Zuluhotel 3.0</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Scripts Version</font></div></td>"
+"<td width=200><div align=center><font size=2>UL2.3.96 Beta</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Server Started</font></div></td>"
+"<td width=200><div align=center><font size=2>Sept 16, 2005</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Server Date</font></div></td>"
+"<td width=200><div align=center><font size=2>" + GetDateString( Seconds ) + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Server Load</font></div></td>"
+"<td width=200><div align=center><font size=2>" + CStr( system.sysload ) + "%</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Timezone</font></div></td>"
+"<td width=200><div align=center><font size=2>(GMT-5:00) Eastern Time (US & Canada)</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Time</font></div></td>"
+"<td width=200><div align=center><font size=2>" + GetTimeString( Seconds ) + "</font></div></td>"
+"</tr>"
+"<tr>"
+"<td width=200><div align=center><font size=2>Location</font></div></td>"
+"<td width=200><div align=center><font size=2>NJ, USA</font></div></td>"
+"</tr>"
+"</table></center>"
);
/*
WriteHtml(
"</body></html>"
);
*/
Endprogram

Function FormatBytes( bytes )

Var mb := CDbl( bytes ) / BYTES_IN_MEG;
Var type := "MB";

If( mb < 1.0 )
mb := CDbl(bytes) / BYTES_IN_KILO;
type := "KB";
If( mb < 1.0 )
mb := bytes;
type := "B";
Endif
Endif

Return CStr( mb ) + "" + type;

Endfunction
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

did you enable the webserver in POL.cfg?

Code: Select all

#############################################################################
## Integrated Web Server
#############################################################################

#
# WebServer: in multithread mode only, run the internal web server
#            This may be a security risk.  It's susceptible to DoS attacks.
#            If someone knows a little about TCP/IP, they could cause you
#            trouble if it's enabled.
#
WebServer=1

#
# WebServerPort: What TCP/IP port to listen for web requests
#
WebServerPort=2594

#
# WebServerLocalOnly: Only allow access from localhost
#
WebServerLocalOnly=0

#
# WebServerDebug: Print trace information about http requests
#
WebServerDebug=0

#
# WebServerPassword: username/password required for access to the web server.
#                    if not specified, no password is required.
#
WebServerPassword=
Avenging Angel
Neophyte Poster
Posts: 33
Joined: Sat Aug 19, 2006 12:47 pm

Post by Avenging Angel »

This is what mine says I have open the port it had there on my router. Do I need to change the port to the same as my server?
#############################################################################
## Integrated Web Server
#############################################################################

#
# WebServer: in multithread mode only, run the internal web server
# This may be a security risk. It's susceptible to DoS attacks.
# If someone knows a little about TCP/IP, they could cause you
# trouble if it's enabled.
#
WebServer=1

#
# WebServerPort: What TCP/IP port to listen for web requests
#
WebServerPort=6060

#
# WebServerLocalOnly: Only allow access from localhost
#
WebServerLocalOnly=1

#
# WebServerDebug: Print trace information about http requests
#
WebServerDebug=0

#
# WebServerPassword: username/password required for access to the web server.
# if not specified, no password is required.
#
WebServerPassword=
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

Now one thing is,

WebServerLocalOnly=1

this means you can ONLY access the webserver from the machine the server is on using http://127.0.0.1:6060/script.ecl
Avenging Angel
Neophyte Poster
Posts: 33
Joined: Sat Aug 19, 2006 12:47 pm

Post by Avenging Angel »

ok i changed that and now I need to know how to get it to work. I think i have everything I am suppose to now. I just dont know wtf i am doing. I am running an apache webserver. I would love to get this to working.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

you dont need another webserver. Your webpages will be generated by the ecl files and served by POL itself. If you put apache on the same port, it will interfere. You should set a port in POL.cfg that no other program is going to use.

Now lets say you have a script in your scripts/www path. Lets say its named statistics.ecl. With the port set to 6060. The address would be

http://(server IP):6060/statistics.ecl

remember to always have http:// before the address otherwise you'll get an error thrown by your browser.

Also if you have htm files you want served by the webserver, you can put those in your path and access them the same way through the POL webserver. Beyond that, the webserver is very limited to what it can do.
Avenging Angel
Neophyte Poster
Posts: 33
Joined: Sat Aug 19, 2006 12:47 pm

Post by Avenging Angel »

I want to thank you all for your help its working now to just make it look right. I thank you all.
Post Reply