gugutz
Knight
After strugling a lot to make MyRunUO to finally display and update the database tables on my sql server, i went on to show the data on my shard´s website and a even worse challenge appears: making all the files in the script compatible with pages and the permalinks system on a Wordpress setup.
After spending almost a week reading documents and several old topics that never really said anything helpfull, and re-writing a lot of the code in the original script, i finally achieved a good result and decided to share with whoever else could be interested in this.
What is necessary for this to Work:
Xampp is a product made by the Apache Friends community to make the setup of a Webserver a lot easier.
Go to phpMyAdmin of your local server and create a password for the root user, if you haven´t already.
The root user is the user that is going to be used by the script to insert data inside the db tables.
The first thing you need to do is to enable the C# script inside RunUO
Go inside the directory of your RunUO Server, and open the file scripts/engines/MyRunUo/config.cs
Search for this Line:
Change the value false to true
This will activate the Script inside RunUO.
Now, still on the same file, search for these lines:
The first field asks for the version of the ODBC MySQL which is currently installed on your system.
If you downloaded the latest version of the conector, by the time of writing this article, the version should be 5.2a, as showed in the example code above.
Fill in the values between question marks according to your hostname, database name, dbuser and dbpassword.
For dbuser, put root, and for dbpass, put the password you chose for your root user
After that, start RunUO with your SQL server running and check if it gives you any errors.
If all goes withouth errors, login in on your shard with an admin account and type this command in game:
Check the server window to see if updates the sql tables without issues.
If everything goes without any errors, your server´s MyRunUO system is up and updating the SQL tables.
Now its time to read and display that data.
Now we are going to configure the database connection settings for the PHP script.
Search for the file myrunuo-php-settings.php
Look for these lines (should be the first ones on the file):
Fill the fields with the appropriate values, and don´t forget that this time the user will not be the root user, but the new user you created, that will have access from outside your local server, that is to be able to gather data from the db and showing on your shard´s website.
After that, save the file, and call the page status.php on your site to see if its working.
First, open the file style.css on your Wordpress Child Theme, then add the following code on the very beggining of the file:
This will make your child theme call the design file for the script as soon and your site is loaded.
Now its time to integrate the script inside the entire page escructure and permalinks on Wordpress.
Ex: if your childtheme is inside a folder named uoshard, the script should be in /wp-content/themes/uoshard/myrunuo-php
This will allow you to edit the script files using the Wordpress theme editor, which is very convinient, and will also allow you to use the Custom Page Templates, which are the files that make the integration possible.
Visit the page to confirm that its working.
Now all you have to do is to repeat the above procedure for every page in the script, and use its repective page model.
Bellow are all the pages you need to create, and their respective Page Models to be used.
Also, you might want to use the Wordpress categorie system for organization purposes, and use the Main page of the script, the Status page, as the Parent Page of all other pages
Beware though, because Wordpress will change the permalink for those pages and you will need to change them as well in myrunuo-php-settings. (ex:instead of your-shard-site.com/players, wordpress will show your-shard-site.com/status/players)
After you finish creating theses pages and associating them with their respective Models, the script will be fully integrated inside your Wordpress Site.
Access the main status page to check it out.
To adjust stuff inside the script, just edit the file myrunuo-php-settings.php on your Wordpress Theme Editor.
You can set things like shard information, name, adress, login info, among many other things.
For now only english is available
I´ll be adding support for more languages, currently testing the feature but having some problems with the PHP code.
When i manage to get it working i´ll update the package and post here.
On my shard´s website @ shard.tavernadigital.net/status
Please notice that this is just a test, unfinished site that i use to test the script.
I don´t have a working populated server, the whole system for now is up only for testing purposes (both server and site), so please forgive the crude design.
You can however see the script working live on a Wordpress setup in there.
===============================================================================
Issues to be fixed:
Please disconsider any gramatical errors, contextual incoherences and other mistakes.
The documentation was made in a hurry while i was in the process of putting the script to work (several weeks ago), so i didn´t plan or reviewed it a lot.
Also i´ve been translating to english for a long time now and need to take a break.
I´ll correct all mistakes eventually.
Also i made this as a hobby out of my love for Ultima Online and Webdesigning.
Any questions, suggestions or corrections please reply on this thread, as i intend to maintain this tutorial and improving it over time.
I´ll leave here the changelog of the script since the version i could find, to keep a history and let you guys know what´s going on.
Download MyRunUO PHP v2.0
Latest package is attached to this post.
Download attachment bellow [at the very end of this post]
Success on your endeavour!
After spending almost a week reading documents and several old topics that never really said anything helpfull, and re-writing a lot of the code in the original script, i finally achieved a good result and decided to share with whoever else could be interested in this.
Note: i didn´t create this script, and take no credits for creating it.
This version is my modification of the l MyRunUO PHP 1.01 script, which by itself it also a modification of the original ASP script released by the old and famous Zulu Hotel Shard.
I downloaded the v1.01 of the PHP Script and modified it, cleaning a lot of the old deprecated code, giving a more inventive and updated structure using php calls, html5 and advanced tables.
I also centralized all the design of the script into a single CSS file and added some small functionalities, besides i also unified basicly everything in the script into PHP variables, to make the configuration and localization (read translation) of the script much easier.
What is necessary for this to Work:
- An Apache Server and a MySQL server installed
- The ODBC Conector for your system provided on MySQL website
- A text editor (i recommend Notepad++, but use whatever you´re most confortable with)
Xampp is a product made by the Apache Friends community to make the setup of a Webserver a lot easier.
===============================================================================
Configuring the Database
According to Zippy, from the RunUO Team, its not recommended to have the database outside the localserver (ex: on your website server), because this will consume bandwith from players while the status are being updated.
Go to phpMyAdmin of your local server and create a password for the root user, if you haven´t already.
The root user is the user that is going to be used by the script to insert data inside the db tables.
===============================================================================
Enabling and Configuring MyRunUO C# Script
The first thing you need to do is to enable the C# script inside RunUO
Go inside the directory of your RunUO Server, and open the file scripts/engines/MyRunUo/config.cs
Search for this Line:
Code:
// Is MyRunUO enabled?
public static bool Enabled = false;
Change the value false to true
This will activate the Script inside RunUO.
Now, still on the same file, search for these lines:
Code:
// Details required for database connection string
public const string DatabaseDriver = "{MySQL ODBC 5.2a Driver}";
public const string DatabaseServer = "localhost";
public const string DatabaseName = "myrunuo";
public const string DatabaseUserID = "dbuser";
public const string DatabasePassword = "dbpass";
The first field asks for the version of the ODBC MySQL which is currently installed on your system.
If you downloaded the latest version of the conector, by the time of writing this article, the version should be 5.2a, as showed in the example code above.
Fill in the values between question marks according to your hostname, database name, dbuser and dbpassword.
For dbuser, put root, and for dbpass, put the password you chose for your root user
After that, start RunUO with your SQL server running and check if it gives you any errors.
If all goes withouth errors, login in on your shard with an admin account and type this command in game:
Code:
[B][UpdateMyRunUo[/B]
Check the server window to see if updates the sql tables without issues.
If everything goes without any errors, your server´s MyRunUO system is up and updating the SQL tables.
Now its time to read and display that data.
Showing Data from the Database on your Website
- Create another db user, which will have external access to the local database and will be used to make the reading of the data from the external website.
- Give ALL_PRIVILEGES to this new user created on the table that MyRunUO uses
- Edit the privileges of this newly created user so it is able to access the database from any server:
Edit Privileges > Change Login Information / Copy User, then change the field Host to Any Host ( % )
Configuring MyRunUO PHP Database Settings
Now we are going to configure the database connection settings for the PHP script.
Search for the file myrunuo-php-settings.php
Look for these lines (should be the first ones on the file):
Code:
// Enter your MyRunUO MySQL information
$SQLhost = "db hostname";
$SQLport = "3306";
$SQLuser = "new-db-user";
$SQLpass = "new-db-user-pass";
$SQLdb = "db name";
Fill the fields with the appropriate values, and don´t forget that this time the user will not be the root user, but the new user you created, that will have access from outside your local server, that is to be able to gather data from the db and showing on your shard´s website.
After that, save the file, and call the page status.php on your site to see if its working.
===============================================================================
Integrating MyRunUO 2.0 with a Wordpress Setup
For this we will be using Custom Page Templates, which are all based on the page.php from the default Wordpress theme, Twenty Twelve, chosen because its basicly used on any new Wordpress setup.
With Custom Page Templates the script integrates better, completely compatible with the permalinks system.
In case your Child Theme is not based on Twenty Twelve, all you need to do is make a copy of the page template of your Parent Theme and perform a <?php include()) from every file from the script right where the content is called.
First, open the file style.css on your Wordpress Child Theme, then add the following code on the very beggining of the file:
Code:
/* Importing MyRunUo-PHP CSS" */
@import url("myrunuo-php/myrunuo.css");
This will make your child theme call the design file for the script as soon and your site is loaded.
Now its time to integrate the script inside the entire page escructure and permalinks on Wordpress.
Uploading the Script to your Site
Upload the entire myrunuo-php folder to inside the folder of your Child Theme.Ex: if your childtheme is inside a folder named uoshard, the script should be in /wp-content/themes/uoshard/myrunuo-php
This will allow you to edit the script files using the Wordpress theme editor, which is very convinient, and will also allow you to use the Custom Page Templates, which are the files that make the integration possible.
Creating Pages to Integrate the Script
After uploading the script folder, do the following:- Go the your Wordpress Admin Panel, and create a new page.
- Name this page 'Status', and make sure that the permalink is '/status/'
- In Page Atributes, change the Model to MyRunUo-PHP Status Page Template
- Publish the Page.
Visit the page to confirm that its working.
Now all you have to do is to repeat the above procedure for every page in the script, and use its repective page model.
Bellow are all the pages you need to create, and their respective Page Models to be used.
Also, you might want to use the Wordpress categorie system for organization purposes, and use the Main page of the script, the Status page, as the Parent Page of all other pages
Beware though, because Wordpress will change the permalink for those pages and you will need to change them as well in myrunuo-php-settings. (ex:instead of your-shard-site.com/players, wordpress will show your-shard-site.com/status/players)
After you finish creating theses pages and associating them with their respective Models, the script will be fully integrated inside your Wordpress Site.
Access the main status page to check it out.
Configuring MyRunUO PHP
To adjust stuff inside the script, just edit the file myrunuo-php-settings.php on your Wordpress Theme Editor.
You can set things like shard information, name, adress, login info, among many other things.
Translating MyRunUO PHP
For now only english is available
I´ll be adding support for more languages, currently testing the feature but having some problems with the PHP code.
When i manage to get it working i´ll update the package and post here.
Where can i see the script working?
On my shard´s website @ shard.tavernadigital.net/status
Please notice that this is just a test, unfinished site that i use to test the script.
I don´t have a working populated server, the whole system for now is up only for testing purposes (both server and site), so please forgive the crude design.
You can however see the script working live on a Wordpress setup in there.
ScreenShots
The Main Script Page
The Shard Players Window
The Search Players Page
All Guilds Page
Single Guild Page
The Shard Information Page
The New All Stats Page (under development)
===============================================================================
Issues to be fixed:
- Paperdoll generator not working. (need help with it)
- Integrate the Webregister script inside the package.
- Improve this horrible documentation
- Isolate all text labels into one file to add easy languages support
Please disconsider any gramatical errors, contextual incoherences and other mistakes.
The documentation was made in a hurry while i was in the process of putting the script to work (several weeks ago), so i didn´t plan or reviewed it a lot.
Also i´ve been translating to english for a long time now and need to take a break.
I´ll correct all mistakes eventually.
Also i made this as a hobby out of my love for Ultima Online and Webdesigning.
Any questions, suggestions or corrections please reply on this thread, as i intend to maintain this tutorial and improving it over time.
I´ll leave here the changelog of the script since the version i could find, to keep a history and let you guys know what´s going on.
Changelog
v2.0 by gugutz
v1.01
- Creation of Custom Page Templates, to integrate the script into Worpress Pages
- Cleaning of whole code: tags and attributes deprecated (<font>, <center>, align, etc...)
- Creation and integration of the new file myrunuo-php-settings.php, that by itself defines almost every configuration available in the script, making setup gets considerably easier.
- Transfered all the inline design elements from tags into a single CSS3 file:myrunuo.css. You can controll the entire look of the script from this file.
- Created a basic HTML5 structure which is shared between all pages in the script using PHP includes, avoiding unecessary code repetition througout every page
- Transfered all PHP functions into a single file called myrunuo-functions.php (again, to avoid unecessary code repetition and make maintenance easier)
- Altering and modernizing visual identity of the original design, to give the script a more RunUO like kinda look and feel
- Added transparency to file paperdoll.png so it better integrates any color design
- Added some CSS3 animations and :hover effects (for eye-candy purposes :] )
- Added page 'All Stats', which basicly unifies the entire script into one big page of stats containing lots of info.
- Added page Shard Info, which shows Technical Info about the Shard and Server
- Added a navigation bar containing usefull toplinks in all pages
- Variables for text labels on basicly everything. You can translate the whole thing just by editing the variables inside themyrunuo-php-settings.php file
- Removido capitalização da primeira letra dos nomes de guildas usando imagem
v1.00
- Fixed html codes showng in names.
v0.92
- Added paperdolls to player pages using Kinetix's script.
- Added guild name to guild skill averages page.
v0.91
- Added line break after "Grandmaster" in player skills page.
- Fixed guild warfare listing not showing guild names.
- Corrected rank numbering in guild list.
- Fixed problems with timestamps.
- Fixed blank players showing up in status (staff members).
- Fixed title in guild page.
- Fixed page arrows not appearing - modified page status for status, players, and guilds.
Download MyRunUO PHP v2.0
Latest package is attached to this post.
Download attachment bellow [at the very end of this post]
Success on your endeavour!