[X2] Limiting the highest rank shown in the dedimania widget

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

Post Reply
Daan
highway camper
highway camper
Posts: 4
Joined: 21 Jul 2013 13:04
Owned TM-games: TMU TM2Stadium

[X2] Limiting the highest rank shown in the dedimania widget

Post by Daan »

Hi there,

I'm using xaseco 2 with records_eyepiece for the ui. Right now the dedimania widget shows all records that exist but I want to limit the highest one that will be shown in the widget. I have tried using the <limit_recs> tag in dedimania.xml but that doesn't appear to do anything (I think that is just for the text messages before and after rounds?). I couldn't find anywhere else to set this in files relating to dedimania or records_eyepiece.

Is there any way to limit the highest rank that will be shown to say for example 30? I know a lot of other servers which show the ranks only up to 30 because players can only set records up to rank 30 there.

If there is any additional information needed just let me know and for now thanks in advance for helping out.

-Daan
Last edited by Daan on 21 Jul 2013 14:15, edited 1 time in total.
Xymph
Pit Crew
Pit Crew
Posts: 5755
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: Limited the highest rank shown in the dedimania widget

Post by Xymph »

Daan wrote:I have tried using the <limit_recs> tag in dedimania.xml but that doesn't appear to do anything (I think that is just for the text messages before and after rounds?).
It's for the claimed/secured/gained/equaled record messages: http://docs.xaseco.org/config-dedimania.php
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub
Daan
highway camper
highway camper
Posts: 4
Joined: 21 Jul 2013 13:04
Owned TM-games: TMU TM2Stadium

Re: Limited the highest rank shown in the dedimania widget

Post by Daan »

Xymph wrote:
Daan wrote:I have tried using the <limit_recs> tag in dedimania.xml but that doesn't appear to do anything (I think that is just for the text messages before and after rounds?).
It's for the claimed/secured/gained/equaled record messages: http://docs.xaseco.org/config-dedimania.php
I see, so just as I thought. I actually stumbled upon that site but the wording still didn't leave me 100% convinced.

Do you, or anyone else, know if there is a way to limit the highest rank shown in the records_eyepiece dedimania_widget?

I've been looking through the dedimania and records_eyepiece plugin php files and xml configuration files but so far I haven't found where the plugins load the dedimania records into the ui.
Xymph
Pit Crew
Pit Crew
Posts: 5755
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: Limited the highest rank shown in the dedimania widget

Post by Xymph »

Daan wrote:I see, so just as I thought. I actually stumbled upon that site
Stumbled? It's the official site for the controller you're using. :roll:
Daan wrote:Do you, or anyone else, know if there is a way to limit the highest rank shown in the records_eyepiece dedimania_widget?
I'm leaving that for RE author undef.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub
Daan
highway camper
highway camper
Posts: 4
Joined: 21 Jul 2013 13:04
Owned TM-games: TMU TM2Stadium

Re: Limited the highest rank shown in the dedimania widget

Post by Daan »

Xymph wrote:
Daan wrote:I see, so just as I thought. I actually stumbled upon that site
Stumbled? It's the official site for the controller you're using. :roll:
Daan wrote:Do you, or anyone else, know if there is a way to limit the highest rank shown in the records_eyepiece dedimania_widget?
I'm leaving that for RE author undef.
Hey don't give me that look :(. I'm quite tech savvy and like figuring stuff out. Besides the comments in all the configuration files was enough to help me through it all except for this issue. Anyway thanks for your replies and let's wait and see if undef responds. I guess my other option is trying out another dedimania widget.

edit: I think i figured it out. I need to modify the method re_getdedimaniarecords() in plugins/plugin.records_eyepiece.php to break out of the for loop when it has loaded the number of records that I want to. (80 in this case for our server). I will report back when I have tested it to confirm or deny.


edit2: it works!

Here is the old and new code for people who may have the same wishes in the future:

old

Code: Select all

function re_getDedimaniaRecords () {
	global $re_config, $re_scores, $dedi_db;


	// Clean array
	$re_scores['DedimaniaRecords'] = array();

	if ( ( isset($dedi_db['Challenge']['Records']) ) && (count($dedi_db['Challenge']['Records']) > 0) ) {
		for ($i = 0; $i < count($dedi_db['Challenge']['Records']); $i ++) {
			if ($dedi_db['Challenge']['Records'][$i]['Best'] > 0) {
				$re_scores['DedimaniaRecords'][$i]['rank']	= ($i+1);
				$re_scores['DedimaniaRecords'][$i]['login']	= $dedi_db['Challenge']['Records'][$i]['Login'];
				$re_scores['DedimaniaRecords'][$i]['nickname']	= re_handleSpecialChars($dedi_db['Challenge']['Records'][$i]['NickName']);
				$re_scores['DedimaniaRecords'][$i]['score']	= re_formatTime($dedi_db['Challenge']['Records'][$i]['Best']);
			}
		}
	}
}
new

Code: Select all

function re_getDedimaniaRecords () {
	global $re_config, $re_scores, $dedi_db;


	// Clean array
	$re_scores['DedimaniaRecords'] = array();

	if ( ( isset($dedi_db['Challenge']['Records']) ) && (count($dedi_db['Challenge']['Records']) > 0) ) {
		for ($i = 0; $i < count($dedi_db['Challenge']['Records']) && $i < 80; $i ++) {
			if ($dedi_db['Challenge']['Records'][$i]['Best'] > 0) {
				$re_scores['DedimaniaRecords'][$i]['rank']	= ($i+1);
				$re_scores['DedimaniaRecords'][$i]['login']	= $dedi_db['Challenge']['Records'][$i]['Login'];
				$re_scores['DedimaniaRecords'][$i]['nickname']	= re_handleSpecialChars($dedi_db['Challenge']['Records'][$i]['NickName']);
				$re_scores['DedimaniaRecords'][$i]['score']	= re_formatTime($dedi_db['Challenge']['Records'][$i]['Best']);
			}
		}
	}
}
So basically just breaking out of the for-loop when i=80
undef.de
Pit Crew
Pit Crew
Posts: 1365
Joined: 31 Aug 2009 18:38
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Location: Germany
Contact:

Re: [X2] Limiting the highest rank shown in the dedimania wi

Post by undef.de »

Daan wrote: Is there any way to limit the highest rank that will be shown to say for example 30? I know a lot of other servers which show the ranks only up to 30 because players can only set records up to rank 30 there.
I add this feature to the next release, so you (and others) doesn't need to change code inside the plugin in future.
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm
Daan
highway camper
highway camper
Posts: 4
Joined: 21 Jul 2013 13:04
Owned TM-games: TMU TM2Stadium

Re: [X2] Limiting the highest rank shown in the dedimania wi

Post by Daan »

That's great. For now this workaround works fine though (Just took me a small bit of digging to find the relevant code in the file, but once again great commenting and naming saves the day!).
Post Reply