PDA

View Full Version : want help creating a gamebattles mod for vb


ercollins
09-22-2008, 12:40 AM
Ok so I run a clan website...and I have found some nice mods on here and I have been banging my head trying to add the ultimate console clan mod that 90% of clans would use.

Their is this xml link in the tools section on Gamebattles, yet if you use google and search

http://www.google.com/search?hl=en&q=gamebattles+xml

You will see hundreds and hundreds of people who want a way to use this xml feed provided by gamebattles.com.

I have the xml feed working, it is not pretty. But atleast unlike thousands of other people I have actually got it parsing and working on my website.

www.muteclan.com/gb/test.php (all parts of it together)



================================================== ========
this would be an ultimate clan mod for vb, my problem, I came to vB from phpbb and
no matter what I do I can get this into VB....

I have the code to parse the links in php, as you can tell above... (I know it is not pretty but I would like to make it much better looking and be able to be controlled by vB acp)
--------------------------------------------------------------------------------------------------------


Features I want to have in the mod:
Multiple game support, I think like 5 total would be great.

Each clan usually plays more than one game on gamebattles and all rosters and stuff can be different for each game.


Selection and display options.

Recent Matches Selectable
Stats Selectable
Memberlist Selectable


Links added to Quick links and Navbar


IF someone is willing to work on this mod with me I will be willing to do what i can with the look and feel if someone can help me with the creating the mod part of VB.

I am not looking to make money off of it, I just want it for my site, but I believe it would be a very nice mod to release and let others use. I would be willing to co-author and help with support or anything else for the mod.


If anyone can help me please post and let me know.

--------------- Added 1222093211 at 1222093211 ---------------

I got a little more done to this project:

I know have it loading from an extranal page via: a plugin

http://www.muteclan.com/forum/ps3_cod4.php
http://www.muteclan.com/forum/ps3_socom.php

--------------- Added 1222104715 at 1222104715 ---------------

So this is my mod code so far not much but it is a start:




In these plugins I just found a major flaw that needs to be changed some how.


I need to add an if it fails to retrieve the file, to fail.

Right now it keeps digging which breaks the board.

So I will try to add those comments and try again.

--------------- Added 1222108958 at 1222108958 ---------------

======================================
ok so I musta did something very bad.
======================================

Ok www.gamebattles.com did not like me calling my plugin include as a global start, i guess every single time someone visted any page of my forum it was pulling the xml file over and over and did not make them happy.

Now I need to find a way to do a cron job and build an xml cache directory and only pull it once an hour or so.

--------------- Added 1222133642 at 1222133642 ---------------

=========================
update: still trying to figure out how to cache the remote xml file so I can
call it from a cache directory and update the cache directory every 30 minutes.


--------------------------------------------

Was hoping someone would step up and help with this project but this seems to be turning into a running diary of my conquest on this mod.

ercollins
09-23-2008, 01:26 AM
=========================
update: Now have cache folder setup, with working code making a cache file for each team/game once an hour.
=========================

Now to turn it back on, and see if we can start getting more of more directly ported into vb
and to start learning how to set it up for to be configurable in the acp, vs external files.

--------------- Added 1222138502 at 1222138502 ---------------

Future Reference, creating a cached xml file, this is excellent code for getting the job done:


<?php

//Put the xml file you are calling: (Edit)
$query = "replace_with_url_of_the_xml_file_you_are_calling.x ml";

//Gets Current time, so you can decide how long to keep your files(do not edit)
$currentTime = microtime(true);

//replace cache/ with a folder you have created with read/write access or chmon 777
$cache = 'cache/'.md5($query);

//First check for an existing version of the time, and then check
//to see whether or not it's expired. (replace 3600 with the number of seconds
//to keep file before getting a new version of the file)

if(file_exists($cache) &&
filemtime($cache) > (time()-3600)) {

//If there's a valid cache file, load its data.
$data = file_get_contents($cache);
} else {

//If there's no valid cache file, grab a live version of the
//data and save it to a temporary file. Once the file is complete,
//copy it to a permanent file. (do not edit)

$data = file_get_contents($query);
$tempName = tempnam('cache/','YWS');
file_put_contents($tempName, $data);
rename($tempName, $cache);
}

//Loads file into simplexml.
$xml = simplexml_load_string($data);
?>



------------------------------end this update-------------------------------------------------------

Gamelobby
02-27-2010, 07:15 PM
I love this idea..!!

And i would think it is possible to be done especially now that MLG/GB have merged, there should be lots of possibilities.!